Files
mozo-backend/app/assets/javascripts/supplier/app/routes/index_route.js.coffee
T

23 lines
1.2 KiB
CoffeeScript

Qsupplier.App.IndexRoute = Ember.Route.extend
model: (params, queryParams)->
Ember.Object.create
# 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: @store.filter 'list', -> true
lists: @store.all 'list'
# mayby @store.all 'list' will work better!!!! (2014-04-24 a more experienced benjamin :)
#orders: @store.filter 'order', -> true
orders: @store.all 'order'
sections: @store.find 'section'
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')
#controller.set 'orders', model.get('orders')