From 49c6a22fde62fc5d869394911aa01f21a3ef8b5f Mon Sep 17 00:00:00 2001 From: cyrillefr Date: Thu, 11 Jul 2024 13:28:58 +0200 Subject: [PATCH] Replace product by variant to see producer name on views - replace product by variant since there had been changes in product & variant models. - add a line in spec to test producer name. --- app/views/admin/variant_overrides/_hidden_products.html.haml | 2 +- app/views/admin/variant_overrides/_new_products.html.haml | 2 +- spec/system/admin/variant_overrides_spec.rb | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/views/admin/variant_overrides/_hidden_products.html.haml b/app/views/admin/variant_overrides/_hidden_products.html.haml index 9871cdcb72..e7ae36ec81 100644 --- a/app/views/admin/variant_overrides/_hidden_products.html.haml +++ b/app/views/admin/variant_overrides/_hidden_products.html.haml @@ -12,7 +12,7 @@ %th.add=t('admin.variant_overrides.index.add') %tbody{ "ng-repeat": 'product in filteredProducts | limitTo:productLimit' } %tr{ id: "v_{{variant.id}}", "ng-repeat": 'variant in product.variants | inventoryVariants:hub_id:views' } - %td.producer{ "ng-bind": '::producersByID[product.producer_id].name' } + %td.producer{ "ng-bind": '::producersByID[variant.producer_id].name' } %td.product{ "ng-bind": '::product.name' } %td.variant %span{ "ng-bind": '::variant.display_name || ""' } diff --git a/app/views/admin/variant_overrides/_new_products.html.haml b/app/views/admin/variant_overrides/_new_products.html.haml index fb727c84e1..d800c51688 100644 --- a/app/views/admin/variant_overrides/_new_products.html.haml +++ b/app/views/admin/variant_overrides/_new_products.html.haml @@ -13,7 +13,7 @@ %th.hide=t('admin.variant_overrides.index.hide') %tbody{ "ng-repeat": 'product in filteredProducts | limitTo:productLimit' } %tr{ id: "v_{{variant.id}}", "ng-repeat": 'variant in product.variants | inventoryVariants:hub_id:views' } - %td.producer{ "ng-bind-html": '::producersByID[product.producer_id].name' } + %td.producer{ "ng-bind-html": '::producersByID[variant.producer_id].name' } %td.product{ "ng-bind": '::product.name' } %td.variant %span{ "ng-bind": '::variant.display_name || ""' } diff --git a/spec/system/admin/variant_overrides_spec.rb b/spec/system/admin/variant_overrides_spec.rb index 44937c3123..a121f1f707 100644 --- a/spec/system/admin/variant_overrides_spec.rb +++ b/spec/system/admin/variant_overrides_spec.rb @@ -547,6 +547,7 @@ RSpec.describe " visit admin_inventory_path expect(page).to have_text first_variant.name + expect(page).to have_text first_variant.supplier.name expect(page).to have_selector "tr.product", count: 10 expect(page).to have_button "Show more" expect(page).to have_button "Show all (91 More)"