mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-13 04:00:21 +00:00
Merge branch 'master' of github.com:eaterprises/openfoodweb
This commit is contained in:
@@ -9,5 +9,7 @@
|
||||
//= require store/spree_core
|
||||
//= require store/spree_auth
|
||||
//= require store/spree_promo
|
||||
//= require shared/angular
|
||||
//= require shared/angular-resource
|
||||
|
||||
//= require_tree .
|
||||
|
||||
18
app/assets/javascripts/store/controllers/cart.js.coffee
Normal file
18
app/assets/javascripts/store/controllers/cart.js.coffee
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict'
|
||||
|
||||
angular.module('store', ['ngResource']).
|
||||
controller 'CartCtrl', ($scope, $window, CartFactory) ->
|
||||
|
||||
$scope.loadCart = ->
|
||||
$scope.cart = CartFactory.load(1)
|
||||
|
||||
$scope.addVariant = (variant, quantity) ->
|
||||
|
||||
.config(['$httpProvider', ($httpProvider) ->
|
||||
$httpProvider.defaults.headers.common['X-CSRF-Token'] = $('meta[name=csrf-token]').attr('content')
|
||||
])
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
12
app/assets/javascripts/store/factories/cart.js.coffee
Normal file
12
app/assets/javascripts/store/factories/cart.js.coffee
Normal file
@@ -0,0 +1,12 @@
|
||||
'use strict'
|
||||
|
||||
angular.module('store').
|
||||
factory 'CartFactory', ($resource, $window, $http) ->
|
||||
Cart = $resource '/open_food_web/cart/:cart_id.json', {},
|
||||
{ 'show': { method: 'GET'} }
|
||||
|
||||
load: (id, callback) ->
|
||||
Cart.show {cart_id: id}, (cart) ->
|
||||
callback(cart)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user