Hey there!
Since I’m often using pages solely as containers for children like news, portfolio items, staff or gallery images, I tried to simplify the panel for such behaviour.
TL;DR:
If the “show only subpages” option is true only the sidebar will be visible, in full width. And instead of “pages” it will print the name of the subpage container. In my case that’s “news”.
It’s quite hacky and not really clean, but it works. For sure there are downsides to this, such as not being able to edit the title anymore, but most of the time this isn’t even necessary.
Here are the files I modified:
Adding a class to the “bars” element in /panel/app/views/pages/show.php, line 3
<div class="bars bars-with-sidebar-left cf seiten<?php echo $page->nurseiten() ?>">
Overwriting the CSS for the side- and mainbar in /panel/assets/css/panel.css
.seitentrue .sidebar {
width: 100%;
}
.seitentrue .mainbar {
display: none;
}
.seitentrue:before {
width: 100%;
}
Setting the title of the “pages”-sidebar to the page title in /panel/app/controllers/views/pages.php, line 66
// Nur Unterseiten?
if($page->nurseiten() == "true") {
$titel = $page->title();
}
else {
$titel = l('pages.show.subpages.title');
}
// create the snippet and fill it with all data
$subpages = new Snippet('pages/sidebar/subpages', array(
'title' => $titel,
'page' => $page,
'subpages' => $children,
'addbutton' => !api::maxPages($page, $blueprint->pages()->max()),
'pagination' => $children->pagination(),
));
Is there another way to do panel extensions like this?
Everytime Kirby gets an update to the panel these changes need to be made again…
Maybe an optional folder with JavaScript- and CSS-files which extend the panel would be a good idea?