mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-13 04:00:21 +00:00
Reworking the checkout into Darkswarm, patching up tests
This commit is contained in:
14
app/assets/javascripts/darkswarm/cart.js.coffee
Normal file
14
app/assets/javascripts/darkswarm/cart.js.coffee
Normal file
@@ -0,0 +1,14 @@
|
||||
window.Cart = angular.module("Cart", ["ngResource"]).config ($httpProvider) ->
|
||||
$httpProvider.defaults.headers.post['X-CSRF-Token'] = $('meta[name="csrf-token"]').attr('content')
|
||||
|
||||
|
||||
# TEMPORARILY handles the deletetion
|
||||
$ ->
|
||||
if ($ 'form#update-cart').is('*')
|
||||
($ 'form#update-cart a.delete').show().one 'click', ->
|
||||
($ this).parents('.line-item').first().find('input.line_item_quantity').val 0
|
||||
($ this).parents('form').first().submit()
|
||||
false
|
||||
|
||||
($ 'form#update-cart').submit ->
|
||||
($ 'form#update-cart #update-button').attr('disabled', true)
|
||||
Reference in New Issue
Block a user