Commit 53e851de697d2e9bea010fd69e0a06146e07a2ab

Authored by Rafael Martins
1 parent e61cd6ee

Fixes for search product view

* Tree symbols fixed
* "Open price" balloon not showing correctly
Showing 1 changed file with 13 additions and 2 deletions   Show diff stats
app/views/search/_product.rhtml
... ... @@ -21,18 +21,29 @@
21 21 <% if product.inputs.count > product.inputs.collect(&:is_from_solidarity_economy).count(nil) %>
22 22 <% se_i = t_i = 0 %>
23 23 <% product.inputs.each{ |i| t_i += 1; se_i += 1 if i.is_from_solidarity_economy } %>
24   - <% 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 %>
  24 + <% p = case (se_i.to_f/t_i)*100
  25 + when 0..24.999 then ["0", _("")];
  26 + when 25..49.999 then ["0", _("25%")];
  27 + when 50..74.999 then ["25", _("50%")];
  28 + when 75..99.999 then ["50", _("75%")];
  29 + when 100 then ["75", _("100%")];
  30 + end %>
25 31 <div class="search-product-percentage-from-solidarity-economy search-product-ecosol-percentage-icon-<%=p[0]%>" title="<%=_('Percentage of inputs from solidarity economy')%>">
26 32 <%= p[1] %>
27 33 </div>
28 34 <% end %>
29 35  
30   - <% if product.inputs.count == product.inputs.collect(&:has_price_details?).count(true) %>
  36 + <% if product.price_described? %>
31 37 <% title = product.inputs.map{ |i|
32 38 '<div class="search-product-input-dots-to-price">' +
33 39 '<div class="search-product-input-name">' + i.product_category.name + '</div>' +
34 40 price_span(i.price_per_unit*i.amount_used, :class => 'search-product-input-price') +
35 41 '</div>' }.join('') %>
  42 + <% title += product.price_details.map{ |p|
  43 + '<div class="search-product-input-dots-to-price">' +
  44 + '<div class="search-product-input-name">' + p.production_cost.name + '</div>' +
  45 + price_span(p.price, :class => 'search-product-input-price') +
  46 + '</div>' }.join('') %>
36 47 <%= link_to_function _("Open Price"), '', :title => title, :class => "search-product-price-details" %>
37 48 <% end %>
38 49 </div>
... ...