diff options
author | Sean McGivern <sean@gitlab.com> | 2019-05-30 14:50:46 +0300 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2019-05-30 14:50:46 +0300 |
commit | 82ccc8bc120c78efdf68f65d77a72adc5fb48410 (patch) | |
tree | 8b28780bced61634231a97807b9ebd3cbfbc77f5 /app/controllers | |
parent | d5686516bb3d1aaa75c5dffe09fcbc0ef3469521 (diff) | |
parent | 703dd456e38d2cd357c3e7ec15e3b088f8ea4235 (diff) |
Merge branch '9121-sort-relative-position' into 'master'
Support sorting issues using `relative_position`
Closes #62178
See merge request gitlab-org/gitlab-ce!28566
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/concerns/issuable_collections.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/app/controllers/concerns/issuable_collections.rb b/app/controllers/concerns/issuable_collections.rb index 91e875dca54..9cf25915e92 100644 --- a/app/controllers/concerns/issuable_collections.rb +++ b/app/controllers/concerns/issuable_collections.rb @@ -41,6 +41,7 @@ module IssuableCollections return if pagination_disabled? @issuables = @issuables.page(params[:page]) + @issuables = per_page_for_relative_position if params[:sort] == 'relative_position' @issuable_meta_data = issuable_meta_data(@issuables, collection_type) @total_pages = issuable_page_count end @@ -80,6 +81,11 @@ module IssuableCollections (row_count.to_f / limit).ceil end + # manual / relative_position sorting allows for 100 items on the page + def per_page_for_relative_position + @issuables.per(100) # rubocop:disable Gitlab/ModuleWithInstanceVariables + end + def issuable_finder_for(finder_class) finder_class.new(current_user, finder_options) end |