Working reloading of products, changing order cycles, sticky state

This commit is contained in:
Will Marshall
2013-12-11 13:36:12 +11:00
parent 04d8949177
commit 3903173848
5 changed files with 20 additions and 7 deletions

View File

@@ -1,9 +1,10 @@
Shop.factory 'OrderCycle', ($resource, Product) ->
new class OrderCycle
@order_cycle:
class OrderCycle
@order_cycle = {
order_cycle_id: null
}
set_order_cycle: (id = null)->
new $resource("/shop/order_cycle").save {order_cycle_id: id}, ->
@set_order_cycle: ->
new $resource("/shop/order_cycle").save {order_cycle_id: @order_cycle.order_cycle_id}, ->
Product.update()

View File

@@ -3,5 +3,7 @@ Shop.factory 'Product', ($resource) ->
@products: null
update: ->
@products = $resource("/shop/products").query()
console.log @products
@products
all: ->
@products || @update()

View File

@@ -1 +1,2 @@
window.Shop = angular.module("Shop", ["ngResource"])
window.Shop = angular.module("Shop", ["ngResource"]).config ($httpProvider) ->
$httpProvider.defaults.headers.post['X-CSRF-Token'] = $('meta[name="csrf-token"]').attr('content')