User app updates

This commit is contained in:
2014-03-27 21:51:16 +01:00
parent 6af7dc74af
commit e179f6e582
37 changed files with 362 additions and 53 deletions
@@ -1,3 +1 @@
App.ActiveListRoute = Ember.Route.extend
model: ->
@controllerFor('application').get('list.orders')
App.ActiveListRoute = Ember.Route.extend {}
@@ -1,7 +1,7 @@
App.ApplicationRoute = Ember.Route.extend
setupController: (controller)->
#@controllerFor('product_orders').set 'model', @store.filter('product_order', (po)-> !po.get('order')) # does not work (yet)
@controllerFor('product_orders').set 'model', @store.filter('product_order', (po)-> !po.get('placed'))
@controllerFor('product_orders').set 'model', @store.filter('product_order', (po)-> !po.get('id'))
controller.secured ->
faye = new Faye.Client(event_host)
user_id = Qstorage.getItem('user_id')
@@ -9,7 +9,16 @@ App.ApplicationRoute = Ember.Route.extend
console.log e
@events[e.event].call(@) if @events[e.event]
@store.find('list', 'current').then (list)=>
#@store.find('list', 'current').deleteRecord() # gets not replaced, buty stays as dummy
# A list record with id current and with the content of the returned list is created
# at the moment remove the dummy list, this should be resolved by Ember eventually
if error_list = @store.all('list').findBy('id', 'current')
error_list.rollback()
error_list.transitionTo 'loaded.saved'
error_list.unloadRecord()
@set 'list', list
@controllerFor('active_list').set('model', list)
unauthorized: ->
Qstorage.setItem('auth_token', '')
@@ -0,0 +1,5 @@
App.ListRoute = Ember.Route.extend
model: (options)->
@store.find 'list', options.list_id
afterModel: (model)->
model.reload() unless model.is_extended_version()
@@ -0,0 +1,5 @@
App.ListsRoute = Ember.Route.extend
model: ->
@store.find 'list'
setupController: (controller, model)->
controller.set('alreadyLoaded', true)