RC filters: Let the group widget know its own name
authorStephane Bisson <sbisson@wikimedia.org>
Thu, 9 Feb 2017 11:55:29 +0000 (06:55 -0500)
committerStephane Bisson <sbisson@wikimedia.org>
Thu, 9 Feb 2017 11:55:29 +0000 (06:55 -0500)
Bug: T156533
Bug: T156215
Change-Id: I21f9df4286208cbe1609b06174066863eb4da6fb

resources/src/mediawiki.rcfilters/dm/mw.rcfilters.dm.FilterGroup.js
resources/src/mediawiki.rcfilters/dm/mw.rcfilters.dm.FiltersViewModel.js

index bc911f4..da9e59e 100644 (file)
@@ -7,6 +7,7 @@
         *
         * @constructor
         * @param {Object} [config] Configuration options
+        * @cfg {string} [name] Group name
         * @cfg {string} [type='send_unselected_if_any'] Group type
         * @cfg {string} [title] Group title
         * @cfg {string} [separator='|'] Value separator for 'string_options' groups
@@ -20,6 +21,7 @@
                OO.EventEmitter.call( this );
                OO.EmitterList.call( this );
 
+               this.name = config.name;
                this.type = config.type || 'send_unselected_if_any';
                this.title = config.title;
                this.separator = config.separator || '|';
                return this.active;
        };
 
+       /**
+        * Get group name
+        *
+        * @return {string} Group name
+        */
+       mw.rcfilters.dm.FilterGroup.prototype.getName = function () {
+               return this.name;
+       };
+
        /**
         * Get group type
         *
index 3c4ed4b..5bbeabf 100644 (file)
                $.each( filters, function ( group, data ) {
                        if ( !model.groups[ group ] ) {
                                model.groups[ group ] = new mw.rcfilters.dm.FilterGroup( {
+                                       name: group,
                                        type: data.type,
                                        title: data.title,
                                        separator: data.separator,