_full_product.rhtml
3.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<% extra_content = @plugins.dispatch(:asset_product_extras, product).collect { |content| instance_eval(&content) } %>
<% extra_properties = @plugins.dispatch(:asset_product_properties, product)%>
<li class="search-product-item <%= 'highlighted' if product.highlighted? %>">
<div class="search-product-item-first-column">
<%= render :partial => 'search/image', :object => product %>
<% if product.available %>
<% if product.price && product.price > 0 %>
<% has_discount = product.discount && product.discount > 0 %>
<% if product.price %>
<span class="search-product-price-textid"><%=_("from") if has_discount %></span><%= price_span(product.price, :class => "search-product-price " + (has_discount ? 'with-discount' : '')) %>
<% if has_discount %>
<span class="search-product-price-textid"><%=_("by")%></span><%= price_span(product.price_with_discount, :class => "search-product-price") %>
<% end %>
<% if product.unit %>
<span class="search-product-unit"> <%= _('/') %> <%= product.unit.name %></span>
<% end %>
<% end %>
<div class="search-product-inputs-info">
<% if p = product.percentage_from_solidarity_economy %>
<div class="search-product-percentage-from-solidarity-economy search-product-ecosol-percentage-icon-<%= p[0].to_s %>"
title="<%=_('Percentage of inputs from solidarity economy')%>">
<%= p[1] %>
</div>
<% end %>
<% if product.price_described? %>
<% title = (product.inputs.relevant_to_price + product.price_details).map{ |i|
'<div class="search-product-input-dots-to-price">' +
'<div class="search-product-input-name">' + i.name + '</div>' +
price_span(i.price, :class => 'search-product-input-price') +
'</div>' }.join('') %>
<%= link_to_function _("Open Price"), '', :title => title, :class => "search-product-price-details" %>
<% end %>
</div>
<% end %>
<% else %>
<span class="product-not-available"><%= _('Not available') %></div>
<% end %>
</div>
<div class="search-product-item-second-column">
<%= link_to_product product, :class => 'search-result-title' %>
<div class="search-product-supplier">
<span class="search-field-label"><%= _('Supplier') %> </span><%= link_to_homepage(product.enterprise.name, product.enterprise.identifier) %>
</div>
<div class="search-product-description">
<% if product.description %>
<% desc_stripped = strip_tags(product.description) %>
<span class="search-field-label"><%= _('Description') %> </span><%= excerpt(desc_stripped, desc_stripped.first(3), 300) %>
<% end %>
</div>
</div>
<div class="search-product-item-third-column">
<div class="search-product-region">
<% if product.enterprise.region %>
<span class="search-field-label"><%= _('City') %></span>
<br /><%= city_with_state(product.enterprise.region) %>
<% end %>
</div>
<div class="search-product-qualifiers">
<% if product.product_qualifiers.count > 0 %>
<span class="search-field-label"><%= _('Qualifiers') %></span>
<% product.product_qualifiers.each do |pq| %>
<% if pq.qualifier %>
<span class="search-product-qualifier"><%= pq.qualifier.name + (pq.certifier.nil? ? _(";") : '') %></span>
<% end %>
<% if pq.certifier %>
<span class="search-product-certifier"> <%= _('cert. ') + pq.certifier.name + _(";") %></span>
<% end %>
<% end %>
<% end %>
</div>
</div>
<div style="clear: both"></div>
<%= extra_content.join('\n') %>
<% extra_properties.each do |property| %>
<div><%= property[:name] + ': ' + instance_eval(&property[:content]) %></div>
<% end %>
</li>