]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-6207 Provide a keyboard shortcut to activate a rule from the list of rules
authorStas Vilchik <vilchiks@gmail.com>
Mon, 21 Sep 2015 08:01:07 +0000 (10:01 +0200)
committerStas Vilchik <vilchiks@gmail.com>
Mon, 21 Sep 2015 08:01:15 +0000 (10:01 +0200)
server/sonar-web/src/main/js/apps/coding-rules/controller.js
server/sonar-web/src/main/js/apps/coding-rules/layout.js
server/sonar-web/src/main/js/apps/coding-rules/templates/rule/coding-rules-profile-activation.hbs

index dad6224391a67ee5d24fefe3fed42ce57e946702..2049cb8bf0c7832288a9a691ea4877172f08b315 100644 (file)
@@ -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();
+    }
   }
 
 });
index ac5e1b7e421aaad0e40fd85aec2667790772a9dd..ee83c4d684d66abfa47af2c83dedba84c0c26f9f 100644 (file)
@@ -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');
   }
 
 });
index f41709fe39752269f7b8b8a23e897eeab7e75246..0523824d2edf859a99fd5a91c3abd1a8793dd984 100644 (file)
@@ -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>