this.controller = controller;
this.model = model;
+ this.selected = false;
this.checkboxWidget = new mw.rcfilters.ui.CheckboxInputWidget( {
value: this.model.getName(),
* @param {boolean} isSelected The checkbox is selected
*/
mw.rcfilters.ui.FilterItemWidget.prototype.onCheckboxChange = function ( isSelected ) {
- this.controller.updateFilter( this.model.getName(), isSelected );
+ this.controller.toggleFilterSelect( this.model.getName(), isSelected );
};
/**
this.setCurrentMuteState();
};
+ /**
+ * Set selected state on this widget
+ *
+ * @param {boolean} [isSelected] Widget is selected
+ */
+ mw.rcfilters.ui.FilterItemWidget.prototype.toggleSelected = function ( isSelected ) {
+ isSelected = isSelected !== undefined ? isSelected : !this.selected;
+
+ if ( this.selected !== isSelected ) {
+ this.selected = isSelected;
+
+ this.$element.toggleClass( 'mw-rcfilters-ui-filterItemWidget-selected', this.selected );
+ }
+ };
+
/**
* Set the current mute state for this item
*/
'mw-rcfilters-ui-filterItemWidget-muted',
this.model.isConflicted() ||
this.model.isIncluded() ||
- this.model.isFullyCovered() ||
(
// Item is also muted when any of the items in its group is active
this.model.getGroupModel().isActive() &&