mirror of
https://github.com/til-schneider/slim-wiki.git
synced 2025-08-05 08:07:35 +02:00
Showing directories having no 'index.md' in breadcrumbs (configurable)
This commit is contained in:
@@ -36,6 +36,7 @@ body {
|
|||||||
|
|
||||||
.breadcrumbs {
|
.breadcrumbs {
|
||||||
background-color: white;
|
background-color: white;
|
||||||
|
cursor: default;
|
||||||
|
|
||||||
.main-column {
|
.main-column {
|
||||||
padding: 15px 0;
|
padding: 15px 0;
|
||||||
|
@@ -7,4 +7,7 @@ if (function_exists('date_default_timezone_set')) {
|
|||||||
$config['wikiName'] = 'Slim Wiki';
|
$config['wikiName'] = 'Slim Wiki';
|
||||||
$config['lang'] = 'en'; // 'de' or 'en'
|
$config['lang'] = 'en'; // 'de' or 'en'
|
||||||
|
|
||||||
|
// Hide directories having no 'index.md' in breadcrumbs
|
||||||
|
//$config['showCompleteBreadcrumbs'] = false;
|
||||||
|
|
||||||
//$config['footerHtml'] = '© Copyright 2000-'.date('Y').' My name';
|
//$config['footerHtml'] = '© Copyright 2000-'.date('Y').' My name';
|
||||||
|
@@ -110,7 +110,7 @@ if ($mode == 'edit') {
|
|||||||
if (! $isFirst) {
|
if (! $isFirst) {
|
||||||
echo ' / ';
|
echo ' / ';
|
||||||
}
|
}
|
||||||
if ($item['active']) {
|
if ($item['active'] || is_null($item['path'])) {
|
||||||
echo $item['name'];
|
echo $item['name'];
|
||||||
} else {
|
} else {
|
||||||
?><a href="<?php echo $data['basePath'] . $item['path'] . (($mode == 'edit') ? '?edit' : ''); ?>"><?php echo $item['name']; ?></a><?php
|
?><a href="<?php echo $data['basePath'] . $item['path'] . (($mode == 'edit') ? '?edit' : ''); ?>"><?php echo $item['name']; ?></a><?php
|
||||||
|
@@ -28,7 +28,8 @@ class Context {
|
|||||||
$config = array(
|
$config = array(
|
||||||
'wikiName' => 'Slim Wiki',
|
'wikiName' => 'Slim Wiki',
|
||||||
'timezone' => 'Europe/Berlin',
|
'timezone' => 'Europe/Berlin',
|
||||||
'lang' => 'en'
|
'lang' => 'en',
|
||||||
|
'showCompleteBreadcrumbs' => true
|
||||||
);
|
);
|
||||||
|
|
||||||
if (file_exists(__DIR__ . '/../../config.php')) {
|
if (file_exists(__DIR__ . '/../../config.php')) {
|
||||||
|
@@ -172,7 +172,9 @@ class Main {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function createBreadcrumbs($requestPathArray) {
|
private function createBreadcrumbs($requestPathArray) {
|
||||||
$wikiName = $this->context->getConfig()['wikiName'];
|
$config = $this->context->getConfig();
|
||||||
|
$wikiName = $config['wikiName'];
|
||||||
|
$showCompleteBreadcrumbs = $config['showCompleteBreadcrumbs'];
|
||||||
$pathCount = count($requestPathArray);
|
$pathCount = count($requestPathArray);
|
||||||
$breadcrumbArray = array(array('name' => $wikiName, 'path' => '', 'active' => ($pathCount == 0)));
|
$breadcrumbArray = array(array('name' => $wikiName, 'path' => '', 'active' => ($pathCount == 0)));
|
||||||
|
|
||||||
@@ -183,11 +185,12 @@ class Main {
|
|||||||
$currentPath .= ($i == 0 ? '' : '/') . $pathPart;
|
$currentPath .= ($i == 0 ? '' : '/') . $pathPart;
|
||||||
$isLast = ($i == $pathCount - 1);
|
$isLast = ($i == $pathCount - 1);
|
||||||
|
|
||||||
if ($isLast || file_exists($articleBaseDir . $currentPath . '/index.md')) {
|
$hasContent = ($isLast || file_exists($articleBaseDir . $currentPath . '/index.md'));
|
||||||
|
if ($hasContent || $showCompleteBreadcrumbs) {
|
||||||
// This is the requested file or an directory having an index -> Add it
|
// This is the requested file or an directory having an index -> Add it
|
||||||
$breadcrumbArray[] = array(
|
$breadcrumbArray[] = array(
|
||||||
'name' => str_replace('_', ' ', $pathPart),
|
'name' => str_replace('_', ' ', $pathPart),
|
||||||
'path' => urlencode($currentPath),
|
'path' => $hasContent ? urlencode($currentPath) : null,
|
||||||
'active' => $isLast);
|
'active' => $isLast);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user