Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Schatz <jschatz1@gmail.com>2017-03-26 17:24:33 +0300
committerJacob Schatz <jschatz1@gmail.com>2017-04-07 01:12:41 +0300
commit71eae2089e702d5c4ef6b0453850c4de1709d448 (patch)
tree178f47a250f234353436315fd6b8ffd94141faa3 /app/assets/javascripts/shortcuts.js
parent5fbb9e95449fd521447aa802269962c5a972467f (diff)
Add keyboard shortcuts to main menu.
1. Show shortcuts for easy navigation.
Diffstat (limited to 'app/assets/javascripts/shortcuts.js')
-rw-r--r--app/assets/javascripts/shortcuts.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/app/assets/javascripts/shortcuts.js b/app/assets/javascripts/shortcuts.js
index fd5097696ad..b7d3438a83c 100644
--- a/app/assets/javascripts/shortcuts.js
+++ b/app/assets/javascripts/shortcuts.js
@@ -19,6 +19,45 @@
return _this.focusFilter(e);
};
})(this));
+ function gotoMenu(menu){
+ if($('.global-dropdown.open').length) {
+ window.location.href = $('.global-dropdown-menu .dashboard-shortcuts-'+menu).attr('href');
+ }
+ }
+
+ Mousetrap.bind('m', function() {
+ $('.global-dropdown-menu').addClass('shortcuts')
+ $('.global-dropdown-toggle').trigger('click');
+ });
+
+ Mousetrap.bind('P', function() {
+ gotoMenu('projects');
+ });
+
+ Mousetrap.bind('A', function() {
+ gotoMenu('activity');
+ });
+
+ Mousetrap.bind('G', function() {
+ gotoMenu('groups');
+ });
+
+ Mousetrap.bind('L', function() {
+ gotoMenu('milestones');
+ });
+
+ Mousetrap.bind('I', function() {
+ gotoMenu('issues');
+ });
+
+ Mousetrap.bind('M', function() {
+ gotoMenu('merge_requests');
+ });
+
+ Mousetrap.bind('S', function() {
+ gotoMenu('snippets');
+ });
+
Mousetrap.bind(['ctrl+shift+p', 'command+shift+p'], this.toggleMarkdownPreview);
if (typeof findFileURL !== "undefined" && findFileURL !== null) {
Mousetrap.bind('t', function() {