RCFilters: Preserve collapsed state and adjust display
[lhc/web/wiklou.git] / resources / src / mediawiki.rcfilters / mw.rcfilters.Controller.js
index cd3f684..3e900f0 100644 (file)
@@ -15,6 +15,8 @@
         * @cfg {string} savedQueriesPreferenceName Where to save the saved queries
         * @cfg {string} daysPreferenceName Preference name for the days filter
         * @cfg {string} limitPreferenceName Preference name for the limit filter
+        * @cfg {string} collapsedPreferenceName Preference name for collapsing and showing
+        *  the active filters area
         * @cfg {boolean} [normalizeTarget] Dictates whether or not to go through the
         *  title normalization to separate title subpage/parts into the target= url
         *  parameter
@@ -26,6 +28,7 @@
                this.savedQueriesPreferenceName = config.savedQueriesPreferenceName;
                this.daysPreferenceName = config.daysPreferenceName;
                this.limitPreferenceName = config.limitPreferenceName;
+               this.collapsedPreferenceName = config.collapsedPreferenceName;
                this.normalizeTarget = !!config.normalizeTarget;
 
                this.requestCounter = {};
                this.updateNumericPreference( 'usenewrc', Number( newValue ) );
        };
 
+       /**
+        * Update the collapsed state value
+        *
+        * @param {boolean} isCollapsed Filter area is collapsed
+        */
+       mw.rcfilters.Controller.prototype.updateCollapsedState = function ( isCollapsed ) {
+               this.updateNumericPreference( this.collapsedPreferenceName, Number( isCollapsed ) );
+       };
+
        /**
         * Update a numeric preference with a new value
         *