Permalink
Browse files

feat: optionally remember state only for whole wiki

If the plugin is integrated into the wiki's template and not used as
syntax on individual pages, then it makes sense to store the
expanded/collapsed state cross-page.

APL-76
  • Loading branch information...
micgro42 committed Nov 27, 2017
1 parent 359fe4b commit b30fe0517d9f4338131c5621480ffde41e1d2e45
Showing with 14 additions and 3 deletions.
  1. +1 −0 action/js.php
  2. +1 −0 conf/default.php
  3. +1 −1 conf/metadata.php
  4. +3 −0 lang/de/settings.php
  5. +3 −0 lang/en/settings.php
  6. +5 −2 script.js
View
@@ -42,6 +42,7 @@ public function handle_dokuwiki_started(Doku_Event &$event, $param) {
$this->jsinfo('dirOpenedIcon', $filelisting->dirOpenedIcon());
$this->jsinfo('dirClosedIcon', $filelisting->dirClosedIcon());
$this->jsinfo('loadingIcon', $filelisting->loadingIcon());
$this->jsinfo('remember_state_per_page', $this->getConf('remember_state_per_page') === 'page');
}
/**
View
@@ -6,3 +6,4 @@
*/
$conf['defaulttoggle'] = '1';
$conf['remember_state_per_page'] = 'page';
View
@@ -7,4 +7,4 @@
$meta['defaulttoggle'] = array('onoff');
$meta['remember_state_per_page'] = array('multichoice','_choices' => array('page','wiki'));
View
@@ -6,6 +6,9 @@
*/
$lang['defaulttoggle'] = 'Zeige Dateiauflistung standardmäßig an';
$lang['remember_state_per_page'] = 'Wie wird der Zustand der Dateiauflistung gespeichert?';
$lang['remember_state_per_page_o_page'] = 'seitenweise (sinnvoll wenn die Syntax des Plugins genutzt wird)';
$lang['remember_state_per_page_o_wiki'] = 'seitenübergreifend (sinnvoll wenn das Plugin Teil des Wikitemplates ist)';
View
@@ -6,6 +6,9 @@
*/
$lang['defaulttoggle'] = 'Expanded listings by default';
$lang['remember_state_per_page'] = 'How to remember the state of the listing';
$lang['remember_state_per_page_o_page'] = 'per page (makes sense if plugin is used as syntax)';
$lang['remember_state_per_page_o_wiki'] = 'cross-page (makes sense if plugin is used as part of the wiki template)';
View
@@ -13,7 +13,10 @@
this.options = $.extend({}, $.fn.dokuwiki_plugin_filelisting.defaults, options);
this.storageKey = 'plugin_filelisting/' + this.options.pageId;
this.storageKey = 'plugin_filelisting';
if (this.options.remember_state_per_page) {
this.storageKey += '/' + this.options.pageId;
}
this.initToggleButton();
this.initAjaxDirectoryExpand();
@@ -388,7 +391,7 @@ jQuery(function() {
} else {
options.defaultToggle = 'hidden';
}
options.remember_state_per_page = JSINFO.plugin.filelisting.remember_state_per_page;
options.dirOpenedIcon = JSINFO.plugin.filelisting.dirOpenedIcon;
options.dirClosedIcon = JSINFO.plugin.filelisting.dirClosedIcon;
options.loadingIcon = JSINFO.plugin.filelisting.loadingIcon;

0 comments on commit b30fe05

Please sign in to comment.