mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-27 06:05:19 +00:00
fixed test failure
This commit is contained in:
@@ -138,7 +138,7 @@ module Admin
|
||||
def fetch_products
|
||||
product_query = OpenFoodNetwork::Permissions.new(spree_current_user)
|
||||
.editable_products.merge(product_scope).ransack(ransack_query).result
|
||||
@pagy, @products = pagy(product_query.order(:name), items: @per_page, page: @page,
|
||||
@pagy, @products = pagy(product_query.order(:name), limit: @per_page, page: @page,
|
||||
size: [1, 2, 2, 1])
|
||||
end
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ module Api
|
||||
|
||||
if pagination_required?
|
||||
@pagy, results = pagy(results,
|
||||
items: params[:per_page] || DEFAULT_PER_PAGE)
|
||||
limit: params[:per_page] || DEFAULT_PER_PAGE)
|
||||
end
|
||||
|
||||
serialized_products = ActiveModel::ArraySerializer.new(
|
||||
|
||||
@@ -12,7 +12,7 @@ module Api
|
||||
|
||||
if pagination_required?
|
||||
@pagy, orders = pagy(orders,
|
||||
items: params[:per_page] || default_per_page)
|
||||
limit: params[:per_page] || default_per_page)
|
||||
end
|
||||
|
||||
render json: {
|
||||
|
||||
@@ -78,7 +78,7 @@ module Api
|
||||
end
|
||||
|
||||
def render_paged_products(products, product_serializer = ::Api::Admin::ProductSerializer)
|
||||
@pagy, products = pagy(products, items: params[:per_page] || DEFAULT_PER_PAGE)
|
||||
@pagy, products = pagy(products, limit: params[:per_page] || DEFAULT_PER_PAGE)
|
||||
|
||||
serialized_products = ActiveModel::ArraySerializer.new(
|
||||
products,
|
||||
|
||||
@@ -17,7 +17,7 @@ module Spree
|
||||
|
||||
def index
|
||||
orders = SearchOrders.new(search_params, spree_current_user).orders
|
||||
@pagy, @orders = pagy(orders, items: params[:per_page] || 15)
|
||||
@pagy, @orders = pagy(orders, limit: params[:per_page] || 15)
|
||||
|
||||
update_search_results if searching?
|
||||
end
|
||||
|
||||
@@ -60,7 +60,7 @@ module Spree
|
||||
limit(params[:limit] || 100)
|
||||
else
|
||||
@search = Spree::User.ransack(params[:q])
|
||||
@pagy, @collection = pagy(@search.result, items: Spree::Config[:admin_products_per_page])
|
||||
@pagy, @collection = pagy(@search.result, limit: Spree::Config[:admin_products_per_page])
|
||||
@collection
|
||||
end
|
||||
end
|
||||
|
||||
@@ -15,7 +15,7 @@ module Spree
|
||||
params[:q] ||= {}
|
||||
params[:q][:s] ||= "name asc"
|
||||
@search = super.ransack(params[:q])
|
||||
@pagy, @zones = pagy(@search.result, items: Spree::Config[:orders_per_page])
|
||||
@pagy, @zones = pagy(@search.result, limit: Spree::Config[:orders_per_page])
|
||||
@zones
|
||||
end
|
||||
|
||||
|
||||
@@ -39,7 +39,6 @@ class ProductsRenderer
|
||||
else
|
||||
distributed_products.products_relation
|
||||
end
|
||||
|
||||
results = filter(results)
|
||||
# Scope results with variant_overrides
|
||||
paginate(results).each { |product| product_scoper.scope(product) }
|
||||
@@ -100,7 +99,7 @@ class ProductsRenderer
|
||||
_pagy, paginated_results = pagy_array(
|
||||
results,
|
||||
page: args[:page] || 1,
|
||||
items: args[:per_page] || DEFAULT_PER_PAGE
|
||||
limit: args[:per_page] || DEFAULT_PER_PAGE
|
||||
)
|
||||
|
||||
paginated_results
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
%form.with-dropdown
|
||||
= t(".pagination.per_page.show")
|
||||
= select_tag :per_page,
|
||||
options_for_select([15, 25, 50, 100].collect{|i| [t('.pagination.per_page.per_page', num: i), i]}, pagy&.items),
|
||||
options_for_select([15, 25, 50, 100].collect{|i| [t('.pagination.per_page.per_page', num: i), i]}, pagy&.limit),
|
||||
class: "no-input per-page",
|
||||
data: { controller: "tom-select search", action: "change->search#changePerPage", "tom-select-options-value": '{ "plugins": [] }'}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ require 'pagy/extras/arel'
|
||||
require 'pagy/extras/array'
|
||||
require 'pagy/extras/limit'
|
||||
require 'pagy/extras/overflow'
|
||||
require 'pagy/extras/size'
|
||||
|
||||
# Pagy Variables
|
||||
# See https://ddnexus.github.io/pagy/api/pagy#variables
|
||||
|
||||
Reference in New Issue
Block a user