diff options
Diffstat (limited to 'server/sonar-web/src/main/js/coding-rules/facets')
-rw-r--r-- | server/sonar-web/src/main/js/coding-rules/facets/quality-profile-facet.js | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/server/sonar-web/src/main/js/coding-rules/facets/quality-profile-facet.js b/server/sonar-web/src/main/js/coding-rules/facets/quality-profile-facet.js index 1e90e2bacca..aa4e510eaf6 100644 --- a/server/sonar-web/src/main/js/coding-rules/facets/quality-profile-facet.js +++ b/server/sonar-web/src/main/js/coding-rules/facets/quality-profile-facet.js @@ -1,10 +1,19 @@ define([ - 'coding-rules/facets/base-facet' -], function (BaseFacet) { + 'coding-rules/facets/base-facet', + 'templates/coding-rules' +], function (BaseFacet, Templates) { var $ = jQuery; return BaseFacet.extend({ + template: Templates['coding-rules-quality-profile-facet'], + + events: function () { + return _.extend(BaseFacet.prototype.events.apply(this, arguments), { + 'click .js-active': 'setActivation', + 'click .js-inactive': 'unsetActivation' + }); + }, getValues: function () { var that = this, @@ -31,9 +40,25 @@ define([ this.options.app.state.updateFilter(obj); }, + setActivation: function (e) { + e.stopPropagation(); + this.options.app.state.updateFilter({ activation: 'true' }); + }, + + unsetActivation: function (e) { + e.stopPropagation(); + this.options.app.state.updateFilter({ activation: 'false' }); + }, + + getToggled: function () { + var activation = this.options.app.state.get('query').activation; + return activation === 'true' || activation === true; + }, + serializeData: function () { return _.extend(BaseFacet.prototype.serializeData.apply(this, arguments), { - values: this.getValues() + values: this.getValues(), + toggled: this.getToggled() }); } }); |