Order product user spec green

This commit is contained in:
2014-06-25 17:23:43 +02:00
parent 58f0937570
commit 10bc926e87
10 changed files with 41 additions and 11 deletions
@@ -7,5 +7,5 @@ App.ActiveListController = Ember.ObjectController.extend
#@get('controllers.application.list')
#).property('controllers.application.list')
displayTotal: (-> @get('model.orders.length') and @get('model.orders.length') > 1 ).property('model.orders.length')
showTotal: (-> @get('model.orders.length') and @get('model.orders.length') > 1 ).property('model.orders.length')
list: (-> @get('controllers.application.list') ).property('controllers.application.list')
@@ -3,10 +3,7 @@ each user in list.users
if list.orders
.list-orders-container
each order in list.sorted_orders
.list-order-container class=order.state
= order.display
span.currency= currency order.total
span.created_at= time order.created_at
App.ListOrderView contentBinding="order"
if showTotal
.list-orders-total.total
= t 'total'
@@ -1,5 +1,5 @@
.row
h2=t 'models.list'
partial "list_content"
link-to 'lists'
link-to 'lists' class="button"
span Go to lists
@@ -0,0 +1,3 @@
= order.display
span.currency= currency order.total
span.created_at= time order.created_at
@@ -0,0 +1,17 @@
App.ListOrderView = Ember.View.extend
classNames: 'list-order-container'
classNameBindings: ['content.state', 'contentWrapClass']
templateName: 'list_order_row'
contentWrapClass: (-> "order-row-#{@get('content.id')}").property('content.id')
#click: ->
#if @route_param
#@get('controller').transitionToRoute(@route, @route_param)
#else
#@get('controller').transitionToRoute(@route)
#active: (->
#if @get('controller.currentPath') == @route then 'active' else ''
#).property('controller.currentPath')
#init: ->
#@templateName = "menu_item_#{@route}"
#@_super()
+1 -1
View File
@@ -3,7 +3,7 @@ module Users
def index
#lists = current_user.lists.include_relation(:supplier, :table)
lists = List.for_user(current_user, page: params[:page], per_page: 2).include_relation(:supplier, :table)
lists = List.for_user(current_user, page: params[:page], per_page: params[:per_page].presence || 25).include_relation(:supplier, :table)
#lists.include_relation(:supplier)
render json: lists, each_serializer: UserListSerializer, meta: {total_pages: lists.total_pages, page: lists.current_page} #, root: :lists
end