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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
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
...
@@ -2,34 +2,37 @@ class @Shortcuts
constructor
:
->
constructor
:
->
@
enabledHelp
=
[]
@
enabledHelp
=
[]
Mousetrap
.
reset
()
Mousetrap
.
reset
()
Mousetrap
.
bind
(
'?'
,
@
selectiv
eHelp
)
Mousetrap
.
bind
(
'?'
,
@
onToggl
eHelp
)
Mousetrap
.
bind
(
's'
,
Shortcuts
.
focusSearch
)
Mousetrap
.
bind
(
's'
,
Shortcuts
.
focusSearch
)
Mousetrap
.
bind
([
'ctrl+shift+p'
,
'command+shift+p'
],
@
toggleMarkdownPreview
)
Mousetrap
.
bind
([
'ctrl+shift+p'
,
'command+shift+p'
],
@
toggleMarkdownPreview
)
Mousetrap
.
bind
(
't'
,
->
Turbolinks
.
visit
(
findFileURL
))
if
findFileURL
?
Mousetrap
.
bind
(
't'
,
->
Turbolinks
.
visit
(
findFileURL
))
if
findFileURL
?
selectiveHelp
:
(
e
)
=>
onToggleHelp
:
(
e
)
=>
Shortcuts
.
showHelp
(
e
,
@
enabledHelp
)
e
.
preventDefault
()
@
toggleHelp
(
@
enabledHelp
)
toggleMarkdownPreview
:
(
e
)
=>
toggleMarkdownPreview
:
(
e
)
=>
$
(
document
).
triggerHandler
(
'markdown-preview:toggle'
,
[
e
])
$
(
document
).
triggerHandler
(
'markdown-preview:toggle'
,
[
e
])
@
showHelp
:
(
e
,
location
)
->
toggleHelp
:
(
location
)
->
if
$
(
'#modal-shortcuts'
).
length
>
0
$modal
=
$
(
'#modal-shortcuts'
)
$
(
'#modal-shortcuts'
).
modal
(
'show'
)
else
if
$modal
.
length
url
=
'/help/shortcuts'
$modal
.
modal
(
'toggle'
)
url
=
gon
.
relative_url_root
+
url
if
gon
.
relative_url_root
?
return
$
.
ajax
(
url
:
url
,
url
=
'/help/shortcuts'
dataType
:
'script'
,
url
=
gon
.
relative_url_root
+
url
if
gon
.
relative_url_root
?
success
:
(
e
)
->
$
.
ajax
(
if
location
and
location
.
length
>
0
url
:
url
,
$
(
l
).
show
()
for
l
in
location
dataType
:
'script'
,
else
success
:
(
e
)
->
$
(
'.hidden-shortcut'
).
show
()
if
location
and
location
.
length
>
0
$
(
'.js-more-help-button'
).
remove
()
$
(
l
).
show
()
for
l
in
location
)
else
e
.
preventDefault
()
$
(
'.hidden-shortcut'
).
show
()
$
(
'.js-more-help-button'
).
remove
()
)
@
focusSearch
:
(
e
)
->
@
focusSearch
:
(
e
)
->
$
(
'#search'
).
focus
()
$
(
'#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