mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-04-04 07:09:14 +00:00
Working reloading of products, changing order cycles, sticky state
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
@@ -3,5 +3,7 @@ Shop.factory 'Product', ($resource) ->
|
||||
@products: null
|
||||
update: ->
|
||||
@products = $resource("/shop/products").query()
|
||||
console.log @products
|
||||
@products
|
||||
all: ->
|
||||
@products || @update()
|
||||
|
||||
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user