From 53e851de697d2e9bea010fd69e0a06146e07a2ab Mon Sep 17 00:00:00 2001 From: Rafael Martins Date: Mon, 20 Feb 2012 03:46:29 -0200 Subject: [PATCH] Fixes for search product view --- app/views/search/_product.rhtml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/app/views/search/_product.rhtml b/app/views/search/_product.rhtml index 71fb2c4..591ffa2 100644 --- a/app/views/search/_product.rhtml +++ b/app/views/search/_product.rhtml @@ -21,18 +21,29 @@ <% if product.inputs.count > product.inputs.collect(&:is_from_solidarity_economy).count(nil) %> <% se_i = t_i = 0 %> <% product.inputs.each{ |i| t_i += 1; se_i += 1 if i.is_from_solidarity_economy } %> - <% p = case (se_i.to_f/t_i)*100 when 0..24.999 then ["0", _("0%")]; when 25..49.999 then ["25", _("25%")]; when 50..74.999 then ["50", _("50%")]; when 75..100 then ["75", _("100%")]; end %> + <% p = case (se_i.to_f/t_i)*100 + when 0..24.999 then ["0", _("")]; + when 25..49.999 then ["0", _("25%")]; + when 50..74.999 then ["25", _("50%")]; + when 75..99.999 then ["50", _("75%")]; + when 100 then ["75", _("100%")]; + end %>
<%= p[1] %>
<% end %> - <% if product.inputs.count == product.inputs.collect(&:has_price_details?).count(true) %> + <% if product.price_described? %> <% title = product.inputs.map{ |i| '
' + '
' + i.product_category.name + '
' + price_span(i.price_per_unit*i.amount_used, :class => 'search-product-input-price') + '
' }.join('') %> + <% title += product.price_details.map{ |p| + '
' + + '
' + p.production_cost.name + '
' + + price_span(p.price, :class => 'search-product-input-price') + + '
' }.join('') %> <%= link_to_function _("Open Price"), '', :title => title, :class => "search-product-price-details" %> <% end %> -- libgit2 0.21.2