Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Add missing pagination to menus.

Matthew Kennedy09939382fb69
diff --git a/backend/app/controllers/spree/admin/menus_controller.rb b/backend/app/controllers/spree/admin/menus_controller.rb
index c7223ffebd..8da0abf808 100644
--- a/backend/app/controllers/spree/admin/menus_controller.rb
+++ b/backend/app/controllers/spree/admin/menus_controller.rb
@@ -12,7 +12,8 @@ module Spree
@collection = super
@search = @collection.ransack(params[:q])
- @collection = @search.result.page(params[:page]).per(params[:per_page])
+ @collection = @search.result.page(params[:page]).
+ per(params[:per_page] || Spree::Backend::Config[:menus_per_page])
end
def location_after_save
diff --git a/backend/app/models/spree/backend_configuration.rb b/backend/app/models/spree/backend_configuration.rb
index 258ae1686a..a95c6aa11a 100644
--- a/backend/app/models/spree/backend_configuration.rb
+++ b/backend/app/models/spree/backend_configuration.rb
@@ -2,6 +2,7 @@ module Spree
class BackendConfiguration < Preferences::Configuration
preference :locale, :string, default: Rails.application.config.i18n.default_locale
preference :variants_per_page, :integer, default: Kaminari.config.default_per_page
+ preference :menus_per_page, :integer, default: Kaminari.config.default_per_page
ORDER_TABS ||= [:orders, :payments, :creditcard_payments,
:shipments, :credit_cards, :return_authorizations,
diff --git a/backend/app/views/spree/admin/menus/index.html.erb b/backend/app/views/spree/admin/menus/index.html.erb
index 9a5d9f27be..8595819379 100644
--- a/backend/app/views/spree/admin/menus/index.html.erb
+++ b/backend/app/views/spree/admin/menus/index.html.erb
@@ -94,6 +94,7 @@
</tbody>
</table>
</div>
+<%= render 'spree/admin/shared/index_table_options', collection: @menus, simple: true %>
<% else %>
<div class="alert alert-info no-objects-found">
<%= Spree.t('admin.navigation.you_have_no_menus') %>