mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-09 23:06:06 +00:00
Update cart page links to be disabled when changes are required and form is unsaved
See: https://stackoverflow.com/questions/23425254/enable-disable-anchor-tags-using-angularjs
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
# Allows disabling of link buttons via disabled attribute.
|
||||
# This is normally ignored, ie the link appears disabled but is still clickable.
|
||||
|
||||
Darkswarm.directive "disableDynamically", ->
|
||||
restrict: 'A'
|
||||
|
||||
link: (scope, element, attrs) ->
|
||||
element.on 'click', (e) ->
|
||||
if attrs.disabled
|
||||
e.preventDefault()
|
||||
return
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
.row.links{'data-hook' => "cart_buttons"}
|
||||
%a.button.large.secondary{href: current_shop_products_path}
|
||||
%a.button.large.secondary{href: current_shop_products_path, "ng-disabled" => "#{@insufficient_stock_lines.any?}", "disable-dynamically" => true}
|
||||
= t :orders_edit_continue
|
||||
%a#checkout-link.button.large.primary.right{href: main_app.checkout_path}
|
||||
%a#checkout-link.button.large.primary.right{href: main_app.checkout_path, "ng-disabled" => "#{@insufficient_stock_lines.any?}", "disable-dynamically" => true}
|
||||
= t :orders_edit_checkout
|
||||
|
||||
Reference in New Issue
Block a user