' )
- .addClass( 'mw-rcfilters-ui-cell mw-rcfilters-ui-filterMenuOptionWidget-filterCheckbox' )
- .append( layout.$element ),
- $( '
' )
- .addClass( 'mw-rcfilters-ui-cell mw-rcfilters-ui-filterMenuOptionWidget-highlightButton' )
- .append( this.highlightButton.$element )
- )
- )
- );
+ .addClass( 'mw-rcfilters-ui-filterMenuOptionWidget' );
};
/* Initialization */
-
- OO.inheritClass( mw.rcfilters.ui.FilterMenuOptionWidget, OO.ui.MenuOptionWidget );
+ OO.inheritClass( mw.rcfilters.ui.FilterMenuOptionWidget, mw.rcfilters.ui.ItemMenuOptionWidget );
/* Static properties */
@@ -101,10 +36,11 @@
/* Methods */
/**
- * Respond to item model update event
+ * @inheritdoc
*/
mw.rcfilters.ui.FilterMenuOptionWidget.prototype.onModelUpdate = function () {
- this.checkboxWidget.setSelected( this.model.isSelected() );
+ // Parent
+ mw.rcfilters.ui.FilterMenuOptionWidget.parent.prototype.onModelUpdate.call( this );
this.setCurrentMuteState();
};
@@ -117,36 +53,32 @@
};
/**
- * Set the current mute state for this item
+ * Set the current muted view of the widget based on its state
*/
mw.rcfilters.ui.FilterMenuOptionWidget.prototype.setCurrentMuteState = function () {
- this.$element.toggleClass(
- 'mw-rcfilters-ui-filterMenuOptionWidget-muted',
- this.model.isConflicted() ||
- (
- // Item is also muted when any of the items in its group is active
- this.model.getGroupModel().isActive() &&
- // But it isn't selected
- !this.model.isSelected() &&
- // And also not included
- !this.model.isIncluded()
- )
- );
-
- this.highlightButton.toggle( this.model.isHighlightEnabled() );
- };
-
- /**
- * Get the name of this filter
- *
- * @return {string} Filter name
- */
- mw.rcfilters.ui.FilterMenuOptionWidget.prototype.getName = function () {
- return this.model.getName();
- };
-
- mw.rcfilters.ui.FilterMenuOptionWidget.prototype.getModel = function () {
- return this.model;
+ if (
+ this.model.getGroupModel().getView() === 'namespaces' &&
+ this.model.isInverted()
+ ) {
+ // This is an inverted behavior than the other rules, specifically
+ // for inverted namespaces
+ this.setFlags( {
+ muted: this.model.isSelected()
+ } );
+ } else {
+ this.setFlags( {
+ muted: (
+ this.model.isConflicted() ||
+ (
+ // Item is also muted when any of the items in its group is active
+ this.model.getGroupModel().isActive() &&
+ // But it isn't selected
+ !this.model.isSelected() &&
+ // And also not included
+ !this.model.isIncluded()
+ )
+ )
+ } );
+ }
};
-
}( mediaWiki ) );