Commit bde3015c4cda27739945130c6dec86435ee8ba37

Authored by MoisesMachado
1 parent edfa90a9

ActionItem507: added indication of what product category is being showed


git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@2134 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/views/search/_product_categories_menu.rhtml
1 1 <% if product_categories_menu %>
2   - <div id="product-categories-menu" class="product-search-filter">
3   - <ul>
4   - <% product_categories_menu.each do |cat, hits, childs| %>
5   - <li>
6   - <%= link_to (cat.name + "(#{hits})"), params.merge({:product_category => cat.id}) %>
7   - <% if !childs.blank? %>
8   - <ul>
9   - <% childs.each do |child, child_hits| %>
10   - <li> <%= link_to (child.name + "(#{child_hits})"), params.merge({:product_category => child.id}) %> </li>
11   - <% end %>
12   - </ul>
13   - <% end %>
14   - </li>
  2 +<div id="product-categories-menu" class="product-search-filter">
  3 +<ul>
  4 + <% product_categories_menu.each do |cat, hits, childs| %>
  5 + <li>
  6 + <%= link_to (cat.name + "(#{hits})"), params.merge({:product_category => cat.id}) %>
  7 + <% if !childs.blank? %>
  8 + <ul>
  9 + <% childs.each do |child, child_hits| %>
  10 + <li> <%= link_to (child.name + "(#{child_hits})"), params.merge({:product_category => child.id}) %> </li>
15 11 <% end %>
16   - </ul>
17   - </div>
  12 + </ul>
  13 + <% end %>
  14 + </li>
  15 + <% end %>
  16 +</ul>
  17 +</div>
18 18 <% end %>
19 19  
... ...
app/views/search/products.rhtml
... ... @@ -10,6 +10,12 @@
10 10 <h2><%=h (_('Within %s km from %s') % [@radius, @region.name]) %><h2>
11 11 <% end %>
12 12  
  13 +<% if @product_category %>
  14 + <h3>
  15 + <%= @product_category.hierarchy.map {|cat| ((cat == @product_category) ? cat.name : link_to((cat.name), params.merge({:product_category => cat.id}))) }.join(' &rarr; ') %>
  16 + </h3>
  17 +<% end %>
  18 +
13 19 <%= render :partial => 'search_form', :locals => { :form_title => _("Refine your search"), :simple_search => true } %>
14 20  
15 21 <%= render :partial => 'product_categories_menu', :object => @categories_menu %>
... ...