diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-14 21:08:47 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-14 21:08:47 +0300 |
commit | 93960490b8bdbc0f2ab1d102b83ec5d5b87c97a6 (patch) | |
tree | 05e12b8fc3094f8de548aff4f929ef3433a3f52e /app/helpers/pagination_helper.rb | |
parent | 99670fc6a027caee34a6537c8def2e998d1ac5c2 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/helpers/pagination_helper.rb')
-rw-r--r-- | app/helpers/pagination_helper.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/app/helpers/pagination_helper.rb b/app/helpers/pagination_helper.rb index d05153c9d4b..3167142e193 100644 --- a/app/helpers/pagination_helper.rb +++ b/app/helpers/pagination_helper.rb @@ -1,11 +1,13 @@ # frozen_string_literal: true module PaginationHelper - def paginate_collection(collection, remote: nil) + # total_pages will be inferred from the collection if nil. It is ignored if + # the collection is a Kaminari::PaginatableWithoutCount + def paginate_collection(collection, remote: nil, total_pages: nil) if collection.is_a?(Kaminari::PaginatableWithoutCount) paginate_without_count(collection) elsif collection.respond_to?(:total_pages) - paginate_with_count(collection, remote: remote) + paginate_with_count(collection, remote: remote, total_pages: total_pages) end end @@ -17,7 +19,7 @@ module PaginationHelper ) end - def paginate_with_count(collection, remote: nil) - paginate(collection, remote: remote, theme: 'gitlab') + def paginate_with_count(collection, remote: nil, total_pages: nil) + paginate(collection, remote: remote, theme: 'gitlab', total_pages: total_pages) end end |