Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
91de6e25
Commit
91de6e25
authored
Apr 12, 2016
by
Alfredo Sumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Toggle help modal
parent
7f153077
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
20 deletions
+23
-20
app/assets/javascripts/shortcuts.js.coffee
app/assets/javascripts/shortcuts.js.coffee
+23
-20
No files found.
app/assets/javascripts/shortcuts.js.coffee
View file @
91de6e25
...
...
@@ -2,34 +2,37 @@ class @Shortcuts
constructor
:
->
@
enabledHelp
=
[]
Mousetrap
.
reset
()
Mousetrap
.
bind
(
'?'
,
@
selectiv
eHelp
)
Mousetrap
.
bind
(
'?'
,
@
onToggl
eHelp
)
Mousetrap
.
bind
(
's'
,
Shortcuts
.
focusSearch
)
Mousetrap
.
bind
([
'ctrl+shift+p'
,
'command+shift+p'
],
@
toggleMarkdownPreview
)
Mousetrap
.
bind
(
't'
,
->
Turbolinks
.
visit
(
findFileURL
))
if
findFileURL
?
selectiveHelp
:
(
e
)
=>
Shortcuts
.
showHelp
(
e
,
@
enabledHelp
)
onToggleHelp
:
(
e
)
=>
e
.
preventDefault
()
@
toggleHelp
(
@
enabledHelp
)
toggleMarkdownPreview
:
(
e
)
=>
$
(
document
).
triggerHandler
(
'markdown-preview:toggle'
,
[
e
])
@
showHelp
:
(
e
,
location
)
->
if
$
(
'#modal-shortcuts'
).
length
>
0
$
(
'#modal-shortcuts'
).
modal
(
'show'
)
else
url
=
'/help/shortcuts'
url
=
gon
.
relative_url_root
+
url
if
gon
.
relative_url_root
?
$
.
ajax
(
url
:
url
,
dataType
:
'script'
,
success
:
(
e
)
->
if
location
and
location
.
length
>
0
$
(
l
).
show
()
for
l
in
location
else
$
(
'.hidden-shortcut'
).
show
()
$
(
'.js-more-help-button'
).
remove
()
)
e
.
preventDefault
()
toggleHelp
:
(
location
)
->
$modal
=
$
(
'#modal-shortcuts'
)
if
$modal
.
length
$modal
.
modal
(
'toggle'
)
return
url
=
'/help/shortcuts'
url
=
gon
.
relative_url_root
+
url
if
gon
.
relative_url_root
?
$
.
ajax
(
url
:
url
,
dataType
:
'script'
,
success
:
(
e
)
->
if
location
and
location
.
length
>
0
$
(
l
).
show
()
for
l
in
location
else
$
(
'.hidden-shortcut'
).
show
()
$
(
'.js-more-help-button'
).
remove
()
)
@
focusSearch
:
(
e
)
->
$
(
'#search'
).
focus
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment