diff options
author | Jacob Schatz <jschatz@gitlab.com> | 2016-06-06 18:40:42 +0000 |
---|---|---|
committer | Jacob Schatz <jschatz@gitlab.com> | 2016-06-06 18:40:42 +0000 |
commit | 410130b8077de853607b65229326f8485f575a9e (patch) | |
tree | 0bdaf817da2ef517ed353a021c8dbb86cccc4925 /app | |
parent | ed9b1bd63f98a0ef0ad7b9bfb56882c08b652b1e (diff) | |
parent | 535d11302e73fe88702f7c65effc3cd443bf56fc (diff) | |
download | gitlab-ce-410130b8077de853607b65229326f8485f575a9e.tar.gz |
Merge branch '18026-consider-removing-issue-merge-request-previous-next-buttons' into 'master'
Remove prev/next buttons on issues and merge requests
## What does this MR do?
Remove prev/next buttons on issues and merge requests sidebar
## Are there points in the code the reviewer needs to double check?
No
## Why was this MR needed?
The buttons were rarely used and added at least 1 query each on every page load which we could live without.
## What are the relevant issue numbers?
#18026
## Screenshots (if relevant)
Below is how it looks. Not sure if it's too much empty space. #17697 discusses a possible substitute for what to put there.
![Captura_de_pantalla_2016-06-06_a_las_11.09.26_a.m.](/uploads/7b379327aa6c608775f99bf47a9c3352/Captura_de_pantalla_2016-06-06_a_las_11.09.26_a.m..png)
![Captura_de_pantalla_2016-06-06_a_las_11.09.38_a.m.](/uploads/68bcae6754ed5ac48f1a6925fdd17d3f/Captura_de_pantalla_2016-06-06_a_las_11.09.38_a.m..png)
See merge request !4442
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/shortcuts_issuable.coffee | 18 | ||||
-rw-r--r-- | app/helpers/issuables_helper.rb | 12 | ||||
-rw-r--r-- | app/views/shared/issuable/_sidebar.html.haml | 15 |
3 files changed, 0 insertions, 45 deletions
diff --git a/app/assets/javascripts/shortcuts_issuable.coffee b/app/assets/javascripts/shortcuts_issuable.coffee index ccb42ab2168..c93bcf3ceec 100644 --- a/app/assets/javascripts/shortcuts_issuable.coffee +++ b/app/assets/javascripts/shortcuts_issuable.coffee @@ -10,14 +10,6 @@ class @ShortcutsIssuable extends ShortcutsNavigation @replyWithSelectedText() return false ) - Mousetrap.bind('j', => - @prevIssue() - return false - ) - Mousetrap.bind('k', => - @nextIssue() - return false - ) Mousetrap.bind('e', => @editIssue() return false @@ -29,16 +21,6 @@ class @ShortcutsIssuable extends ShortcutsNavigation 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/helpers/issuables_helper.rb b/app/helpers/issuables_helper.rb index 37b93f63145..40d8ce8a1d3 100644 --- a/app/helpers/issuables_helper.rb +++ b/app/helpers/issuables_helper.rb @@ -8,14 +8,6 @@ module IssuablesHelper "right-sidebar-#{sidebar_gutter_collapsed? ? 'collapsed' : 'expanded'}" end - def issuables_count(issuable) - base_issuable_scope(issuable).maximum(:iid) - end - - def next_issuable_for(issuable) - base_issuable_scope(issuable).where('iid > ?', issuable.iid).last - end - def multi_label_name(current_labels, default_label) # current_labels may be a string from before if current_labels.is_a?(Array) @@ -45,10 +37,6 @@ module IssuablesHelper end end - def prev_issuable_for(issuable) - base_issuable_scope(issuable).where('iid < ?', issuable.iid).first - end - def user_dropdown_label(user_id, default_label) return default_label if user_id.nil? return "Unassigned" if user_id == "0" diff --git a/app/views/shared/issuable/_sidebar.html.haml b/app/views/shared/issuable/_sidebar.html.haml index d6552ae7f18..1ec2436c835 100644 --- a/app/views/shared/issuable/_sidebar.html.haml +++ b/app/views/shared/issuable/_sidebar.html.haml @@ -2,23 +2,8 @@ .issuable-sidebar - can_edit_issuable = can?(current_user, :"admin_#{issuable.to_ability_name}", @project) .block.issuable-sidebar-header - %span.issuable-count.hide-collapsed.pull-left - = issuable.iid - of - = issuables_count(issuable) %a.gutter-toggle.pull-right.js-sidebar-toggle{href: '#'} = sidebar_gutter_toggle_icon - .issuable-nav.hide-collapsed.pull-right.btn-group{role: 'group', "aria-label" => '...'} - - if prev_issuable = prev_issuable_for(issuable) - = link_to 'Prev', [@project.namespace.becomes(Namespace), @project, prev_issuable], class: 'btn btn-default prev-btn issuable-pager' - - else - %a.btn.btn-default.issuable-pager.disabled{href: '#'} - Prev - - if next_issuable = next_issuable_for(issuable) - = link_to 'Next', [@project.namespace.becomes(Namespace), @project, next_issuable], class: 'btn btn-default next-btn issuable-pager' - - else - %a.btn.btn-default.issuable-pager.disabled{href: '#'} - Next = form_for [@project.namespace.becomes(Namespace), @project, issuable], remote: true, format: :json, html: {class: 'issuable-context-form inline-update js-issuable-update'} do |f| .block.assignee |