Qwaiter supplier on Ember 1.0

This commit is contained in:
2013-09-30 17:49:22 +02:00
parent 6d7647c2c5
commit 8ea2e79dc2
44 changed files with 378 additions and 156 deletions
@@ -1,11 +1,20 @@
Qsupplier.App.IndexRoute = Ember.Route.extend
model: ->
model: (params, queryParams)->
# Preload only active lists and orders
@store.find 'list', state: 'active'
@store.find 'order', state: 'active'
Ember.Object.create
lists: Qsupplier.App.List.find({state: 'active'})
orders: Qsupplier.App.Order.find()
# Find with condition does not work since the resulting array promise is not updated for newly created records
#lists: Qsupplier.App.List.find({state: 'active'})
#orders: Qsupplier.App.Order.find({state: 'active'})
#lists: @store.filter 'list', (l)-> l.get('state') == 'active' # DOES NOT WORK!!!! (yet)
# use filter to create a scope on all the records
lists: Qsupplier.App.List.filter -> true
orders: Qsupplier.App.Order.filter -> true
setupController: (controller, model)->
controller.set('model', model)
$('#section_selector').on 'change', (-> controller.set('sectionId', $(this).val()))
#controller.set 'lists', @store.all('list')
#controller.set 'lists', Qsupplier.App.List.all() #.filterProperty('state', 'active')
#controller.set 'orders', Qsupplier.App.Order.all()
#controller.set 'lists', model.get('lists')