Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/helpers/pagination_helper.rb')
-rw-r--r--app/helpers/pagination_helper.rb10
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