Fixup regression in 2eb89a835.
Fix regression in 2eb89a835 that broke the modqueue page because the
arguments to `paginated_search` changed and weren't updated here.
Also fix incorrect YARD documentation syntax.
This commit is contained in:
@@ -16,19 +16,20 @@ class ApplicationRecord < ActiveRecord::Base
|
||||
|
||||
# Perform a search using the model's `search` method, then paginate the results.
|
||||
#
|
||||
# params [Hash] The URL request params from the user
|
||||
# page [Integer] The page number
|
||||
# limit [Integer] The number of posts per page
|
||||
# count_pages [Boolean] If true, show the exact number of pages of
|
||||
# results. If false (the default), don't count the exact number of pages
|
||||
# @param params [Hash] The URL request params from the user
|
||||
# @param page [Integer] The page number
|
||||
# @param limit [Integer] The number of posts per page
|
||||
# @param count_pages [Boolean] If true, calculate the exact number of pages of
|
||||
# results. If false (the default), don't calculate the exact number of pages
|
||||
# of results; assume there are too many pages to count.
|
||||
# defaults [Hash] The default params for the search
|
||||
def paginated_search(params, page: params[:page], limit: params[:limit], count_pages: params[:search].present?, defaults: {})
|
||||
# @param count [Integer] the precalculated number of search results, or nil to calculate it
|
||||
# @param defaults [Hash] The default params for the search
|
||||
def paginated_search(params, page: params[:page], limit: params[:limit], count_pages: params[:search].present?, count: nil, defaults: {})
|
||||
search_params = params.fetch(:search, {}).permit!
|
||||
search_params = defaults.merge(search_params).with_indifferent_access
|
||||
|
||||
max_limit = (params[:format] == "sitemap") ? 10_000 : 1_000
|
||||
search(search_params).paginate(page, limit: limit, max_limit: max_limit, search_count: count_pages)
|
||||
search(search_params).paginate(page, limit: limit, max_limit: max_limit, count: count, search_count: count_pages)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user