Show shotcut dialog on ?

This commit is contained in:
Dmitriy Zaporozhets 2013-06-30 22:10:52 +03:00
parent 0f84833c33
commit 6e550af150
7 changed files with 35 additions and 1 deletions

View File

@ -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()

View File

@ -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

View File

@ -12,4 +12,7 @@ class HelpController < ApplicationController
not_found!
end
end
def shortcuts
end
end

View File

@ -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

View File

@ -0,0 +1,3 @@
:plain
$("body").append("#{escape_javascript(render('shortcuts'))}");
$("#modal-shortcuts").modal();

View File

@ -38,4 +38,3 @@
%li
= link_to current_user, class: "profile-pic", id: 'profile-pic' do
= image_tag gravatar_icon(current_user.email, 26)

View File

@ -38,6 +38,7 @@ Gitlab::Application.routes.draw do
get 'help/system_hooks' => 'help#system_hooks'
get 'help/web_hooks' => 'help#web_hooks'
get 'help/workflow' => 'help#workflow'
get 'help/shortcuts'
#
# Global snippets