diff --git a/app/views/admin/product_import/_save_results.html.haml b/app/views/admin/product_import/_save_results.html.haml index 9ab9652ac1..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 + '?latest_import=true', ng: {show: 'updates.products_created > 0 || updates.products_updated > 0'}} - = t('admin.product_import.save.view_products') + %a.button.view{href: admin_products_path, ng: {show: 'updates.products_created > 0 || updates.products_updated > 0'}} + = t('.view_products') %a.button{href: main_app.admin_product_import_path} - = t('admin.back') + = t('.import_again') diff --git a/app/views/admin/product_import/save.html.haml b/app/views/admin/product_import/save.html.haml deleted file mode 100644 index 4d88bef979..0000000000 --- a/app/views/admin/product_import/save.html.haml +++ /dev/null @@ -1,63 +0,0 @@ -- content_for :page_title do - #{t('admin.product_import.title')} - -= render partial: 'spree/admin/shared/product_sub_menu' - -%h5= t('admin.product_import.save.final_results') -%br - -%div.post-save-results{ng: {app: 'admin.productImport'}} - - - if @importer.products_created_count > 0 - %p - %i.fa{ng: {class: "{'fa-info-circle': #{@importer.products_created_count} == 0, 'fa-check-circle': #{@importer.products_created_count} != 0}"}} - %strong.created-count= @importer.products_created_count - = t('admin.product_import.save.products_created') - - - if @importer.products_updated_count > 0 - %p - %i.fa{ng: {class: "{'fa-info-circle': #{@importer.products_updated_count} == 0, 'fa-check-circle': #{@importer.products_updated_count} != 0}"}} - %strong.updated-count= @importer.products_updated_count - = t('admin.product_import.save.products_updated') - - - if @importer.inventory_created_count > 0 - %p - %i.fa{ng: {class: "{'fa-info-circle': #{@importer.inventory_created_count} == 0, 'fa-check-circle': #{@importer.inventory_created_count} != 0}"}} - %strong.inv-created-count= @importer.inventory_created_count - = t('admin.product_import.save.inventory_created') - - - if @importer.inventory_updated_count > 0 - %p - %i.fa{ng: {class: "{'fa-info-circle': #{@importer.inventory_updated_count} == 0, 'fa-check-circle': #{@importer.inventory_updated_count} != 0}"}} - %strong.inv-updated-count= @importer.inventory_updated_count - = t('admin.product_import.save.inventory_updated') - - - if @importer.products_reset_count > 0 - %p - %i.fa.fa-info-circle - %strong.reset-count= @importer.products_reset_count - - if @import_into == 'inventories' - = t('admin.product_import.save.inventory_reset') - - else - = t('admin.product_import.save.products_reset') - - %br - - - if @importer.errors.count == 0 - %p= t('admin.product_import.save.all_saved', { num: "#{@importer.total_saved_count}" }) - - else - %p= t('admin.product_import.save.total_saved', { num: "#{@importer.total_saved_count}" }) - %br - %h5= t('admin.product_import.save.save_errors') - - @importer.errors.full_messages.each do |error| - %p.save-error -  -  #{error} - - %br - - if @importer.total_saved_count > 0 - - if @import_into == 'inventories' - %a.button{href: main_app.admin_inventory_path}= t('admin.product_import.save.view_inventory') - - else - %a.button{href: admin_products_path + '?latest_import=true'}= t('admin.product_import.save.view_products') - - %a.button{href: main_app.admin_product_import_path}= t('admin.back') diff --git a/config/locales/en.yml b/config/locales/en.yml index c3f51fd2f5..9ffd7894f1 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -516,7 +516,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 @@ -527,8 +527,9 @@ en: all_saved: "All items saved successfully" some_saved: "items saved successfully" save_errors: Save errors - view_products: View Products - view_inventory: View Inventory + import_again: Upload Another File + view_products: Go To Products Page + view_inventory: Go To Inventory Page variant_overrides: loading_flash: diff --git a/spec/features/admin/product_import_spec.rb b/spec/features/admin/product_import_spec.rb index 5e3feac8d9..25a4431187 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 '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? } @@ -171,7 +171,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 'View Products' + click_link I18n.t('admin.product_import.save_results.view_products') wait_until { page.find("#p_#{carrots.id}").present? } @@ -277,7 +277,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 '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 @@ -381,6 +381,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