Merge "RCFilters UI: Add a 'what's this?' link to filter groups"
[lhc/web/wiklou.git] / resources / src / mediawiki.rcfilters / dm / mw.rcfilters.dm.FilterGroup.js
index 1070b98..3ec544c 100644 (file)
         * @cfg {boolean} [active] Group is active
         * @cfg {boolean} [fullCoverage] This filters in this group collectively cover all results
         * @cfg {Object} [conflicts] Defines the conflicts for this filter group
+        * @cfg {Object} [whatsThis] Defines the messages that should appear for the 'what's this' popup
+        * @cfg {string} [whatsThis.header] The header of the whatsThis popup message
+        * @cfg {string} [whatsThis.body] The body of the whatsThis popup message
+        * @cfg {string} [whatsThis.url] The url for the link in the whatsThis popup message
+        * @cfg {string} [whatsThis.linkMessage] The text for the link in the whatsThis popup message
         */
        mw.rcfilters.dm.FilterGroup = function MwRcfiltersDmFilterGroup( name, config ) {
                config = config || {};
@@ -30,6 +35,8 @@
                this.active = !!config.active;
                this.fullCoverage = !!config.fullCoverage;
 
+               this.whatsThis = config.whatsThis || {};
+
                this.conflicts = config.conflicts || {};
 
                this.aggregate( { update: 'filterItemUpdate' } );
                return this.name;
        };
 
+       /**
+        * Get the messags defining the 'whats this' popup for this group
+        *
+        * @return {Object} What's this messages
+        */
+       mw.rcfilters.dm.FilterGroup.prototype.getWhatsThis = function () {
+               return this.whatsThis;
+       };
+
+       /**
+        * Check whether this group has a 'what's this' message
+        *
+        * @return {boolean} This group has a what's this message
+        */
+       mw.rcfilters.dm.FilterGroup.prototype.hasWhatsThis = function () {
+               return !!this.whatsThis.body;
+       };
+
        /**
         * Get the conflicts associated with the entire group.
         * Conflict object is set up by filter name keys and conflict