diff --git a/backend/app/assets/javascripts/admin/variant_autocomplete.js.erb b/backend/app/assets/javascripts/admin/variant_autocomplete.js.erb index cc90f21c709..c222a490966 100644 --- a/backend/app/assets/javascripts/admin/variant_autocomplete.js.erb +++ b/backend/app/assets/javascripts/admin/variant_autocomplete.js.erb @@ -54,14 +54,15 @@ $(document).ready(function() { //handle delete click $('a.delete-item').click(function(){ - var del = $(this); - var shipment_number = del.data('shipment-number'); - var variant_id = del.data('variant-id'); + if (confirm(Spree.translations.are_you_sure_delete)) { + var del = $(this); + var shipment_number = del.data('shipment-number'); + var variant_id = del.data('variant-id'); - toggleItemEdit(); - - adjustItems(shipment_number, variant_id, 0); + toggleItemEdit(); + adjustItems(shipment_number, variant_id, 0); + } }); } }); diff --git a/backend/app/views/spree/admin/orders/_shipment_manifest.html.erb b/backend/app/views/spree/admin/orders/_shipment_manifest.html.erb index 33c0a43908b..7c1ba03123a 100644 --- a/backend/app/views/spree/admin/orders/_shipment_manifest.html.erb +++ b/backend/app/views/spree/admin/orders/_shipment_manifest.html.erb @@ -25,7 +25,7 @@ <%= link_to '', '#', :class => 'cancel-item icon_link icon-cancel no-text with-tip', :data => {:action => 'cancel'}, :title => Spree.t('actions.cancel'), :style => 'display: none' %> <%= link_to '', '#', :class => 'edit-item icon_link icon-edit no-text with-tip', :data => {:action => 'edit'}, :title => Spree.t('edit') %> <%= link_to '', '#', :class => 'split-item icon_link icon-resize-horizontal no-text with-tip', :data => {:action => 'split', 'variant-id' => item.variant.id}, :title => Spree.t('split') %> - <%= link_to '', '#', :class => 'delete-item icon-trash no-text with-tip', :data => { :confirm => Spree.t(:are_you_sure), 'shipment-number' => shipment.number, 'variant-id' => item.variant.id, :action => 'remove'}, :title => Spree.t('delete') %> + <%= link_to '', '#', :class => 'delete-item icon-trash no-text with-tip', :data => { 'shipment-number' => shipment.number, 'variant-id' => item.variant.id, :action => 'remove'}, :title => Spree.t('delete') %> <% end %> <% end %> diff --git a/backend/spec/features/admin/orders/order_details_spec.rb b/backend/spec/features/admin/orders/order_details_spec.rb index 4d51053ef91..33fa109d28d 100644 --- a/backend/spec/features/admin/orders/order_details_spec.rb +++ b/backend/spec/features/admin/orders/order_details_spec.rb @@ -60,6 +60,19 @@ page.should_not have_content("spree t-shirt") end + # Regression test for #3862 + it "can remove an item from a shipment" do + page.should have_content("spree t-shirt") + + within_row(1) do + click_icon :trash + end + + # Click "cancel" on confirmation dialog + page.driver.browser.switch_to.alert.dismiss + page.should have_content("spree t-shirt") + end + it "can add tracking information" do within("table.index tr:nth-child(5)") do click_icon :edit