diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2015-01-05 13:37:35 +0100 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2015-01-05 13:37:43 +0100 |
commit | 83dc6f4034f380c3286b84d0e221660be9acab75 (patch) | |
tree | 08fbb1fc2745c73121918d73951d137a50a06109 /server/sonar-web/src/main/js/coding-rules/facets | |
parent | 560c800de8b9653441ac1802b6047d7d49d03621 (diff) | |
download | sonarqube-83dc6f4034f380c3286b84d0e221660be9acab75.tar.gz sonarqube-83dc6f4034f380c3286b84d0e221660be9acab75.zip |
SONAR-5820 Ability to filter rules that are inactive in a quality profile
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() }); } }); |