Commit ef9298febbe5d84b641fcef4e4c9f8997e17a15a

Authored by Dmitriy Zaporozhets
2 parents 0f84833c 6e550af1

Merge branch 'feature/shortcuts' of /home/git/repositories/gitlab/gitlabhq into 6-0-dev

app/assets/javascripts/main.js.coffee
@@ -67,6 +67,9 @@ $ -> @@ -67,6 +67,9 @@ $ ->
67 $('.appear-data').fadeIn() 67 $('.appear-data').fadeIn()
68 e.preventDefault() 68 e.preventDefault()
69 69
  70 + $('body').keydown (e) ->
  71 + if e.which is 191
  72 + new Shortcuts()
70 73
71 # Initialize chosen selects 74 # Initialize chosen selects
72 $('select.chosen').chosen() 75 $('select.chosen').chosen()
app/assets/javascripts/shortcuts.js.coffee 0 → 100644
@@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
  1 +class Shortcuts
  2 + constructor: ->
  3 + if $('#modal-shortcuts').length > 0
  4 + $('#modal-shortcuts').modal('show')
  5 + else
  6 + $.ajax(
  7 + url: '/help/shortcuts',
  8 + dataType: "script"
  9 + )
  10 +
  11 +@Shortcuts = Shortcuts
app/controllers/help_controller.rb
@@ -12,4 +12,7 @@ class HelpController < ApplicationController @@ -12,4 +12,7 @@ class HelpController < ApplicationController
12 not_found! 12 not_found!
13 end 13 end
14 end 14 end
  15 +
  16 + def shortcuts
  17 + end
15 end 18 end
app/views/help/_shortcuts.html.haml 0 → 100644
@@ -0,0 +1,14 @@ @@ -0,0 +1,14 @@
  1 +#modal-shortcuts.modal.hide
  2 + .modal-header
  3 + %a.close{href: "#"} ×
  4 + %h3 Keyboard Shortcuts
  5 + .modal-body
  6 + %h5 Global Shortcuts
  7 + %p
  8 + %span.label.label-inverse s
  9 + –
  10 + Focus Search
  11 + %p
  12 + %span.label.label-inverse ?
  13 + –
  14 + Show this dialog
app/views/help/shortcuts.js.haml 0 → 100644
@@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
  1 +:plain
  2 + $("body").append("#{escape_javascript(render('shortcuts'))}");
  3 + $("#modal-shortcuts").modal();
app/views/layouts/_head_panel.html.haml
@@ -38,4 +38,3 @@ @@ -38,4 +38,3 @@
38 %li 38 %li
39 = link_to current_user, class: "profile-pic", id: 'profile-pic' do 39 = link_to current_user, class: "profile-pic", id: 'profile-pic' do
40 = image_tag gravatar_icon(current_user.email, 26) 40 = image_tag gravatar_icon(current_user.email, 26)
41 -  
config/routes.rb
@@ -38,6 +38,7 @@ Gitlab::Application.routes.draw do @@ -38,6 +38,7 @@ Gitlab::Application.routes.draw do
38 get 'help/system_hooks' => 'help#system_hooks' 38 get 'help/system_hooks' => 'help#system_hooks'
39 get 'help/web_hooks' => 'help#web_hooks' 39 get 'help/web_hooks' => 'help#web_hooks'
40 get 'help/workflow' => 'help#workflow' 40 get 'help/workflow' => 'help#workflow'
  41 + get 'help/shortcuts'
41 42
42 # 43 #
43 # Global snippets 44 # Global snippets