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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
b6b83f3c
Commit
b6b83f3c
authored
Mar 29, 2017
by
geoandri
Committed by
George Andrinopoulos
Apr 11, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor shortcuts_wiki.js
parent
0c3a0b65
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
29 deletions
+13
-29
app/assets/javascripts/dispatcher.js
app/assets/javascripts/dispatcher.js
+1
-0
app/assets/javascripts/shortcuts_wiki.js
app/assets/javascripts/shortcuts_wiki.js
+10
-27
app/views/help/_shortcuts.html.haml
app/views/help/_shortcuts.html.haml
+1
-1
spec/features/projects/wiki/shortcuts_spec.rb
spec/features/projects/wiki/shortcuts_spec.rb
+1
-1
No files found.
app/assets/javascripts/dispatcher.js
View file @
b6b83f3c
...
...
@@ -47,6 +47,7 @@ import BlobLinePermalinkUpdater from './blob/blob_line_permalink_updater';
import
BlobForkSuggestion
from
'
./blob/blob_fork_suggestion
'
;
import
UserCallout
from
'
./user_callout
'
;
import
{
ProtectedTagCreate
,
ProtectedTagEditList
}
from
'
./protected_tags
'
;
import
ShortcutsWiki
from
'
./shortcuts_wiki
'
;
const
ShortcutsBlob
=
require
(
'
./shortcuts_blob
'
);
...
...
app/assets/javascripts/shortcuts_wiki.js
View file @
b6b83f3c
/* eslint-disable func-names, space-before-function-paren, max-len, no-var, one-var, no-restricted-syntax, vars-on-top, no-use-before-define, no-param-reassign, new-cap, no-underscore-dangle, wrap-iife, one-var-declaration-per-line, quotes, prefer-arrow-callback, consistent-return, prefer-template, no-mixed-operators */
/* global Mousetrap */
/* global ShortcutsNavigation */
require
(
'
mousetrap
'
);
require
(
'
./shortcuts_navigation
'
);
class
ShortcutsWiki
extends
ShortcutsNavigation
{
constructor
()
{
super
();
Mousetrap
.
bind
(
'
e
'
,
this
.
editWiki
);
}
(
function
()
{
var
extend
=
function
(
child
,
parent
)
{
for
(
var
key
in
parent
)
{
if
(
hasProp
.
call
(
parent
,
key
))
child
[
key
]
=
parent
[
key
];
}
function
ctor
()
{
this
.
constructor
=
child
;
}
ctor
.
prototype
=
parent
.
prototype
;
child
.
prototype
=
new
ctor
();
child
.
__super__
=
parent
.
prototype
;
return
child
;
},
hasProp
=
{}.
hasOwnProperty
;
editWiki
()
{
this
.
gl
.
utils
.
visitUrl
(
$
(
'
.wiki-edit
'
).
attr
(
'
href
'
));
}
}
this
.
ShortcutsWiki
=
(
function
(
superClass
)
{
extend
(
ShortcutsWiki
,
superClass
);
function
ShortcutsWiki
()
{
ShortcutsWiki
.
__super__
.
constructor
.
call
(
this
);
Mousetrap
.
bind
(
'
e
'
,
(
function
(
_this
)
{
return
function
()
{
_this
.
editWiki
();
return
false
;
};
})(
this
));
}
ShortcutsWiki
.
prototype
.
editWiki
=
function
()
{
var
$editBtn
;
$editBtn
=
$
(
'
.wiki-edit
'
);
return
gl
.
utils
.
visitUrl
(
$editBtn
.
attr
(
'
href
'
));
};
return
ShortcutsWiki
;
})(
ShortcutsNavigation
);
}).
call
(
window
);
module
.
exports
=
ShortcutsWiki
;
app/views/help/_shortcuts.html.haml
View file @
b6b83f3c
...
...
@@ -113,7 +113,7 @@
%td
.shortcut
.key
y
%td
Go to file permalink
%tbody
.hidden-shortcut.
merge_requests
{
style:
'display:none'
}
%tbody
.hidden-shortcut.
wiki
{
style:
'display:none'
}
%tr
%th
%th
Wiki pages
...
...
spec/features/projects/wiki/shortcuts_spec.rb
View file @
b6b83f3c
...
...
@@ -12,7 +12,7 @@ feature 'Wiki shortcuts', :feature, :js do
visit
namespace_project_wiki_path
(
project
.
namespace
,
project
,
wiki_page
)
end
scenario
'Visit edit wiki page using "e"
h
eyboard shortcut'
do
scenario
'Visit edit wiki page using "e"
k
eyboard shortcut'
do
find
(
'body'
).
native
.
send_key
(
'e'
)
expect
(
find
(
'.wiki-page-title'
)).
to
have_content
(
'Edit Page'
)
...
...
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