User app refactor

This commit is contained in:
2014-08-28 14:53:24 +02:00
parent 0dcbc4151c
commit 40d06156fa
13 changed files with 26 additions and 20 deletions
@@ -1,4 +1 @@
App.ListsIndexController = Ember.ArrayController.extend App.PaginationModule,
actions:
showList: (list)->
@transitionToRoute 'list', list
App.ListsIndexController = Ember.ArrayController.extend App.PaginationModule
@@ -4,7 +4,6 @@ App.List = DS.Model.extend
needs_help: attr('boolean')
needs_payment: attr('boolean')
user_requests_closing: attr('boolean')
supplier_name: attr('string')
state: attr('string')
price: attr('number')
closed_at: DS.attr('date')
@@ -24,3 +23,4 @@ App.List = DS.Model.extend
total: (->
@get('relevant_orders').getEach('total').reduce(((sum, total) -> sum + total), 0)
).property('relevant_orders.@each.total')
active: (-> @get('state') is 'active' ).property('state')
@@ -8,6 +8,7 @@ App.Supplier= DS.Model.extend
orders: DS.hasMany('order')
product_categories: DS.hasMany('product_category')
lists: DS.hasMany('list')
is_extended_version: ->
@get('extended_version')
@@ -16,5 +17,3 @@ App.Supplier= DS.Model.extend
return false unless @get('open')
true
).property('open')
@@ -1,11 +1,6 @@
.row
h2=t 'models.plural.list'
each list in controller
.lists-overview-entry{action "showList" list}
span.created_at=time list.created_at
span.price.currency= currency list.price
span.name= list.supplier_name
hr
each list in controller: App.ListIndexView contentBinding='list'
.clearfix
if hasMore
button{action "showMore"}=t 'lists.show_more'
@@ -0,0 +1,3 @@
span.created_at=time list.created_at
span.price.currency= currency list.price
span.name= list.supplier.name
@@ -0,0 +1,5 @@
App.ListIndexView = Ember.View.extend
templateName: 'lists/list_entry'
classNames: ['lists-overview-entry']
classNameBindings: ['content.active:active']
click: -> @get('controller').transitionToRoute 'list', @get('content')