summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Schatz <jschatz@gitlab.com>2016-06-15 20:51:30 +0000
committerJacob Schatz <jschatz@gitlab.com>2016-06-15 20:51:30 +0000
commitbe37ff7acb25cd8fe78ef4f202426502f8db510f (patch)
tree7a32956677b56c0f278644cbcd427d9156745d95
parent1af4ae33b42d3c2957617af4ac4a761d4b0411ba (diff)
parent20a6111d2b989e9cba9ee1106975eeb6054e01d5 (diff)
downloadgitlab-ce-be37ff7acb25cd8fe78ef4f202426502f8db510f.tar.gz
Merge branch 'add-shortcut-to-copy-file-content-hash-link' into 'master'
Add shortcut to copy file content hash link ## What does this MR do? * Allows for multiple shortcut handlers to be initialised * Adds `y` shortcut to file pages to copy permalink URL. ## Are there points in the code the reviewer needs to double check? Ney. ## Why was this MR needed? UX ## What are the relevant issue numbers? Closes #14470. ## Screenshots (if relevant) ![y-shortcut](/uploads/b81feb26d8e0d7d4996c4afa29f385d7/y-shortcut.gif) See merge request !4496
-rw-r--r--CHANGELOG1
-rw-r--r--app/assets/javascripts/dispatcher.js.coffee1
-rw-r--r--app/assets/javascripts/shortcuts.js.coffee4
-rw-r--r--app/assets/javascripts/shortcuts_blob.coffee10
4 files changed, 14 insertions, 2 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 6533f2ea499..01369b66f2a 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -28,6 +28,7 @@ v 8.9.0 (unreleased)
- Add a metric for the number of new Redis connections created by a transaction
- Fix Error 500 when viewing a blob with binary characters after the 1024-byte mark
- Redesign navigation for project pages
+ - Added shortcut 'y' for copying a files content hash URL #14470
- Fix groups API to list only user's accessible projects
- Add Environments and Deployments
- Redesign account and email confirmation emails
diff --git a/app/assets/javascripts/dispatcher.js.coffee b/app/assets/javascripts/dispatcher.js.coffee
index 68ced4e4b03..b9e77e179e1 100644
--- a/app/assets/javascripts/dispatcher.js.coffee
+++ b/app/assets/javascripts/dispatcher.js.coffee
@@ -98,6 +98,7 @@ class Dispatcher
when 'projects:blob:show', 'projects:blame:show'
new LineHighlighter()
shortcut_handler = new ShortcutsNavigation()
+ new ShortcutsBlob true
when 'projects:labels:new', 'projects:labels:edit'
new Labels()
when 'projects:labels:index'
diff --git a/app/assets/javascripts/shortcuts.js.coffee b/app/assets/javascripts/shortcuts.js.coffee
index f3d66004138..c03877e9b06 100644
--- a/app/assets/javascripts/shortcuts.js.coffee
+++ b/app/assets/javascripts/shortcuts.js.coffee
@@ -1,7 +1,7 @@
class @Shortcuts
- constructor: ->
+ constructor: (skipResetBindings) ->
@enabledHelp = []
- Mousetrap.reset()
+ Mousetrap.reset() if not skipResetBindings
Mousetrap.bind('?', @onToggleHelp)
Mousetrap.bind('s', Shortcuts.focusSearch)
Mousetrap.bind(['ctrl+shift+p', 'command+shift+p'], @toggleMarkdownPreview)
diff --git a/app/assets/javascripts/shortcuts_blob.coffee b/app/assets/javascripts/shortcuts_blob.coffee
new file mode 100644
index 00000000000..6d21e5d1150
--- /dev/null
+++ b/app/assets/javascripts/shortcuts_blob.coffee
@@ -0,0 +1,10 @@
+#= require shortcuts
+
+class @ShortcutsBlob extends Shortcuts
+ constructor: (skipResetBindings) ->
+ super skipResetBindings
+ Mousetrap.bind('y', ShortcutsBlob.copyToClipboard)
+
+ @copyToClipboard: ->
+ clipboardButton = $('.btn-clipboard')
+ clipboardButton.click() if clipboardButton