From 48aff82709769b098321c738f3444b9bdaa694c6 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Wed, 21 Oct 2020 07:08:36 +0000 Subject: Add latest changes from gitlab-org/gitlab@13-5-stable-ee --- app/helpers/pagination_helper.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'app/helpers/pagination_helper.rb') 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 -- cgit v1.2.1