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
Léo-Paul Géneau
gitlab-ce
Commits
0c3a0b65
Commit
0c3a0b65
authored
Mar 26, 2017
by
George Andrinopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add keyboard edit shortcut for wiki
parent
069c54a7
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
83 additions
and
2 deletions
+83
-2
app/assets/javascripts/dispatcher.js
app/assets/javascripts/dispatcher.js
+2
-1
app/assets/javascripts/main.js
app/assets/javascripts/main.js
+1
-0
app/assets/javascripts/shortcuts_wiki.js
app/assets/javascripts/shortcuts_wiki.js
+32
-0
app/views/help/_shortcuts.html.haml
app/views/help/_shortcuts.html.haml
+17
-0
app/views/projects/wikis/_main_links.html.haml
app/views/projects/wikis/_main_links.html.haml
+1
-1
changelogs/unreleased/29816-create-keyboard-shortcut-for-editing-wiki-page.yml
.../29816-create-keyboard-shortcut-for-editing-wiki-page.yml
+4
-0
doc/workflow/shortcuts.md
doc/workflow/shortcuts.md
+6
-0
spec/features/projects/wiki/shortcuts_spec.rb
spec/features/projects/wiki/shortcuts_spec.rb
+20
-0
No files found.
app/assets/javascripts/dispatcher.js
View file @
0c3a0b65
...
@@ -33,6 +33,7 @@
...
@@ -33,6 +33,7 @@
/* global Labels */
/* global Labels */
/* global Shortcuts */
/* global Shortcuts */
/* global Sidebar */
/* global Sidebar */
/* global ShortcutsWiki */
import
Issue
from
'
./issue
'
;
import
Issue
from
'
./issue
'
;
...
@@ -416,7 +417,7 @@ const ShortcutsBlob = require('./shortcuts_blob');
...
@@ -416,7 +417,7 @@ const ShortcutsBlob = require('./shortcuts_blob');
break
;
break
;
case
'
wikis
'
:
case
'
wikis
'
:
new
gl
.
Wikis
();
new
gl
.
Wikis
();
shortcut_handler
=
new
Shortcuts
Navigation
();
shortcut_handler
=
new
Shortcuts
Wiki
();
new
ZenMode
();
new
ZenMode
();
new
gl
.
GLForm
(
$
(
'
.wiki-form
'
));
new
gl
.
GLForm
(
$
(
'
.wiki-form
'
));
break
;
break
;
...
...
app/assets/javascripts/main.js
View file @
0c3a0b65
...
@@ -35,6 +35,7 @@ import './shortcuts_navigation';
...
@@ -35,6 +35,7 @@ import './shortcuts_navigation';
import
'
./shortcuts_find_file
'
;
import
'
./shortcuts_find_file
'
;
import
'
./shortcuts_issuable
'
;
import
'
./shortcuts_issuable
'
;
import
'
./shortcuts_network
'
;
import
'
./shortcuts_network
'
;
import
'
./shortcuts_wiki
'
;
// behaviors
// behaviors
import
'
./behaviors/
'
;
import
'
./behaviors/
'
;
...
...
app/assets/javascripts/shortcuts_wiki.js
0 → 100644
View file @
0c3a0b65
/* 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
'
);
(
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
;
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
);
app/views/help/_shortcuts.html.haml
View file @
0c3a0b65
...
@@ -105,6 +105,23 @@
...
@@ -105,6 +105,23 @@
%td
.shortcut
%td
.shortcut
.key
esc
.key
esc
%td
Go back
%td
Go back
%tbody
%tr
%th
%th
Project File
%tr
%td
.shortcut
.key
y
%td
Go to file permalink
%tbody
.hidden-shortcut.merge_requests
{
style:
'display:none'
}
%tr
%th
%th
Wiki pages
%tr
%td
.shortcut
.key
e
%td
Edit wiki page
%tr
.col-lg-4
.col-lg-4
%table
.shortcut-mappings
%table
.shortcut-mappings
%tbody
%tbody
...
...
app/views/projects/wikis/_main_links.html.haml
View file @
0c3a0b65
...
@@ -5,5 +5,5 @@
...
@@ -5,5 +5,5 @@
=
link_to
namespace_project_wiki_history_path
(
@project
.
namespace
,
@project
,
@page
),
class:
"btn"
do
=
link_to
namespace_project_wiki_history_path
(
@project
.
namespace
,
@project
,
@page
),
class:
"btn"
do
Page history
Page history
-
if
can?
(
current_user
,
:create_wiki
,
@project
)
&&
@page
.
latest?
-
if
can?
(
current_user
,
:create_wiki
,
@project
)
&&
@page
.
latest?
=
link_to
namespace_project_wiki_edit_path
(
@project
.
namespace
,
@project
,
@page
),
class:
"btn"
do
=
link_to
namespace_project_wiki_edit_path
(
@project
.
namespace
,
@project
,
@page
),
class:
"btn
wiki-edit
"
do
Edit
Edit
changelogs/unreleased/29816-create-keyboard-shortcut-for-editing-wiki-page.yml
0 → 100644
View file @
0c3a0b65
---
title
:
Add keyboard edit shotcut for wiki
merge_request
:
10245
author
:
George Andrinopoulos
doc/workflow/shortcuts.md
View file @
0c3a0b65
...
@@ -75,3 +75,9 @@ You can see GitLab's keyboard shortcuts by using 'shift + ?'
...
@@ -75,3 +75,9 @@ You can see GitLab's keyboard shortcuts by using 'shift + ?'
|
<kbd>
r
</kbd>
| Reply (quoting selected text) |
|
<kbd>
r
</kbd>
| Reply (quoting selected text) |
|
<kbd>
e
</kbd>
| Edit issue/merge request |
|
<kbd>
e
</kbd>
| Edit issue/merge request |
|
<kbd>
l
</kbd>
| Change label |
|
<kbd>
l
</kbd>
| Change label |
## Wiki pages
| Keyboard Shortcut | Description |
| ----------------- | ----------- |
|
<kbd>
e
</kbd>
| Edit wiki page|
spec/features/projects/wiki/shortcuts_spec.rb
0 → 100644
View file @
0c3a0b65
require
'spec_helper'
feature
'Wiki shortcuts'
,
:feature
,
:js
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:empty_project
,
namespace:
user
.
namespace
)
}
let
(
:wiki_page
)
do
WikiPages
::
CreateService
.
new
(
project
,
user
,
title:
'home'
,
content:
'Home page'
).
execute
end
before
do
login_as
(
user
)
visit
namespace_project_wiki_path
(
project
.
namespace
,
project
,
wiki_page
)
end
scenario
'Visit edit wiki page using "e" heyboard shortcut'
do
find
(
'body'
).
native
.
send_key
(
'e'
)
expect
(
find
(
'.wiki-page-title'
)).
to
have_content
(
'Edit Page'
)
end
end
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