summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-06-30 22:10:52 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-06-30 22:10:52 +0300
commit6e550af150958d0c88bf21f206c2309dc0b5c78d (patch)
tree7adc91913bde98879e27dde8633863cf7c6ea036 /app
parent0f84833c33174e4c8cd72690e93bba5444d9e25f (diff)
downloadgitlab-ce-6e550af150958d0c88bf21f206c2309dc0b5c78d.tar.gz
Show shotcut dialog on ?
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/main.js.coffee3
-rw-r--r--app/assets/javascripts/shortcuts.js.coffee11
-rw-r--r--app/controllers/help_controller.rb3
-rw-r--r--app/views/help/_shortcuts.html.haml14
-rw-r--r--app/views/help/shortcuts.js.haml3
-rw-r--r--app/views/layouts/_head_panel.html.haml1
6 files changed, 34 insertions, 1 deletions
diff --git a/app/assets/javascripts/main.js.coffee b/app/assets/javascripts/main.js.coffee
index b96ef65af93..cb9678d4839 100644
--- a/app/assets/javascripts/main.js.coffee
+++ b/app/assets/javascripts/main.js.coffee
@@ -67,6 +67,9 @@ $ ->
$('.appear-data').fadeIn()
e.preventDefault()
+ $('body').keydown (e) ->
+ if e.which is 191
+ new Shortcuts()
# Initialize chosen selects
$('select.chosen').chosen()
diff --git a/app/assets/javascripts/shortcuts.js.coffee b/app/assets/javascripts/shortcuts.js.coffee
new file mode 100644
index 00000000000..e7e40a066ec
--- /dev/null
+++ b/app/assets/javascripts/shortcuts.js.coffee
@@ -0,0 +1,11 @@
+class Shortcuts
+ constructor: ->
+ if $('#modal-shortcuts').length > 0
+ $('#modal-shortcuts').modal('show')
+ else
+ $.ajax(
+ url: '/help/shortcuts',
+ dataType: "script"
+ )
+
+@Shortcuts = Shortcuts
diff --git a/app/controllers/help_controller.rb b/app/controllers/help_controller.rb
index 2958367e0f8..051cbdfaf05 100644
--- a/app/controllers/help_controller.rb
+++ b/app/controllers/help_controller.rb
@@ -12,4 +12,7 @@ class HelpController < ApplicationController
not_found!
end
end
+
+ def shortcuts
+ end
end
diff --git a/app/views/help/_shortcuts.html.haml b/app/views/help/_shortcuts.html.haml
new file mode 100644
index 00000000000..7cbe5fc45ff
--- /dev/null
+++ b/app/views/help/_shortcuts.html.haml
@@ -0,0 +1,14 @@
+#modal-shortcuts.modal.hide
+ .modal-header
+ %a.close{href: "#"} ×
+ %h3 Keyboard Shortcuts
+ .modal-body
+ %h5 Global Shortcuts
+ %p
+ %span.label.label-inverse s
+ &ndash;
+ Focus Search
+ %p
+ %span.label.label-inverse ?
+ &ndash;
+ Show this dialog
diff --git a/app/views/help/shortcuts.js.haml b/app/views/help/shortcuts.js.haml
new file mode 100644
index 00000000000..99ed042ea3b
--- /dev/null
+++ b/app/views/help/shortcuts.js.haml
@@ -0,0 +1,3 @@
+:plain
+ $("body").append("#{escape_javascript(render('shortcuts'))}");
+ $("#modal-shortcuts").modal();
diff --git a/app/views/layouts/_head_panel.html.haml b/app/views/layouts/_head_panel.html.haml
index e59528897d1..2fbac5fff37 100644
--- a/app/views/layouts/_head_panel.html.haml
+++ b/app/views/layouts/_head_panel.html.haml
@@ -38,4 +38,3 @@
%li
= link_to current_user, class: "profile-pic", id: 'profile-pic' do
= image_tag gravatar_icon(current_user.email, 26)
-