aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2015-09-15 12:15:52 +0200
committerStas Vilchik <vilchiks@gmail.com>2015-09-15 12:15:52 +0200
commit1d777d3f5298c7e71f6a6a6da106698029c49bd6 (patch)
tree88b45fc208e561e6de5f5065660727977a383ded
parente72ebb2c71eb46abda41ec2203185ce934c0d1bf (diff)
downloadsonarqube-1d777d3f5298c7e71f6a6a6da106698029c49bd6.tar.gz
sonarqube-1d777d3f5298c7e71f6a6a6da106698029c49bd6.zip
SONAR-6207 Provide a keyboard shortcut to activate a rule from the list of rules
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/controller.js12
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/workspace-list-view.js8
-rw-r--r--server/sonar-web/src/main/js/apps/nav/templates/nav-shortcuts-help.hbs2
-rw-r--r--sonar-core/src/main/resources/org/sonar/l10n/core.properties2
4 files changed, 24 insertions, 0 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 5ee32475e99..f36d9bd33c9 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
@@ -156,6 +156,18 @@ define([
if (firstPage) {
this.app.workspaceListView.scrollTo();
}
+ },
+
+ 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();
+ },
+
+ 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();
}
});
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-view.js b/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-view.js
index e77a504fa7f..e100c02cf67 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-view.js
@@ -37,6 +37,14 @@ define([
that.options.app.controller.showDetailsForSelected();
return false;
});
+ key('a', function () {
+ that.options.app.controller.activateCurrent();
+ return false;
+ });
+ key('d', function () {
+ that.options.app.controller.deactivateCurrent();
+ return false;
+ });
}
});
diff --git a/server/sonar-web/src/main/js/apps/nav/templates/nav-shortcuts-help.hbs b/server/sonar-web/src/main/js/apps/nav/templates/nav-shortcuts-help.hbs
index 5230e7f5912..f49ed110e0e 100644
--- a/server/sonar-web/src/main/js/apps/nav/templates/nav-shortcuts-help.hbs
+++ b/server/sonar-web/src/main/js/apps/nav/templates/nav-shortcuts-help.hbs
@@ -29,6 +29,8 @@
class="shortcut-button">&darr;</span> &nbsp;&nbsp; {{t 'shortcuts.section.rules.navigate_between_rules'}}</li>
<li><span class="shortcut-button">&rarr;</span> &nbsp;&nbsp; {{t 'shortcuts.section.rules.open_details'}}</li>
<li><span class="shortcut-button">&larr;</span> &nbsp;&nbsp; {{t 'shortcuts.section.rules.return_to_list'}}</li>
+ <li><span class="shortcut-button">a</span> &nbsp;&nbsp; {{t 'shortcuts.section.rules.activate'}}</li>
+ <li><span class="shortcut-button">d</span> &nbsp;&nbsp; {{t 'shortcuts.section.rules.deactivate'}}</li>
</ul>
</div>
diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
index 5fb13b140bc..d5e4292365b 100644
--- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties
+++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
@@ -1097,6 +1097,8 @@ shortcuts.section.rules=Rules Page
shortcuts.section.rules.navigate_between_rules=navigate between rules
shortcuts.section.rules.open_details=go from the list of rules to the rule details
shortcuts.section.rules.return_to_list=return back to the list
+shortcuts.section.rules.activate=activate selected rule
+shortcuts.section.rules.deactivate=deactivate selected rule
#------------------------------------------------------------------------------