Major supplier refactor making the whole system work better
This commit is contained in:
@@ -1,17 +1,20 @@
|
||||
Qsupplier.App.ApplicationRoute = Ember.Route.extend
|
||||
beforeModel: ->
|
||||
# Preload only active lists and orders
|
||||
@store.find 'product_category'
|
||||
@supplier = @store.push 'supplier', supplier_object
|
||||
@product_categories = @store.find 'product_category'
|
||||
@sections = @store.find 'section'
|
||||
Ember.RSVP.all([@product_categories, @sections]).then (results)=>
|
||||
@store.find('list', state: 'active').then (lists) -> lists.invoke('get', 'table')
|
||||
@lists = @store.all 'list'
|
||||
# product_categories = controller.set 'product_categories', @store.all('product_category')
|
||||
#@store.find 'order', state: 'active' included in list
|
||||
setupController: (controller)->
|
||||
controller.set 'supplier', @supplier
|
||||
# @set 'supplier', @store.find('supplier', supplier_id)
|
||||
supplier = @store.push 'supplier', supplier_object
|
||||
controller.set 'supplier', supplier
|
||||
controller.set 'sections', @sections
|
||||
controller.set 'product_categories', @product_categories
|
||||
|
||||
@store.find 'list', state: 'active'
|
||||
@store.find 'section'
|
||||
|
||||
controller.set 'product_categories', @store.all('product_category')
|
||||
actions:
|
||||
openModal: (modalName, model, options={})->
|
||||
controller_name = options.controller || modalName
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
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.all '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')
|
||||
# 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.all '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')
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
Qsupplier.App.SectionRoute = Ember.Route.extend
|
||||
model: (params) -> @store.findById 'section', params.section_id
|
||||
renderTemplate: ->
|
||||
@render 'section'
|
||||
|
||||
Reference in New Issue
Block a user