From b37bea35fa211c49f1fa539b9d7150d137e98f9a Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Wed, 18 Jul 2018 11:43:31 +0100 Subject: [PATCH] Use relative translation keys --- .../product_import/_save_results.html.haml | 26 +++++++++---------- config/locales/en.yml | 2 +- spec/features/admin/product_import_spec.rb | 8 +++--- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/app/views/admin/product_import/_save_results.html.haml b/app/views/admin/product_import/_save_results.html.haml index 901bb466e1..90cf847468 100644 --- a/app/views/admin/product_import/_save_results.html.haml +++ b/app/views/admin/product_import/_save_results.html.haml @@ -1,5 +1,5 @@ -%h5= t('admin.product_import.save.final_results') +%h5= t('.final_results') %br %div.post-save-results @@ -8,45 +8,45 @@ %i.fa{ng: {class: "{'fa-info-circle': updates.products_created == 0, 'fa-check-circle': updates.products_created > 0}"}} %strong.created-count {{ updates.products_created }} - = t('admin.product_import.save.products_created') + = t('.products_created') %p{ng: {show: 'updates.products_updated'}} %i.fa{ng: {class: "{'fa-info-circle': updates.products_updated == 0, 'fa-check-circle': updates.products_updated > 0}"}} %strong.updated-count {{ updates.products_updated }} - = t('admin.product_import.save.products_updated') + = t('.products_updated') %p{ng: {show: 'updates.inventory_created'}} %i.fa{ng: {class: "{'fa-info-circle': updates.inventory_created == 0, 'fa-check-circle': updates.inventory_created > 0}"}} %strong.inv-created-count {{ updates.inventory_created }} - = t('admin.product_import.save.inventory_created') + = t('.inventory_created') %p{ng: {show: 'updates.inventory_updated'}} %i.fa{ng: {class: "{'fa-info-circle': updates.inventory_updated == 0, 'fa-check-circle': updates.inventory_updated > 0}"}} %strong.inv-updated-count {{ updates.inventory_updated }} - = t('admin.product_import.save.inventory_updated') + = t('.inventory_updated') %p{ng: {show: 'updates.products_reset'}} %i.fa.fa-info-circle %strong.reset-count {{ updates.products_reset }} - if @import_into == 'inventories' - = t('admin.product_import.save.inventory_reset') + = t('.inventory_reset') - else - = t('admin.product_import.save.products_reset') + = t('.products_reset') %br %p{ng: {show: 'update_errors.length == 0'}} - = t('admin.product_import.save.all_saved') + = t('.all_saved') %div{ng: {show: 'update_errors.length > 0'}} - %p {{ updated_total }} #{t('admin.product_import.save.some_saved')} + %p {{ updated_total }} #{t('.some_saved')} %br - %h5= t('admin.product_import.save.save_errors') + %h5= t('.save_errors') %p.save-error{ng: {repeat: 'error in update_errors'}}  -  {{ error }} @@ -54,10 +54,10 @@ %br %div{ng: {show: 'updated_total > 0'}} %a.button.view{href: main_app.admin_inventory_path, ng: {show: 'updates.inventory_created > 0 || updates.inventory_updated > 0'}} - = t('admin.product_import.save.view_inventory') + = t('.view_inventory') %a.button.view{href: admin_products_path, ng: {show: 'updates.products_created > 0 || updates.products_updated > 0'}} - = t('admin.product_import.save.view_products') + = t('.view_products') %a.button{href: main_app.admin_product_import_path} - = t('admin.product_import.save.import_again') + = t('.import_again') diff --git a/config/locales/en.yml b/config/locales/en.yml index ebe1c524bb..4c550c9d07 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -505,7 +505,7 @@ en: inventory_to_reset: Existing inventory items will have their stock reset to zero line: Line item_line: Item line - save: + save_results: final_results: Import final results products_created: Products created products_updated: Products updated diff --git a/spec/features/admin/product_import_spec.rb b/spec/features/admin/product_import_spec.rb index faedb012b7..4ea5076eac 100644 --- a/spec/features/admin/product_import_spec.rb +++ b/spec/features/admin/product_import_spec.rb @@ -72,7 +72,7 @@ feature "Product Import", js: true do wait_until { page.find("a.button.view").present? } - click_link I18n.t('admin.product_import.save.view_products') + click_link I18n.t('admin.product_import.save_results.view_products') expect(page).to have_content 'Bulk Edit Products' wait_until { page.find("#p_#{potatoes.id}").present? } @@ -174,7 +174,7 @@ feature "Product Import", js: true do potatoes = Spree::Product.find_by_name('Potatoes') expect(potatoes.variants.first.import_date).to be_within(1.minute).of Time.zone.now - click_link I18n.t('admin.product_import.save.view_products') + click_link I18n.t('admin.product_import.save_results.view_products') wait_until { page.find("#p_#{carrots.id}").present? } @@ -251,7 +251,7 @@ feature "Product Import", js: true do expect(Float(cabbage_override.price)).to eq 1.50 expect(cabbage_override.count_on_hand).to eq 2001 - click_link I18n.t('admin.product_import.save.view_inventory') + click_link I18n.t('admin.product_import.save_results.view_inventory') expect(page).to have_content 'Inventory' select enterprise2.name, from: "hub_id", visible: false @@ -437,6 +437,6 @@ feature "Product Import", js: true do wait_until { page.find("button.view_results:not([disabled='disabled'])").present? } find('button.view_results').trigger 'click' - expect(page).to have_content I18n.t('admin.product_import.save.final_results') + expect(page).to have_content I18n.t('admin.product_import.save_results.final_results') end end