Replace disable-dynamically angular directive

This commit is contained in:
Cillian O'Ruanaidh
2025-08-22 14:20:14 +01:00
committed by Filipe
parent 23c9410a25
commit 32e3fc0175
2 changed files with 2 additions and 16 deletions

View File

@@ -1,14 +0,0 @@
# Allows disabling of link buttons via disabled attribute.
# This is normally ignored, ie the link appears disabled but is still clickable.
angular.module('Darkswarm').directive "disableDynamically", ->
restrict: 'A'
link: (scope, element, attrs) ->
element.on 'click', (e) ->
if attrs.disabled
e.preventDefault()
return
scope.$on "$destroy", ->
element.off("click")

View File

@@ -1,5 +1,5 @@
.row.links
%a.continue-shopping.button.secondary{href: current_shop_products_path, "ng-disabled" => "#{@insufficient_stock_lines.any?}", "disable-dynamically" => true}
%a.continue-shopping.button.secondary{ @insufficient_stock_lines.any? ? { disabled: "disabled" } : { href: current_shop_products_path } }
= t :orders_edit_continue
%a#checkout-link.button.primary.right{href: main_app.checkout_path, "ng-disabled" => "#{@insufficient_stock_lines.any?}", "disable-dynamically" => true}
%a#checkout-link.button.primary.right{ @insufficient_stock_lines.any? ? { disabled: "disabled" } : { href: main_app.checkout_path } }
= t :orders_edit_checkout