pupupu

simple static CMS for crappy servers
git clone https://git.ce9e.org/pupupu.git

commit
bc8cae183b91f21a29b7d555e822711793da82e3
parent
746080eb9e11fe75b6fb01e64f46bcedc55e79bc
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2018-10-20 13:42
rm breadcrumbs

Diffstat

M index.php 16 ----------------
M templates/base.html 8 ++------
M templates/page.html 20 --------------------

3 files changed, 2 insertions, 42 deletions


diff --git a/index.php b/index.php

@@ -89,18 +89,6 @@ function validatePath($path)
   89    89     }
   90    90 }
   91    91 
   92    -1 function getBreadcrumbs($path)
   93    -1 {
   94    -1     $breadcrumbs = array(trans('home') => '');
   95    -1     $parts = explode('/', $path);
   96    -1     for ($i = 1; $i < count($parts); $i++) {
   97    -1         $name = $parts[$i];
   98    -1         $path = implode('/', array_slice($parts, 0, $i + 1));
   99    -1         $breadcrumbs[$name] = $path;
  100    -1     }
  101    -1     return $breadcrumbs;
  102    -1 }
  103    -1 
  104    92 class Pupupu
  105    93 {
  106    94     public function __construct($srcDir, $targetDir, $targetUrl)
@@ -339,11 +327,7 @@ function pageView($pupupu, $twig)
  339   327             echo $twig->render('page.html', array(
  340   328                 'yml' => $pupupu->get($path, 'yml'),
  341   329                 'md' => $pupupu->get($path, 'md'),
  342    -1                 'subpages' => $pupupu->getSubpages($path),
  343    -1                 'path' => $path,
  344   330                 'url' => $pupupu->getUrl($path),
  345    -1                 'pathIsFile' => pathIsFile($path),
  346    -1                 'breadcrumbs' => getBreadcrumbs($path),
  347   331             ));
  348   332         } elseif (isset($_POST['delete'])) {
  349   333             if ($path === '') {

diff --git a/templates/base.html b/templates/base.html

@@ -10,14 +10,10 @@
   10    10 </head>
   11    11 <body>
   12    12     <header>
   13    -1         <nav aria-label="Breadcrumbs">
   14    -1             {% block breadcrumbs %}
   15    -1                 <a href="?path=">{{ 'home'|trans }}</a> /
   16    -1             {% endblock %}
   17    -1         </nav>
   18    13         <nav>
   19    -1             <a href="?path=_site">{{ 'site config'|trans }}</a>
   -1    14             <a href="?">{{ 'pages'|trans }}</a>
   20    15             <a href="?path=_uploads">{{ 'uploads'|trans }}</a>
   -1    16             <a href="?path=_site">{{ 'config'|trans }}</a>
   21    17         </nav>
   22    18     </header>
   23    19 

diff --git a/templates/page.html b/templates/page.html

@@ -1,11 +1,5 @@
    1     1 {% extends 'base.html' %}
    2     2 
    3    -1 {% block breadcrumbs %}
    4    -1     {% for name, path in breadcrumbs %}
    5    -1         / <a href="?path={{ path }}">{{ name }}</a>
    6    -1     {% endfor %}
    7    -1 {% endblock %}
    8    -1 
    9     3 {% block main %}
   10     4     <form method="POST">
   11     5         <label>
@@ -28,18 +22,4 @@
   28    22             </div>
   29    23         </div>
   30    24     </form>
   31    -1 
   32    -1     {% if not pathIsFile %}
   33    -1         <ul class="file-list">
   34    -1             {% for name, path in subpages %}
   35    -1                 <li><a href="?path={{ path }}" class="file-list__main">{{ name }}</a></li>
   36    -1             {% endfor %}
   37    -1             <li>
   38    -1                 <form class="flex-ignore">
   39    -1                     <input type="hidden" name="path" value="{{ path }}">
   40    -1                     <input type="text" name="add" placeholder="{{ 'add page'|trans }}" class="input--invisible file-list__main">
   41    -1                 </form>
   42    -1             </li>
   43    -1         </ul>
   44    -1     {% endif %}
   45    25 {% endblock %}