mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Adding confirm-link directive
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
# Used on a link to prevent link clicks unless a callback returns true (probably asking for user confirmation)
|
||||
angular.module("admin.lineItems").directive "confirmLinkClick", ->
|
||||
restrict: "A"
|
||||
scope:
|
||||
confirmLinkClick: "&"
|
||||
link: (scope, element, attrs) ->
|
||||
element.bind "click", (event) ->
|
||||
unless scope.confirmLinkClick()
|
||||
event.preventDefault()
|
||||
@@ -153,7 +153,7 @@
|
||||
%td.price{ 'ng-show' => 'columns.price.visible' }
|
||||
%input{ :type => 'text', :name => 'price', :id => 'price', :value => '{{ line_item.price * line_item.quantity | currency }}', 'ng-readonly' => "true", 'obj-for-update' => "line_item", "attr-for-update" => "price" }
|
||||
%td.actions
|
||||
%a{ :class => "edit-order icon-edit no-text", 'ofn-confirm-link-path' => "/admin/orders/{{line_item.order.number}}/edit" }
|
||||
%a{ href: "/admin/orders/{{line_item.order.number}}/edit", :class => "edit-order icon-edit no-text", 'confirm-link-click' => 'confirmRefresh()' }
|
||||
%td.actions
|
||||
%a{ 'ng-click' => "deleteLineItem(line_item)", :class => "delete-line-item icon-trash no-text" }
|
||||
%input{ :type => "button", 'value' => 'Update', 'ng-click' => 'submit()' }
|
||||
|
||||
Reference in New Issue
Block a user