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
Boxiang Sun
gitlab-ce
Commits
23a38eac
Commit
23a38eac
authored
Dec 19, 2017
by
Clement Ho
Committed by
Phil Hughes
Dec 19, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix shortcut links on help page
parent
a9d4b2eb
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
53 additions
and
4 deletions
+53
-4
app/assets/javascripts/docs/docs_bundle.js
app/assets/javascripts/docs/docs_bundle.js
+13
-0
app/assets/javascripts/shortcuts.js
app/assets/javascripts/shortcuts.js
+8
-2
app/views/help/index.html.haml
app/views/help/index.html.haml
+8
-2
changelogs/unreleased/fix-docs-help-shortcut.yml
changelogs/unreleased/fix-docs-help-shortcut.yml
+5
-0
config/webpack.config.js
config/webpack.config.js
+1
-0
spec/features/help_pages_spec.rb
spec/features/help_pages_spec.rb
+18
-0
No files found.
app/assets/javascripts/docs/docs_bundle.js
0 → 100644
View file @
23a38eac
import
Mousetrap
from
'
mousetrap
'
;
function
addMousetrapClick
(
el
,
key
)
{
el
.
addEventListener
(
'
click
'
,
()
=>
Mousetrap
.
trigger
(
key
));
}
function
domContentLoaded
()
{
addMousetrapClick
(
document
.
querySelector
(
'
.js-trigger-shortcut
'
),
'
?
'
);
addMousetrapClick
(
document
.
querySelector
(
'
.js-trigger-search-bar
'
),
'
s
'
);
}
document
.
addEventListener
(
'
DOMContentLoaded
'
,
domContentLoaded
);
app/assets/javascripts/shortcuts.js
View file @
23a38eac
...
...
@@ -51,7 +51,10 @@ export default class Shortcuts {
}
onToggleHelp
(
e
)
{
e
.
preventDefault
();
if
(
e
.
preventDefault
)
{
e
.
preventDefault
();
}
Shortcuts
.
toggleHelp
(
this
.
enabledHelp
);
}
...
...
@@ -112,6 +115,9 @@ export default class Shortcuts {
static
focusSearch
(
e
)
{
$
(
'
#search
'
).
focus
();
e
.
preventDefault
();
if
(
e
.
preventDefault
)
{
e
.
preventDefault
();
}
}
}
app/views/help/index.html.haml
View file @
23a38eac
=
webpack_bundle_tag
'docs'
%div
-
if
current_application_settings
.
help_page_text
.
present?
=
markdown_field
(
current_application_settings
,
:help_page_text
)
...
...
@@ -37,8 +39,12 @@
Quick help
%ul
.well-list
%li
=
link_to
'See our website for getting help'
,
support_url
%li
=
link_to
'Use the search bar on the top of this page'
,
'#'
,
onclick:
'Shortcuts.focusSearch(event)'
%li
=
link_to
'Use shortcuts'
,
'#'
,
onclick:
'Shortcuts.toggleHelp()'
%li
%button
.btn-blank.btn-link.js-trigger-search-bar
{
type:
'button'
}
Use the search bar on the top of this page
%li
%button
.btn-blank.btn-link.js-trigger-shortcut
{
type:
'button'
}
Use shortcuts
-
unless
current_application_settings
.
help_page_hide_commercial_content?
%li
=
link_to
'Get a support subscription'
,
'https://about.gitlab.com/pricing/'
%li
=
link_to
'Compare GitLab editions'
,
'https://about.gitlab.com/features/#compare'
changelogs/unreleased/fix-docs-help-shortcut.yml
0 → 100644
View file @
23a38eac
---
title
:
Fix shortcut links on help page
merge_request
:
author
:
type
:
fixed
config/webpack.config.js
View file @
23a38eac
...
...
@@ -36,6 +36,7 @@ var config = {
cycle_analytics
:
'
./cycle_analytics/cycle_analytics_bundle.js
'
,
commit_pipelines
:
'
./commit/pipelines/pipelines_bundle.js
'
,
deploy_keys
:
'
./deploy_keys/index.js
'
,
docs
:
'
./docs/docs_bundle.js
'
,
diff_notes
:
'
./diff_notes/diff_notes_bundle.js
'
,
environments
:
'
./environments/environments_bundle.js
'
,
environments_folder
:
'
./environments/folder/environments_folder_bundle.js
'
,
...
...
spec/features/help_pages_spec.rb
View file @
23a38eac
...
...
@@ -32,6 +32,24 @@ describe 'Help Pages' do
it_behaves_like
'help page'
,
prefix:
'/gitlab'
end
context
'quick link shortcuts'
,
:js
do
before
do
visit
help_path
end
it
'focuses search bar'
do
find
(
'.js-trigger-search-bar'
).
click
expect
(
page
).
to
have_selector
(
'#search:focus'
)
end
it
'opens shortcuts help dialog'
do
find
(
'.js-trigger-shortcut'
).
click
expect
(
page
).
to
have_selector
(
'#modal-shortcuts'
)
end
end
end
context
'in a production environment with version check enabled'
,
:js
do
...
...
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