Minor improvements in pages.list view

This commit is contained in:
Giuseppe Criscione 2018-06-17 01:56:51 +02:00
parent 6866207f9d
commit 322eccfcde
3 changed files with 18 additions and 11 deletions

View File

@ -39,8 +39,9 @@ class Dashboard extends AbstractController {
array(
'pages' => $site->descendants()->sort('lastModifiedTime', SORT_DESC)->slice(0, 5),
'subpages' => false,
'class' => array('pages-list-top'),
'sortable' => false
'class' => 'pages-list-top',
'parent' => null,
'sortable' => 'false'
),
false
),

View File

@ -39,8 +39,9 @@ class Pages extends AbstractController {
array(
'pages' => $this->site->pages(),
'subpages' => true,
'templates' => $this->site->templates(),
'class' => array('pages-list-top')
'class' => 'pages-list-top',
'parent' => '.',
'sortable' => 'true'
),
false
);

View File

@ -1,12 +1,15 @@
<ul class="pages-list <?= implode(' ', $class) ?>" data-parent="<?= isset($parent) ? $parent : '.' ?>"<?php if (isset($sortable) && $sortable === false): ?> data-sortable="false"<?php endif; ?>>
<ul class="pages-list <?= $class ?>" data-sortable="<?= $sortable ?>" <?php if ($parent): ?>data-parent="<?= $parent ?>"<?php endif; ?>>
<?php
foreach ($pages as $page):
if ($page->published()) $status = 'published';
if (!$page->routable()) $status = 'not-routable';
if (!$page->published()) $status = 'not-published';
$date = date($this->option('date.format') . ' ' . $this->option('date.hour_format'), $page->lastModifiedTime());
$reorder = is_null($page->num()) || $page->template()->scheme()->get('num') == 'date';
$routable = $page->published() && $page->routable();
?>
<li class="<?= $subpages ? 'pages-level-' . $page->level() : '' ?><?= (is_null($page->num()) || $page->template()->scheme()->get('num') == 'date') ? ' no-reorder' : '' ?>">
<li class="<?php if ($subpages): ?>pages-level-<?= $page->level() ?><?php endif; ?><?php if ($reorder): ?> no-reorder<?php endif; ?>">
<div class="pages-item">
<div class="pages-item-cell page-details">
<div class="page-title">
@ -20,7 +23,7 @@
<a href="<?= $this->uri('/pages/' . trim($page->slug(), '/') . '/edit/') ?>" title="<?= htmlspecialchars($page->title()) ?>"><?= $page->title() ?></a>
</div>
<div class="page-uri">
<a <?= $page->published() && $page->routable() ? 'href="' . $this->pageUri($page) . '"' : '' ?>target="_blank"><?= $this->pageUri($page) ?></a>
<a <?php if ($routable): ?>href="<?= $this->pageUri($page) ?>"<?php endif; ?> target="_blank"><?= $page->slug() ?></a>
</div>
</div>
<div class="pages-item-cell page-date">
@ -42,16 +45,18 @@
<?php
if ($subpages && $page->hasChildren()):
$children = $page->children();
if ($page->template()->scheme()->get('reverse')) $children = $children->reverse();
$sortable = $page->template()->scheme()->get('sortable-children', true);
$this->view('pages.list', array(
'pages' => $children,
'subpages' => true,
'templates' => $templates,
'class' => array('pages-children'),
'parent' => $page->slug(),
'sortable' => $sortable
'class' => 'pages-children',
'parent' => $sortable ? $page->slug() : null,
'sortable' => $sortable ? 'true' : 'false'
));
endif;
?>
</li>