diff options
author | Jacob Schatz <jacobschatz@Jacobs-MBP.fios-router.home> | 2016-02-05 22:40:50 +0300 |
---|---|---|
committer | Jacob Schatz <jacobschatz@Jacobs-MBP.fios-router.home> | 2016-02-05 22:40:50 +0300 |
commit | 4a878e1dfacf4510aa95c81e1ecb815289eee3c1 (patch) | |
tree | 5564ae5081140c7157f04eb43c81a0d880bf5b56 /app/assets | |
parent | 2e8fe0bdb274e8cdc80d0e38fe340832c70adfb2 (diff) |
Add `j` and `k` shortcuts
Diffstat (limited to 'app/assets')
-rw-r--r-- | app/assets/javascripts/shortcuts_issuable.coffee | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/app/assets/javascripts/shortcuts_issuable.coffee b/app/assets/javascripts/shortcuts_issuable.coffee index f717a753cf8..cefa1857d7f 100644 --- a/app/assets/javascripts/shortcuts_issuable.coffee +++ b/app/assets/javascripts/shortcuts_issuable.coffee @@ -16,12 +16,31 @@ class @ShortcutsIssuable extends ShortcutsNavigation @replyWithSelectedText() return false ) + Mousetrap.bind('j', => + @prevIssue() + return false + ) + Mousetrap.bind('k', => + @nextIssue() + return false + ) + if isMergeRequest @enabledHelp.push('.hidden-shortcut.merge_requests') else @enabledHelp.push('.hidden-shortcut.issues') + prevIssue: -> + $prevBtn = $('.prev-btn') + if not $prevBtn.hasClass('disabled') + Turbolinks.visit($prevBtn.attr('href')) + + nextIssue: -> + $nextBtn = $('.next-btn') + if not $nextBtn.hasClass('disabled') + Turbolinks.visit($nextBtn.attr('href')) + replyWithSelectedText: -> if window.getSelection selected = window.getSelection().toString() |