diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-06-30 23:10:52 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-06-30 23:10:52 +0400 |
commit | 6e550af150958d0c88bf21f206c2309dc0b5c78d (patch) | |
tree | 7adc91913bde98879e27dde8633863cf7c6ea036 /app | |
parent | 0f84833c33174e4c8cd72690e93bba5444d9e25f (diff) |
Show shotcut dialog on ?
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/main.js.coffee | 3 | ||||
-rw-r--r-- | app/assets/javascripts/shortcuts.js.coffee | 11 | ||||
-rw-r--r-- | app/controllers/help_controller.rb | 3 | ||||
-rw-r--r-- | app/views/help/_shortcuts.html.haml | 14 | ||||
-rw-r--r-- | app/views/help/shortcuts.js.haml | 3 | ||||
-rw-r--r-- | app/views/layouts/_head_panel.html.haml | 1 |
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 + – + Focus Search + %p + %span.label.label-inverse ? + – + 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) - |