Remove list.showTotal duplication
This commit is contained in:
@@ -2,10 +2,4 @@ App.ActiveListController = Ember.ObjectController.extend
|
||||
#orders: (->
|
||||
#@get('list.orders')
|
||||
#).property('list.orders')
|
||||
|
||||
#list: (->
|
||||
#@get('controllers.application.list')
|
||||
#).property('controllers.application.list')
|
||||
|
||||
showTotal: (-> @get('model.orders.length') and @get('model.orders.length') > 1 ).property('model.orders.length')
|
||||
list: (-> @get('controllers.application.list') ).property('controllers.application.list')
|
||||
|
||||
@@ -91,7 +91,6 @@ App.ApplicationController = Ember.Controller.extend
|
||||
if error_list = @store.all('list').findBy('id', 'current')
|
||||
error_list.eraseRecord()
|
||||
@set 'list', list
|
||||
@controllerFor('active_list').set('model', list)
|
||||
if list.get('join_requests.length')
|
||||
@transitionToRoute 'join_requests'
|
||||
else if @currentRouteName is 'index'
|
||||
|
||||
@@ -1,5 +1,2 @@
|
||||
App.ListController = Ember.ObjectController.extend
|
||||
list: (-> @get('model')).property('model')
|
||||
showTotal: (->
|
||||
if @get('list.orders.length') && @get('list.orders.length') > 1 then true else false
|
||||
).property('list.orders.length')
|
||||
|
||||
@@ -26,3 +26,7 @@ App.List = DS.Model.extend
|
||||
@get('relevant_orders').getEach('total').reduce(((sum, total) -> sum + total), 0)
|
||||
).property('relevant_orders.@each.total')
|
||||
active: (-> @get('state') is 'active' ).property('state')
|
||||
|
||||
showTotal: (->
|
||||
if @get('orders.length') && @get('orders.length') > 1 then true else false
|
||||
).property('orders.length')
|
||||
|
||||
@@ -17,7 +17,7 @@ if list.orders.isLoaded
|
||||
if list.sorted_orders
|
||||
.list-orders-container
|
||||
each order in list.sorted_orders: = view "list-order" contentBinding="order"
|
||||
if showTotal
|
||||
if list.showTotal
|
||||
.list-orders-total.total
|
||||
= t 'total'
|
||||
span.currency= currency list.total
|
||||
|
||||
Reference in New Issue
Block a user