Ask user to confirm cancellation of order

This commit is contained in:
Rob Harrington
2017-05-05 15:17:14 +10:00
parent 8c8b40c5a8
commit 08e391856c
4 changed files with 12 additions and 2 deletions

View File

@@ -0,0 +1,9 @@
Darkswarm.directive "confirmLinkClick", ($window) ->
restrict: 'A'
scope:
confirmMsg: '@confirmLinkClick'
link: (scope, elem, attr) ->
elem.bind 'click', (event) ->
unless confirm(scope.confirmMsg)
event.preventDefault()
event.stopPropagation()

View File

@@ -14,7 +14,7 @@
- if order.changes_allowed?
.columns.show-for-medium-up.medium-3  
.columns.small-12.medium-3
= link_to spree.cancel_order_path(@order), method: :put, :class => "button secondary expand" do
= link_to spree.cancel_order_path(@order), method: :put, :class => "button secondary expand", "confirm-link-click" => t('orders_confirm_cancel') do
%i.ofn-i_009-close
= t(:cancel_order)
.columns.small-12.medium-3

View File

@@ -20,4 +20,4 @@
%td.order6.text-right.show-for-large-up.brick
%a{"ng-href" => "{{::order.path}}" }= t('.edit')
%td.order7.text-right
= link_to t('.cancel'), "", method: :put, "ng-href" => "{{::order.cancel_path}}"
= link_to t('.cancel'), "", method: :put, "ng-href" => "{{::order.cancel_path}}", "confirm-link-click" => t('orders_confirm_cancel')

View File

@@ -1066,6 +1066,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using
other: "%{count} additional items already confirmed for this order cycle"
orders_bought_edit_button: Edit confirmed items
orders_bought_already_confirmed: "* already confirmed"
orders_confirm_cancel: Are you sure you want to cancel this order?
products_cart_distributor_choice: "Distributor for your order:"
products_cart_distributor_change: "Your distributor for this order will be changed to %{name} if you add this product to your cart."