From 334862252d6bd3f71048b03b2bed0d8d335489ae Mon Sep 17 00:00:00 2001 From: Edwin Cruz Date: Thu, 30 Apr 2020 08:52:12 -0500 Subject: [PATCH] Adding missing paginator when listing all stock locations Current implementation only list all stock locations limited by the defaulted per page value, but there's no way to navigate to multiple pages. --- .../app/controllers/spree/admin/stock_locations_controller.rb | 4 ++++ backend/app/views/spree/admin/stock_locations/index.html.erb | 2 ++ 2 files changed, 6 insertions(+) diff --git a/backend/app/controllers/spree/admin/stock_locations_controller.rb b/backend/app/controllers/spree/admin/stock_locations_controller.rb index 907eb59d07a..740b422f8f2 100644 --- a/backend/app/controllers/spree/admin/stock_locations_controller.rb +++ b/backend/app/controllers/spree/admin/stock_locations_controller.rb @@ -13,6 +13,10 @@ def set_country flash[:error] = t('spree.stock_locations_need_a_default_country') redirect_to(admin_stock_locations_path) && return end + + def collection + super.page(params[:page]).per(Spree::Config[:admin_products_per_page]) + end end end end diff --git a/backend/app/views/spree/admin/stock_locations/index.html.erb b/backend/app/views/spree/admin/stock_locations/index.html.erb index 849d0b10d8c..f37e0749a98 100644 --- a/backend/app/views/spree/admin/stock_locations/index.html.erb +++ b/backend/app/views/spree/admin/stock_locations/index.html.erb @@ -16,6 +16,7 @@ <% end %> <% if @stock_locations.any? %> + <%= paginate @stock_locations, theme: "solidus_admin" %> @@ -69,6 +70,7 @@ <% end %>
+ <%= paginate @stock_locations, theme: "solidus_admin" %> <% else %>
<%= render 'spree/admin/shared/no_objects_found',