diff --git a/Template.php b/Template.php index 454c237..14878a3 100644 --- a/Template.php +++ b/Template.php @@ -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 * diff --git a/conf/default.php b/conf/default.php index 1ca4c37..0617fd4 100755 --- a/conf/default.php +++ b/conf/default.php @@ -6,3 +6,4 @@ $conf['sidebar_sections'] = 'h1,h2,h3,h4,h5'; $conf['header_layout'] = 'header-default'; +$conf['autocollapse'] = 1; diff --git a/conf/metadata.php b/conf/metadata.php index 6214fd8..ed77775 100755 --- a/conf/metadata.php +++ b/conf/metadata.php @@ -17,3 +17,5 @@ $meta['header_layout'] = array( 'header-compact', ), ); + +$meta['autocollapse'] = array('onoff'); diff --git a/lang/de/settings.php b/lang/de/settings.php index c7708ef..5bbe996 100755 --- a/lang/de/settings.php +++ b/lang/de/settings.php @@ -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.'; diff --git a/lang/en/settings.php b/lang/en/settings.php index b37442c..6b09179 100755 --- a/lang/en/settings.php +++ b/lang/en/settings.php @@ -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.'; diff --git a/main.php b/main.php index b5dd694..10980a5 100755 --- a/main.php +++ b/main.php @@ -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(); ?>