Make sidebar toggle elements configurable
Current options are h1, h1 and h2, h1-h5, top-level list items SPR-754
This commit is contained in:
parent
26a5535e70
commit
cb7cc643bf
7 changed files with 31 additions and 30 deletions
|
@ -4,13 +4,5 @@
|
|||
*
|
||||
*/
|
||||
|
||||
$conf['logo'] = 'wiki:logo.png';
|
||||
$conf['mobile_logo'] = 'images/fav/favicon-32x32.png';
|
||||
$conf['sidebar_sections'] = 'h1,h2,h3,h4,h5';
|
||||
|
||||
$conf['logo_spacer'] = 'logo_spacer.png';
|
||||
|
||||
$conf['discussionPage'] = 'discussion:@ID@';
|
||||
$conf['userPage'] = 'user:@USER@:';
|
||||
$conf['user_ns'] = 'user';
|
||||
$conf['hideTools'] = 0;
|
||||
$conf['tasks_page'] = 'dashboard';
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
<?php
|
||||
/*
|
||||
* configuration metadata
|
||||
*
|
||||
*/
|
||||
|
||||
$meta['logo'] = array('string');
|
||||
$conf['logo_spacer'] = array('string');
|
||||
|
||||
$meta['discussionPage'] = array('string');
|
||||
$meta['userPage'] = array('string');
|
||||
$conf['user_ns'] = array('string');
|
||||
$meta['hideTools'] = array('onoff');
|
||||
$meta['tasks_page'] = array('string');
|
||||
$meta['sidebar_sections'] = array(
|
||||
'multichoice',
|
||||
'_choices' => array(
|
||||
'h1',
|
||||
'h1,h2',
|
||||
'h1,h2,h3,h4,h5',
|
||||
'li.level1 > .li',
|
||||
),
|
||||
);
|
||||
|
|
|
@ -31,6 +31,11 @@
|
|||
> div {
|
||||
color: @ini_text_webframe;
|
||||
}
|
||||
|
||||
&.toggler {
|
||||
list-style: none;
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ jQuery(function () {
|
|||
var $main = $nav.find('nav.nav-main');
|
||||
if (!$main.length) return;
|
||||
|
||||
var ELEMENT = 'h1,h2,h3,h4,h5'; // FIXME move to config
|
||||
var ELEMENT = JSINFO.template.sprintdoc.sidebar_toggle_elements;
|
||||
var $elements = $main.find(ELEMENT);
|
||||
$elements.each(function () {
|
||||
var $me = jQuery(this),
|
||||
|
@ -98,6 +98,10 @@ jQuery(function () {
|
|||
|
||||
// replace element with toggler
|
||||
$me.replaceWith($toggler);
|
||||
|
||||
if ($toggler.parent('li').length) {
|
||||
$toggler.parent('li').addClass('toggler');
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
@ -4,7 +4,3 @@
|
|||
*
|
||||
*/
|
||||
|
||||
$lang['discussionPage'] = 'Diskussion-Seite (leer lassen, um Funktion zu deaktivieren)';
|
||||
$lang['userPage'] = 'Benutzer seite (leer lassen, um Funktion zu deaktivieren)';
|
||||
$lang['hideTools'] = 'Tools abschalten, wenn der Benutzer nicht angemeldet ist?';
|
||||
$lang['user_ns'] = 'Ort an dem Nutzerseiten gespeichert werden';
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
$lang['discussionPage'] = 'Discussion page (leave empty to disable discussions)';
|
||||
$lang['userPage'] = 'User page (leave empty to disable user pages)';
|
||||
$lang['hideTools'] = 'Hide tools when not logged in?';
|
||||
$lang['user_ns'] = 'Where to store user pages.';
|
||||
$lang['sidebar_sections'] = 'Auto-toggle the sidebar into sections on these elements:';
|
||||
$lang['sidebar_sections_o_h1'] = '1st order headings';
|
||||
$lang['sidebar_sections_o_h1,h2'] = '1st and 2nd order headings';
|
||||
$lang['sidebar_sections_o_h1,h2,h3,h4,h5'] = 'All headings';
|
||||
$lang['sidebar_sections_o_li.level1 > .li'] = 'Top-level list items';
|
||||
|
|
6
main.php
6
main.php
|
@ -14,6 +14,12 @@ use dokuwiki\template\sprintdoc\Template;
|
|||
if (!defined('DOKU_INC')) die(); /* must be run from within DokuWiki */
|
||||
header('X-UA-Compatible: IE=edge,chrome=1');
|
||||
|
||||
global $JSINFO;
|
||||
if (empty($JSINFO['template'])) {
|
||||
$JSINFO['template'] = array();
|
||||
}
|
||||
$JSINFO['template']['sprintdoc'] = array('sidebar_toggle_elements' => tpl_getConf('sidebar_sections'));
|
||||
|
||||
$showTools = !tpl_getConf('hideTools') || ( tpl_getConf('hideTools') && !empty($_SERVER['REMOTE_USER']) );
|
||||
$showSidebar = true; /* */
|
||||
?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue