From 086c5ab2647bc54f96140428e120b53e98d72f3f Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Tue, 17 Aug 2021 12:32:02 +0100 Subject: [PATCH] Replace directive with data-confirm --- .../darkswarm/directives/confirm_link_click.js.coffee | 9 --------- app/views/spree/orders/form/_update_buttons.html.haml | 2 +- app/views/spree/users/_open_orders.html.haml | 2 +- 3 files changed, 2 insertions(+), 11 deletions(-) delete mode 100644 app/assets/javascripts/darkswarm/directives/confirm_link_click.js.coffee diff --git a/app/assets/javascripts/darkswarm/directives/confirm_link_click.js.coffee b/app/assets/javascripts/darkswarm/directives/confirm_link_click.js.coffee deleted file mode 100644 index c4a861fda6..0000000000 --- a/app/assets/javascripts/darkswarm/directives/confirm_link_click.js.coffee +++ /dev/null @@ -1,9 +0,0 @@ -angular.module('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() diff --git a/app/views/spree/orders/form/_update_buttons.html.haml b/app/views/spree/orders/form/_update_buttons.html.haml index 884cea6746..65e3e9cbf1 100644 --- a/app/views/spree/orders/form/_update_buttons.html.haml +++ b/app/views/spree/orders/form/_update_buttons.html.haml @@ -12,7 +12,7 @@ - if order.changes_allowed? .columns.show-for-medium-up.medium-3   .columns.small-12.medium-3 - = link_to main_app.cancel_order_path(@order), method: :put, :class => "button secondary expand", "confirm-link-click" => t('orders_confirm_cancel') do + = link_to main_app.cancel_order_path(@order), method: :put, class: "button secondary expand", "data-confirm": t('orders_confirm_cancel') do %i.ofn-i_009-close = t(:cancel_order) .columns.small-12.medium-3 diff --git a/app/views/spree/users/_open_orders.html.haml b/app/views/spree/users/_open_orders.html.haml index 73be12b346..45f1426cb3 100644 --- a/app/views/spree/users/_open_orders.html.haml +++ b/app/views/spree/users/_open_orders.html.haml @@ -21,4 +21,4 @@ %td.order6.text-right.brick %a{"ng-href" => "{{::order.path}}" }= t('.edit') %td.order7.show-for-large-up.text-right - = link_to t('.cancel'), "", method: :put, "ng-href" => "{{::order.cancel_path}}", "confirm-link-click" => t('orders_confirm_cancel') + = link_to t('.cancel'), "", method: :put, "ng-href": "{{::order.cancel_path}}", "data-confirm": t('orders_confirm_cancel')