diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2015-09-21 10:01:07 +0200 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2015-09-21 10:01:15 +0200 |
commit | 8c45a3db50f91ca96f74af0709df9351b02704dc (patch) | |
tree | 8760e46c5c930d1743b6e2bfa7c96ae2619a0573 /server/sonar-web/src/main/js/apps/coding-rules | |
parent | 46445984cf50ef0dda050ea8d369c89936e97f9f (diff) | |
download | sonarqube-8c45a3db50f91ca96f74af0709df9351b02704dc.tar.gz sonarqube-8c45a3db50f91ca96f74af0709df9351b02704dc.zip |
SONAR-6207 Provide a keyboard shortcut to activate a rule from the list of rules
Diffstat (limited to 'server/sonar-web/src/main/js/apps/coding-rules')
3 files changed, 16 insertions, 7 deletions
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/controller.js b/server/sonar-web/src/main/js/apps/coding-rules/controller.js index dad6224391a..2049cb8bf0c 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/controller.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/controller.js @@ -140,15 +140,21 @@ export default Controller.extend({ }, activateCurrent: function () { - var rule = this.app.list.at(this.app.state.get('selectedIndex')); - var ruleView = this.app.workspaceListView.children.findByModel(rule); - ruleView.$('.coding-rules-detail-quality-profile-activate').click(); + if (this.app.layout.detailsShow()) { + this.app.workspaceDetailsView.$('#coding-rules-quality-profile-activate').click(); + } else { + var rule = this.app.list.at(this.app.state.get('selectedIndex')); + var ruleView = this.app.workspaceListView.children.findByModel(rule); + ruleView.$('.coding-rules-detail-quality-profile-activate').click(); + } }, deactivateCurrent: function () { - var rule = this.app.list.at(this.app.state.get('selectedIndex')); - var ruleView = this.app.workspaceListView.children.findByModel(rule); - ruleView.$('.coding-rules-detail-quality-profile-deactivate').click(); + if (!this.app.layout.detailsShow()) { + var rule = this.app.list.at(this.app.state.get('selectedIndex')); + var ruleView = this.app.workspaceListView.children.findByModel(rule); + ruleView.$('.coding-rules-detail-quality-profile-deactivate').click(); + } } }); diff --git a/server/sonar-web/src/main/js/apps/coding-rules/layout.js b/server/sonar-web/src/main/js/apps/coding-rules/layout.js index ac5e1b7e421..ee83c4d684d 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/layout.js +++ b/server/sonar-web/src/main/js/apps/coding-rules/layout.js @@ -31,6 +31,10 @@ export default Marionette.LayoutView.extend({ if (this.scroll != null) { $(window).scrollTop(this.scroll); } + }, + + detailsShow: function () { + return this.$('.search-navigator').is('.search-navigator-extended-view'); } }); diff --git a/server/sonar-web/src/main/js/apps/coding-rules/templates/rule/coding-rules-profile-activation.hbs b/server/sonar-web/src/main/js/apps/coding-rules/templates/rule/coding-rules-profile-activation.hbs index f41709fe397..0523824d2ed 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/templates/rule/coding-rules-profile-activation.hbs +++ b/server/sonar-web/src/main/js/apps/coding-rules/templates/rule/coding-rules-profile-activation.hbs @@ -25,7 +25,6 @@ {{else}} <select id="coding-rules-quality-profile-activation-select"> {{#each qualityProfiles}} - {{log ../contextProfile}} <option value="{{key}}" {{#eq key ../contextProfile}}selected{{/eq}}>{{name}}</option> {{/each}} </select> |