SPR-972 add more info to the breadcrumb
* add the current admin plugin to the breadcrumb * use proper translations for the various modes * do no longer rely on JavaScript for the enhanced breadcrumb * add image name in breadcrumb for detail view
This commit is contained in:
parent
52ef6e091d
commit
84f9464195
5 changed files with 56 additions and 37 deletions
46
Template.php
46
Template.php
|
@ -205,4 +205,50 @@ class Template {
|
||||||
echo $mobile;
|
echo $mobile;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the current mode information to the hierarchical breadcrumbs
|
||||||
|
*/
|
||||||
|
public function breadcrumbSuffix() {
|
||||||
|
global $ACT;
|
||||||
|
global $lang;
|
||||||
|
global $INPUT;
|
||||||
|
global $ID;
|
||||||
|
global $conf;
|
||||||
|
global $IMG;
|
||||||
|
if($ACT == 'show') return;
|
||||||
|
|
||||||
|
// find an apropriate label for the current mode
|
||||||
|
if($ACT) {
|
||||||
|
$label = tpl_getLang('mode_' . $ACT);
|
||||||
|
if(!$label) {
|
||||||
|
if(isset($lang['btn_' . $ACT])) {
|
||||||
|
$label = $lang['btn_' . $ACT];
|
||||||
|
} else {
|
||||||
|
$label = $ACT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// actually we would need to create a proper namespace breadcrumb path here,
|
||||||
|
// but this is the most simplest thing we can do for now
|
||||||
|
if(defined('DOKU_MEDIADETAIL')) {
|
||||||
|
$label = hsc(noNS($IMG));
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($ACT == 'admin' && $INPUT->has('page')) {
|
||||||
|
$link = wl($ID, array('do' => 'admin'));
|
||||||
|
echo '<bdi> : <a href="' . $link . '"><strong>' . $label . '</strong></a></bdi>';
|
||||||
|
|
||||||
|
/** @var \DokuWiki_Admin_Plugin $plugin */
|
||||||
|
$plugin = plugin_load('admin', $INPUT->str('page'));
|
||||||
|
if(!$plugin) return;
|
||||||
|
|
||||||
|
$label = $plugin->getMenuText($conf['lang']);
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '<bdi><span class="curid"> : <strong>' . $label . '</strong></span></bdi>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
/**
|
|
||||||
* Sets up the breadcrumb behaviour (adds do / ACT status information)
|
|
||||||
* or adds tpl_getLang('image_detail') on detail template
|
|
||||||
*/
|
|
||||||
(function($) {
|
|
||||||
|
|
||||||
|
|
||||||
var setBreadcrumbSuffix = function(){
|
|
||||||
|
|
||||||
var $breadcrumb = $('.breadcrumbs');
|
|
||||||
if (!$breadcrumb.length) return;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* add ACT status to breadcrumb (if not show)
|
|
||||||
* or tpl_getLang('image_detail') on detail.php
|
|
||||||
*/
|
|
||||||
var mode = $breadcrumb.attr('data-do');
|
|
||||||
if(mode && mode.indexOf('show') !== 0){
|
|
||||||
var markup = '<bdi lang="en"><span class="curid"> : <strong>' + mode + '</strong></span></bdi>';
|
|
||||||
$breadcrumb.find('p').append(markup);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
$(function(){
|
|
||||||
setBreadcrumbSuffix();
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
})(jQuery);
|
|
|
@ -51,7 +51,8 @@ $lang['osm_zoom_link_text'] = 'view larger map';
|
||||||
$lang['osm_zoom_link_title'] = 'external link opens new window';
|
$lang['osm_zoom_link_title'] = 'external link opens new window';
|
||||||
$lang['image_detail'] = 'image details';
|
$lang['image_detail'] = 'image details';
|
||||||
|
|
||||||
|
$lang['mode_edit'] = 'Editing Page';
|
||||||
|
$lang['mode_detail'] = 'Image Details';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* colors
|
* colors
|
||||||
|
|
|
@ -8,4 +8,3 @@
|
||||||
|
|
||||||
/* DOKUWIKI:include js/meta-box.js */
|
/* DOKUWIKI:include js/meta-box.js */
|
||||||
/* DOKUWIKI:include js/sidebar.js */
|
/* DOKUWIKI:include js/sidebar.js */
|
||||||
/* DOKUWIKI:include js/breadcrumb.js */
|
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
<?php
|
<?php
|
||||||
if (!defined('DOKU_INC')) die();
|
if(!defined('DOKU_INC')) die();
|
||||||
|
|
||||||
if ($conf['breadcrumbs']): ?>
|
if($conf['breadcrumbs']): ?>
|
||||||
|
|
||||||
|
|
||||||
<h6 class="sr-only" role="heading" aria-level="2"><?php echo tpl_getLang('head_breadcrumb') ?></h6>
|
<h6 class="sr-only" role="heading" aria-level="2"><?php echo tpl_getLang('head_breadcrumb') ?></h6>
|
||||||
<p><?php tpl_youarehere() ?></p>
|
<p><?php
|
||||||
|
tpl_youarehere();
|
||||||
|
\dokuwiki\template\sprintdoc\Template::getInstance()->breadcrumbSuffix();
|
||||||
|
?></p>
|
||||||
|
|
||||||
|
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue