mirror of
https://github.com/til-schneider/slim-wiki.git
synced 2025-08-04 07:37:28 +02:00
Showing directories having no 'index.md' in breadcrumbs (configurable)
This commit is contained in:
@@ -36,6 +36,7 @@ body {
|
||||
|
||||
.breadcrumbs {
|
||||
background-color: white;
|
||||
cursor: default;
|
||||
|
||||
.main-column {
|
||||
padding: 15px 0;
|
||||
|
@@ -7,4 +7,7 @@ if (function_exists('date_default_timezone_set')) {
|
||||
$config['wikiName'] = 'Slim Wiki';
|
||||
$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';
|
||||
|
@@ -110,7 +110,7 @@ if ($mode == 'edit') {
|
||||
if (! $isFirst) {
|
||||
echo ' / ';
|
||||
}
|
||||
if ($item['active']) {
|
||||
if ($item['active'] || is_null($item['path'])) {
|
||||
echo $item['name'];
|
||||
} else {
|
||||
?><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(
|
||||
'wikiName' => 'Slim Wiki',
|
||||
'timezone' => 'Europe/Berlin',
|
||||
'lang' => 'en'
|
||||
'lang' => 'en',
|
||||
'showCompleteBreadcrumbs' => true
|
||||
);
|
||||
|
||||
if (file_exists(__DIR__ . '/../../config.php')) {
|
||||
|
@@ -172,7 +172,9 @@ class Main {
|
||||
}
|
||||
|
||||
private function createBreadcrumbs($requestPathArray) {
|
||||
$wikiName = $this->context->getConfig()['wikiName'];
|
||||
$config = $this->context->getConfig();
|
||||
$wikiName = $config['wikiName'];
|
||||
$showCompleteBreadcrumbs = $config['showCompleteBreadcrumbs'];
|
||||
$pathCount = count($requestPathArray);
|
||||
$breadcrumbArray = array(array('name' => $wikiName, 'path' => '', 'active' => ($pathCount == 0)));
|
||||
|
||||
@@ -183,11 +185,12 @@ class Main {
|
||||
$currentPath .= ($i == 0 ? '' : '/') . $pathPart;
|
||||
$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
|
||||
$breadcrumbArray[] = array(
|
||||
'name' => str_replace('_', ' ', $pathPart),
|
||||
'path' => urlencode($currentPath),
|
||||
'path' => $hasContent ? urlencode($currentPath) : null,
|
||||
'active' => $isLast);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user