diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 07:08:36 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 07:08:36 +0000 |
commit | 48aff82709769b098321c738f3444b9bdaa694c6 (patch) | |
tree | e00c7c43e2d9b603a5a6af576b1685e400410dee /app/helpers/pagination_helper.rb | |
parent | 879f5329ee916a948223f8f43d77fba4da6cd028 (diff) | |
download | gitlab-ce-4d844e2fbf8315eaf3fddb9a0b241a909be3ecbf.tar.gz |
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc42
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 |