added option to disable the autocollapsing of the sidebar

This commit is contained in:
Andreas Gohr 2021-07-06 12:27:06 +02:00
commit 3e1e2a1f18
6 changed files with 22 additions and 1 deletions

View file

@ -148,6 +148,21 @@ class Template {
return $header . $nav;
}
/**
* Default class defining is the sidebar should collapse
*
* @return string
*/
public function fullWidthClass() {
global $ACT;
// no auto collapsing? empty class
if (!tpl_getConf('autocollapse')) return '';
// mode show? empty class
if ($ACT === "show") return '';
// anything else? wide content
return 'wide-content ';
}
/**
* Get all the tabs to display
*

View file

@ -6,3 +6,4 @@
$conf['sidebar_sections'] = 'h1,h2,h3,h4,h5';
$conf['header_layout'] = 'header-default';
$conf['autocollapse'] = 1;

View file

@ -17,3 +17,5 @@ $meta['header_layout'] = array(
'header-compact',
),
);
$meta['autocollapse'] = array('onoff');

View file

@ -14,3 +14,5 @@ $lang['sidebar_sections_o_li.level1 > .li'] = 'Top-level Listeneinträge in ve
$lang['header_layout'] = 'Layout des Headers anpassen:';
$lang['header_layout_o_default'] = 'großer Header für langen Wiki Titel und Tagline';
$lang['header_layout_o_compact'] = 'kompakter Header für kurzen Wiki Titel ohne Tagline';
$lang['autocollapse'] = 'Sidebar automatisch einklappen wenn Nicht-Inhaltsseiten angezigt werden, um mehr Platz zu haben.';

View file

@ -15,3 +15,4 @@ $lang['header_layout'] = 'Adjust header layout:';
$lang['header_layout_o_default'] = 'generous header layout for long wiki titel and tagline';
$lang['header_layout_o_compact'] = 'compact header layout for short wiki title and hidden tagline';
$lang['autocollapse'] = 'Automatically collapse the sidebar when viewing non-content pages for more screen estate.';

View file

@ -68,7 +68,7 @@ $showSidebar = true;
/* #dokuwiki__top used as anchor for "back to top" button/link links */
$classWideContent = ($ACT === "show") ? "": "wide-content ";
$classWideContent = (Template::getInstance())->fullWidthClass();
?>
<body id="dokuwiki__top" class="<?php echo ($ACT) ? 'do-'.$ACT : 'do-none'; ?> <?php echo $classWideContent; ?><?php echo ($showSidebar) ? 'showSidebar' : ''; ?> <?php echo tpl_getConf('header_layout'); ?>">