Merge "Use HTML::hidden to create input fields"
[lhc/web/wiklou.git] / resources / src / mediawiki.rcfilters / ui / mw.rcfilters.ui.FilterMenuHeaderWidget.js
index 0138884..eeb5ddc 100644 (file)
@@ -2,6 +2,7 @@
        /**
         * Menu header for the RCFilters filters menu
         *
+        * @class
         * @extends OO.ui.Widget
         *
         * @constructor
@@ -29,7 +30,7 @@
                this.backButton = new OO.ui.ButtonWidget( {
                        icon: 'previous',
                        framed: false,
-                       title: mw.msg( 'rcfilters-filterlist-title' ),
+                       title: mw.msg( 'rcfilters-view-return-to-default-tooltip' ),
                        classes: [ 'mw-rcfilters-ui-filterMenuHeaderWidget-backButton' ]
                } );
                this.backButton.toggle( this.model.getCurrentView() !== 'default' );
                // Invert namespaces button
                this.invertNamespacesButton = new OO.ui.ToggleButtonWidget( {
                        icon: '',
-                       label: mw.msg( 'invert' ),
                        classes: [ 'mw-rcfilters-ui-filterMenuHeaderWidget-invertNamespacesButton' ]
                } );
                this.invertNamespacesButton.toggle( this.model.getCurrentView() === 'namespaces' );
+               this.updateInvertButton( this.model.areNamespacesInverted() );
 
                // Events
                this.backButton.connect( this, { click: 'onBackButtonClick' } );
         * @param {boolean} isInverted Namespaces selection is inverted
         */
        mw.rcfilters.ui.FilterMenuHeaderWidget.prototype.onModelInvertChange = function ( isInverted ) {
+               this.updateInvertButton( isInverted );
+       };
+
+       /**
+        * Update the state of the invert button
+        *
+        * @param {boolean} isInverted Namespaces selection is inverted
+        */
+       mw.rcfilters.ui.FilterMenuHeaderWidget.prototype.updateInvertButton = function ( isInverted ) {
                this.invertNamespacesButton.setActive( isInverted );
+               this.invertNamespacesButton.setLabel(
+                       isInverted ?
+                               mw.msg( 'rcfilters-exclude-button-on' ) :
+                               mw.msg( 'rcfilters-exclude-button-off' )
+               );
        };
 
        mw.rcfilters.ui.FilterMenuHeaderWidget.prototype.onBackButtonClick = function () {