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' } );
mw.rcfilters.ui.FilterMenuHeaderWidget.prototype.onModelUpdate = function () {
var currentView = this.model.getCurrentView();
- this.setLabel( this.model.getCurrentViewLabel() );
+ this.setLabel( this.model.getViewTitle( currentView ) );
this.invertNamespacesButton.toggle( currentView === 'namespaces' );
this.backButton.toggle( currentView !== 'default' );
* @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 () {