RCFilters UI: Add 'highlight' icon to highlight button
[lhc/web/wiklou.git] / resources / src / mediawiki.rcfilters / ui / mw.rcfilters.ui.FilterItemWidget.js
index 63db2b0..81b856d 100644 (file)
@@ -21,6 +21,7 @@
 
                this.controller = controller;
                this.model = model;
+               this.selected = false;
 
                this.checkboxWidget = new mw.rcfilters.ui.CheckboxInputWidget( {
                        value: this.model.getName(),
@@ -93,7 +94,7 @@
         * @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() &&