8
0

Add an arrow to open sub-trees, fixes #277

Dieser Commit ist enthalten in:
Stéphane Goetz
2016-04-02 13:39:04 +02:00
Ursprung 2b3893a768
Commit 2bd1978f0e
7 geänderte Dateien mit 61 neuen und 20 gelöschten Zeilen

Datei anzeigen

@ -78,10 +78,13 @@ class Template
$nav = "";
foreach ($entries as $entry) {
if (array_key_exists('children', $entry)) {
$icon = '<i class="arrow">&nbsp;</i>';
if (array_key_exists('href', $entry)) {
$link = '<a href="' . $entry['href'] . '" class="folder">' . $entry['title'] . '</a>';
$link = '<a href="' . $entry['href'] . '" class="folder">' . $icon . $entry['title'] . '</a>';
} else {
$link = '<a href="#" class="aj-nav folder">' . $entry['title'] . '</a>';
$link = '<a href="#" class="aj-nav folder">' . $icon . $entry['title'] . '</a>';
}
$link .= $this->renderNavigation($entry['children']);
@ -110,7 +113,7 @@ class Template
$nav[] = [
'title' => $node->getTitle(),
'href' => $base_page . $link,
'class' => ($current_url === $link) ? 'active' : ''
'class' => $current_url === $link ? 'active' : '',
];
} elseif ($node instanceof Directory) {
if (!$node->hasContent()) {
@ -121,7 +124,7 @@ class Template
$folder = [
'title' => $node->getTitle(),
'class' => (strpos($current_url, $link) === 0) ? 'open' : '',
'class' => strpos($current_url, $link) === 0 ? 'open' : '',
];
if ($mode === Daux::STATIC_MODE) {
@ -136,6 +139,10 @@ class Template
$new_path = ($path === '') ? $url : $path . '/' . $url;
$folder['children'] = $this->buildNavigation($node, $new_path, $current_url, $base_page, $mode);
if (!empty($folder['children'])) {
$folder['class'] .= ' has-children';
}
$nav[] = $folder;
}
}