From 06cbc120f5a1f60791a7eb688a4afa46f5ed84ad Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Bellet Date: Fri, 3 Feb 2023 11:37:51 +0100 Subject: [PATCH] Pagination is actually linked to line_items and not orders We display line_items as rows in BOM --- .../line_items/controllers/line_items_controller.js.coffee | 2 +- app/views/admin/shared/_angular_per_page_controls.html.haml | 6 +++--- app/views/spree/admin/orders/bulk_management.html.haml | 2 +- config/locales/en.yml | 4 ++++ 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/admin/line_items/controllers/line_items_controller.js.coffee b/app/assets/javascripts/admin/line_items/controllers/line_items_controller.js.coffee index ccb424dcb1..022e6be244 100644 --- a/app/assets/javascripts/admin/line_items/controllers/line_items_controller.js.coffee +++ b/app/assets/javascripts/admin/line_items/controllers/line_items_controller.js.coffee @@ -9,7 +9,7 @@ angular.module("admin.lineItems").controller 'LineItemsCtrl', ($scope, $timeout, $scope.sharedResource = false $scope.columns = Columns.columns $scope.sorting = SortOptions - $scope.pagination = Orders.pagination + $scope.pagination = LineItems.pagination $scope.per_page_options = [ {id: 15, name: t('js.admin.orders.index.per_page', results: 15)}, {id: 50, name: t('js.admin.orders.index.per_page', results: 50)}, diff --git a/app/views/admin/shared/_angular_per_page_controls.html.haml b/app/views/admin/shared/_angular_per_page_controls.html.haml index fbde2d5f06..999178a78d 100644 --- a/app/views/admin/shared/_angular_per_page_controls.html.haml +++ b/app/views/admin/shared/_angular_per_page_controls.html.haml @@ -1,7 +1,7 @@ - position ||= "" -.per-page{'ng-show' => '!RequestMonitor.loading && orders.length > 0', class: ("right" if position == "right") } +.per-page{'ng-show' => '!RequestMonitor.loading && line_items.length > 0', class: ("right" if position == "right") } %input.per-page-select.ofn-select2{type: 'number', data: 'per_page_options', 'min-search' => 999, 'ng-model' => 'per_page', 'ng-change' => 'fetchResults()'} %span.per-page-feedback - {{ 'spree.admin.orders.index.results_found' | t:{number: pagination.results} }} - {{ 'spree.admin.orders.index.viewing' | t:{start: ((pagination.page -1) * pagination.per_page) +1, end: ((pagination.page -1) * pagination.per_page) + orders.length} }} + {{ 'spree.admin.line_items.index.results_found' | t:{number: pagination.results} }} + {{ 'spree.admin.orders.index.viewing' | t:{start: ((pagination.page -1) * pagination.per_page) +1, end: ((pagination.page -1) * pagination.per_page) + line_items.length} }} diff --git a/app/views/spree/admin/orders/bulk_management.html.haml b/app/views/spree/admin/orders/bulk_management.html.haml index f00cc8af93..433260f22e 100644 --- a/app/views/spree/admin/orders/bulk_management.html.haml +++ b/app/views/spree/admin/orders/bulk_management.html.haml @@ -190,7 +190,7 @@ %td.actions %a{ 'ng-click' => "deleteLineItem(line_item)", :class => "delete-line-item icon-trash no-text" } - %div{'ng-show' => "!RequestMonitor.loading && orders.length > 0" } + %div{'ng-show' => "!RequestMonitor.loading && line_items.length > 0" } = render partial: 'admin/shared/angular_pagination' = render 'spree/admin/shared/custom-confirm' diff --git a/config/locales/en.yml b/config/locales/en.yml index 36d2525de7..019042608e 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -3897,6 +3897,10 @@ See the %{link} to find out more about %{sitename}'s features and to start using authorized: "Authorized" received: "Received" canceled: "Canceled" + line_items: + index: + results_found: "%{number} Results found." + viewing: "Viewing %{start} to %{end}." orders: add_product: cannot_add_item_to_canceled_order: "Cannot add item to canceled order"