mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-26 05:55:15 +00:00
Variable Weights: Adding ability to update the weight/volume of a line_item after checkout. The price of the line_item is automatically updated to reflect the value of the new weight.
This commit is contained in:
@@ -8,7 +8,9 @@ angular.module("ofn.admin").directive "ofnLineItemUpdAttr", [
|
||||
scope.$watch ->
|
||||
scope.$eval(attrs.ngModel)
|
||||
, (value) ->
|
||||
if ngModel.$dirty
|
||||
#if ngModel.$dirty
|
||||
# i think i can take this out, this directive is still only called
|
||||
# on a change and only an updated value will create a db call.
|
||||
if value == element.dbValue
|
||||
pendingChanges.remove(scope.line_item.id, attrName)
|
||||
switchClass( element, "", ["update-pending", "update-error", "update-success"], false )
|
||||
@@ -20,4 +22,4 @@ angular.module("ofn.admin").directive "ofnLineItemUpdAttr", [
|
||||
url: "/api/orders/#{scope.line_item.order.number}/line_items/#{scope.line_item.id}?line_item[#{attrName}]=#{value}"
|
||||
pendingChanges.add(scope.line_item.id, attrName, changeObj)
|
||||
switchClass( element, "update-pending", ["update-error", "update-success"], false )
|
||||
]
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user