From adbe93f39e95f6e2dc0ecc7b7cb6e8b43394db79 Mon Sep 17 00:00:00 2001 From: benni Date: Mon, 13 Jun 2011 15:26:06 +0200 Subject: [PATCH] Fixed open_orders partial. --- app/models/order.rb | 2 +- app/views/home/index.html.haml | 2 +- app/views/shared/_open_orders.html.haml | 7 +++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/models/order.rb b/app/models/order.rb index 79a2596b..cee06608 100644 --- a/app/models/order.rb +++ b/app/models/order.rb @@ -82,7 +82,7 @@ class Order < ActiveRecord::Base def expired? !ends.nil? && ends < Time.now end - + # search GroupOrder of given Ordergroup def group_order(ordergroup) group_orders.first :conditions => { :ordergroup_id => ordergroup.id } diff --git a/app/views/home/index.html.haml b/app/views/home/index.html.haml index edbd6ba3..fa143804 100644 --- a/app/views/home/index.html.haml +++ b/app/views/home/index.html.haml @@ -29,7 +29,7 @@ - if current_user.ordergroup // Current orders - = render :partial => 'shared/open_orders' + = render :partial => 'shared/open_orders', :locals => {:ordergroup => current_user.ordergroup} // Stats - if current_user.ordergroup diff --git a/app/views/shared/_open_orders.html.haml b/app/views/shared/_open_orders.html.haml index 618bd1fc..d8be3ea2 100644 --- a/app/views/shared/_open_orders.html.haml +++ b/app/views/shared/_open_orders.html.haml @@ -15,13 +15,12 @@ %tr{:class => cycle('even', 'odd', :name => 'open_orders')} %td= link_to h(order.name), :controller => 'ordering', :action => 'order', :id => order %td=h format_time(order.ends) unless order.ends.nil? - - if group_order = order.group_order(@ordergroup) + - if group_order = order.group_order(ordergroup) - total += group_order.price - %td=h "#{group_order.updated_by.nick} (#{format_time(group_order.updated_on)})" + %td= "#{group_order.updated_by.nick} (#{format_time(group_order.updated_on)})" %td= number_to_currency(group_order.price) - else - %td - %td + %td{:colspan => 2} - if total > 0 %p Gesamtsumme: