summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-02-05 20:57:45 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-02-05 20:57:45 +0000
commit26f3cc41fc41f2901cc560aaecf1fe49cadda7ca (patch)
tree079f5f1c4ec049fd2483fd99e6699a748d15f780
parent008ef89d16b587b40e31e895530d60d7d857afd5 (diff)
parent932c5eb886abacceb0613f2de6e77ff50660a861 (diff)
downloadgitlab-ce-26f3cc41fc41f2901cc560aaecf1fe49cadda7ca.tar.gz
Merge branch 'feature/jschatz1/sidebar-features' into 'master'
Feature/jschatz1/sidebar features * Changes sidebar width (290px). * Makes shortcuts for <kbd>j</kbd> and <kbd>k</kbd> keys for next and previous issues. ![Screen_Shot_2016-02-05_at_3.06.22_PM](/uploads/8590be43dc1b9feffd4f32b4e8cb7790/Screen_Shot_2016-02-05_at_3.06.22_PM.png) cc/ @dzaporozhets See merge request !2734
-rw-r--r--app/assets/javascripts/shortcuts_issuable.coffee19
-rw-r--r--app/assets/stylesheets/framework/variables.scss4
-rw-r--r--app/views/shared/issuable/_sidebar.html.haml4
3 files changed, 23 insertions, 4 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()
diff --git a/app/assets/stylesheets/framework/variables.scss b/app/assets/stylesheets/framework/variables.scss
index efc3366e99c..b8386362637 100644
--- a/app/assets/stylesheets/framework/variables.scss
+++ b/app/assets/stylesheets/framework/variables.scss
@@ -13,8 +13,8 @@ $list-font-size: 15px;
$sidebar_collapsed_width: 62px;
$sidebar_width: 230px;
$gutter_collapsed_width: 62px;
-$gutter_width: 312px;
-$gutter_inner_width: 280px;
+$gutter_width: 290px;
+$gutter_inner_width: 258px;
$avatar_radius: 50%;
$code_font_size: 13px;
$code_line_height: 1.5;
diff --git a/app/views/shared/issuable/_sidebar.html.haml b/app/views/shared/issuable/_sidebar.html.haml
index 75a7d9be2c1..ae96a45453f 100644
--- a/app/views/shared/issuable/_sidebar.html.haml
+++ b/app/views/shared/issuable/_sidebar.html.haml
@@ -13,12 +13,12 @@
= icon('angle-double-right')
.issuable-nav.pull-right.btn-group{role: 'group', "aria-label" => '...'}
- if has_prev_issuable?(@project, issuable.id)
- = link_to 'Prev', issuable_link_prev(@project, issuable), class: 'btn btn-default'
+ = link_to 'Prev', issuable_link_prev(@project, issuable), class: 'btn btn-default prev-btn'
- else
%a.btn.btn-default.disabled{href: '#'}
Prev
- if has_next_issuable?(@project, issuable.id)
- = link_to 'Next', issuable_link_next(@project, issuable), class: 'btn btn-default'
+ = link_to 'Next', issuable_link_next(@project, issuable), class: 'btn btn-default next-btn'
- else
%a.btn.btn-default.disabled{href: '#'}
Next