-<?php if (isset($listing)) : ?>
<div class="sidebar">
- <?php include __DIR__."/edit.phtml" ?>
+ <?php
+ if (isset($baseUrl) || !isset($entry)) {
+ $up = "";
+ } else {
+ $up = str_repeat("../", count($entry->getParents()));
+ }
+ ?>
<ul>
- <li>↰ <a href="">Home</a></li>
- <?php if (($entry = $listing->getParent())) : ?>
- <li>↑ <a href="<?=$entry->formatUrl()?>"><?=$entry->formatLink()?></a></li>
- <?php endif; ?>
- <?php if (($entry = $listing->getSelf()) && ($link = $entry->formatLink())) : ?>
- <ul><li>↻ <?= $link ?>
- <?php endif; ?>
- <?php if (count($listing)) : ?>
+ <li>↰ <a href="<?= $up ?>">Home</a>
+ <?php if (isset($entry)) : /* @var \mdref\Entry $entry */ ?>
<ul>
- <?php foreach ($listing as $entry) : ?>
- <li>↳ <a href="<?=$entry->formatUrl()?>"><?=$entry->formatLink()?></a></li>
+ <li>
+ <?php foreach ($entry->getParents() as $parent) if ($parent->isFile()) : ?>
+ ↑
+ <a href="<?= $up.$view->esc($parent->getName()) ?>">
+ <?= $view->esc($entry->getRepo()->getEntry($parent)) ?>
+ </a>
+ <ul>
+ <li>
+ <?php endif; ?>
+ ↻ <a href="<?= $up.$view->esc($entry->getName()) ?>"
+ ><?= $view->esc($entry) ?></a>
+ <ul>
+ <?php foreach ($entry as $sub) : /* @var \mdref\Entry $sub */ ?>
+ <li>
+ ↳ <a href="<?= $up.$view->esc($sub->getName()) ?>"
+ ><?= $view->esc($sub) ?></a>
+ </li>
+ <?php endforeach; ?>
+ </ul>
+ <?php foreach ($entry->getParents() as $parent) if ($parent->isFile()) : ?>
+ </li>
+ </ul>
+ <?php endif; ?>
+ </li>
+ </ul>
+ <?php elseif (isset($refs)) : ?>
+ <ul>
+ <?php foreach ($refs as $repo) : /* @var \mdref\Repo $repo */ ?>
+ <?php foreach ($repo as $sub) : /* @var \mdref\Entry $entry */ ?>
+ <li>
+ ↳ <a href="<?= $view->esc($sub->getName()) ?>"
+ ><?= $view->esc($sub->getTitle()) ?></a>
+ </li>
+ <?php endforeach; ?>
<?php endforeach; ?>
</ul>
- <?php endif; ?>
- <?php if (isset($link) && strlen($link)) : ?>
- </li></ul>
- <?php endif; ?>
+ <?php endif; ?>
+ </li>
</ul>
+ <?php if (isset($entry)) : ?>
+ <div class="edit">
+ <a href="<?= $entry->getEditUrl() ?>">Edit</a>
+ </div>
+ <?php endif; ?>
</div>
-<?php endif; ?>
+