Commit 2dbfdebd24b4f145619c80949432db8fe0f8e625

Authored by Victor Costa
1 parent b140da91

rails3: update views of search controller

app/views/search/_article.html.erb
... ... @@ -1,12 +0,0 @@
1   -<li class="search-article-item article-item">
2   - <%= link_to(article.title, article.url, :class => "search-result-title") %>
3   - <div class="search-content-first-column">
4   - <%= render :partial => 'image', :object => article %>
5   - </div>
6   - <table class="noborder search-content-second-column">
7   - <%= render :partial => 'article_common', :object => article %>
8   - </table>
9   - <%= render :partial => 'article_last_change', :object => article %>
10   -
11   - <div style="clear:both"></div>
12   -</li>
app/views/search/_blog.html.erb
... ... @@ -1,24 +0,0 @@
1   -<li class="search-blog article-item">
2   - <%= link_to blog.title, blog.view_url, :class => 'search-result-title' %>
3   - <div class="search-content-first-column">
4   - <%= render :partial => 'image', :object => blog %>
5   - </div>
6   - <table class="noborder search-content-second-column">
7   - <tr class="search-blog-items">
8   - <td class="search-field-label"><%= _("Last posts") %></td>
9   -
10   - <% r = blog.children.find(:all, :order => :updated_at, :conditions => ['type != ?', 'RssFeed']).last(3) %>
11   - <td class="<%= "search-field-none" if r.empty? %>">
12   - <% r.each do |a| %>
13   - <%= link_to a.title, a.view_url, :class => 'search-blog-sample-item '+icon_for_article(a) %>
14   - <% end %>
15   - <%= _('None') if r.empty? %>
16   - </td>
17   - </tr>
18   -
19   - <%= render :partial => 'article_common', :object => blog %>
20   - </table>
21   - <%= render :partial => 'article_last_change', :object => blog %>
22   -
23   - <div style="clear: both;"/></div>
24   -</li>
app/views/search/_content.html.erb
... ... @@ -1 +0,0 @@
1   -_article.rhtml
2 0 \ No newline at end of file
app/views/search/_event.html.erb
... ... @@ -1,25 +0,0 @@
1   -<li class="search-event-item article-item">
2   -<%= link_to(event.title, event.url, :class => "search-result-title") %>
3   -<div class="search-content-first-column">
4   - <%= render :partial => 'image', :object => event %>
5   -</div>
6   -<table class="noborder search-content-second-column">
7   - <% if event.start_date %>
8   - <tr class="search-article-event-date">
9   - <td class="search-field-label"><%= _('Start date') %></td>
10   - <td class="article-item-date"><%= event.start_date %></td>
11   - </tr>
12   - <% end %>
13   - <% if event.end_date %>
14   - <tr class="search-article-event-date">
15   - <td class="search-field-label"><%= _('End date') %></td>
16   - <td class="article-item-date"><%= event.end_date %></td>
17   - </tr>
18   - <% end %>
19   -
20   - <%= render :partial => 'article_common', :object => event %>
21   -</table>
22   -<%= render :partial => 'article_last_change', :object => event %>
23   -
24   -<div style="clear: both"></div>
25   -</li>
app/views/search/_facets_menu.html.erb
... ... @@ -1,36 +0,0 @@
1   -<% less_options_limit = 8 %>
2   -
3   -<div id="facets-menu">
4   - <% @asset_class.map_facets_for(environment).each do |facet| %>
5   -
6   - <div id="facet-menu-<%= facet[:id].to_s %>" class="facet-menu">
7   - <div class="facet-menu-label">
8   - <%= @asset_class.facet_label(facet) %>
9   - </div>
10   -
11   - <% results = @asset_class.map_facet_results(facet, params[:facet], @facets, @all_facets, :limit => less_options_limit) %>
12   - <% facet_count = results.total_entries %>
13   -
14   - <% if facet_count > 0 %>
15   - <div class="facet-menu-options facet-menu-more-options" style="display: none">
16   - </div>
17   -
18   - <div class="facet-menu-options facet-menu-less-options">
19   - <% results.each do |id, label, count| %>
20   - <%= facet_link_html(facet, params, id, label, count) %><br />
21   - <% end %>
22   - </div> <br />
23   -
24   - <% if facet_count > less_options_limit %>
25   - <%= link_to_function _("Options"),
26   - "facet_options_toggle('#{facet[:id].to_s}', '#{url_for(params.merge(:action => 'facets_browse', :facet_id => facet[:id], :asset => @asset, :escape => false))}'); " +
27   - "jQuery(this).toggleClass('facet-less-options')", :class => "facet-options-toggle" %>
28   - <br />
29   - <% end %>
30   -
31   - <% else %>
32   - <span class="facet-any-result-found"><%= _("No filter available") %></span>
33   - <% end %>
34   - </div>
35   - <% end %>
36   -</div>
app/views/search/_facets_unselect_menu.html.erb
... ... @@ -1,6 +0,0 @@
1   -<div class="facets-applied">
2   - <% if params[:facet] and params[:facet].count > 0 %>
3   - <span class="facets-applied-label"><%= _("Applied filters") %> </span>
4   - <%= facet_selecteds_html_for(environment, asset_class(@asset), params) %>
5   - <% end %>
6   -</div>
app/views/search/_folder.html.erb
... ... @@ -1,24 +0,0 @@
1   -<li class="search-folder-item article-item">
2   - <%= link_to folder.title, folder.view_url, :class => 'search-result-title' %>
3   - <div class="search-content-first-column">
4   - <%= render :partial => 'image', :object => folder %>
5   - </div>
6   - <table class="noborder search-content-second-column">
7   - <tr class="search-folder-items">
8   - <td class="search-field-label"><%= _("Last items") %></td>
9   -
10   - <% r = folder.children.last(3) %>
11   - <td class="<%= "search-field-none" if r.empty? %>">
12   - <% r.each do |a| %>
13   - <%= link_to a.title, a.view_url, :class => 'search-folder-sample-item '+icon_for_article(a) %>
14   - <% end %>
15   - <%= _('None') if r.empty? %>
16   - </td>
17   - </tr>
18   -
19   - <%= render :partial => 'article_common', :object => folder %>
20   - </table>
21   - <%= render :partial => 'article_last_change', :object => folder %>
22   -
23   - <div style="clear:both"></div>
24   -</li>
app/views/search/_forum.html.erb
... ... @@ -1,24 +0,0 @@
1   -<li class="search-forum-item article-item">
2   - <%= link_to forum.title, forum.view_url, :class => 'search-result-title' %>
3   - <div class="search-content-first-column">
4   - <%= render :partial => 'image', :object => forum %>
5   - </div>
6   - <table class="noborder search-content-second-column">
7   - <tr class="search-forum-items">
8   - <td class="search-field-label"><%= _("Last topics") %></td>
9   -
10   - <% r = forum.children.find(:all, :order => :updated_at, :conditions => ['type != ?', 'RssFeed']).last(3) %>
11   - <td class="<%= "search-field-none" if r.empty? %>">
12   - <% r.each do |a| %>
13   - <%= link_to a.title, a.view_url, :class => 'search-forum-sample-item '+icon_for_article(a) %>
14   - <% end %>
15   - <%= _('None') if r.empty? %>
16   - </td>
17   - </tr>
18   -
19   - <%= render :partial => 'article_common', :object => forum %>
20   - </table>
21   - <%= render :partial => 'article_last_change', :object => forum %>
22   -
23   - <div style="clear:both"></div>
24   -</li>
app/views/search/_gallery.html.erb
... ... @@ -1,13 +0,0 @@
1   -<li class="search-gallery article-item">
2   - <%= link_to gallery.title, gallery.view_url, :class => 'search-result-title' %>
3   - <div class="search-content-first-column">
4   - <%= render :partial => 'image', :object => gallery %>
5   - </div>
6   - <table class="noborder search-content-second-column">
7   - <%= render :partial => 'article_common', :object => gallery %>
8   - </table>
9   - <%= render :partial => 'article_last_change', :object => gallery %>
10   -
11   - <div style="clear: both"></div>
12   -</li>
13   -
app/views/search/_product.html.erb
... ... @@ -1,85 +0,0 @@
1   -<% extra_content = @plugins.dispatch(:asset_product_extras, product, product.enterprise).collect { |content| instance_eval(&content) } %>
2   -<% extra_properties = @plugins.dispatch(:asset_product_properties, product)%>
3   -
4   -<li class="search-product-item">
5   -
6   - <div class="search-product-item-first-column">
7   - <%= render :partial => 'search/image', :object => product %>
8   -
9   - <% if product.available %>
10   - <% if product.price && product.price > 0 %>
11   - <% has_discount = product.discount && product.discount > 0 %>
12   - <% if product.price %>
13   - <span class="search-product-price-textid"><%=_("from") if has_discount %></span><%= price_span(product.price, :class => "search-product-price " + (has_discount ? 'with-discount' : '')) %>
14   - <% if has_discount %>
15   - <span class="search-product-price-textid"><%=_("by")%></span><%= price_span(product.price_with_discount, :class => "search-product-price") %>
16   - <% end %>
17   - <% if product.unit %>
18   - <span class="search-product-unit">&nbsp;<%= _('/') %>&nbsp;<%= product.unit.name %></span>
19   - <% end %>
20   - <% end %>
21   - <div class="search-product-inputs-info">
22   - <% if p = product.percentage_from_solidarity_economy %>
23   - <div class="search-product-percentage-from-solidarity-economy search-product-ecosol-percentage-icon-<%= p[0].to_s %>"
24   - title="<%=_('Percentage of inputs from solidarity economy')%>">
25   - <%= p[1] %>
26   - </div>
27   - <% end %>
28   -
29   - <% if product.price_described? %>
30   - <% title = (product.inputs.relevant_to_price + product.price_details).map{ |i|
31   - '<div class="search-product-input-dots-to-price">' +
32   - '<div class="search-product-input-name">' + i.name + '</div>' +
33   - price_span(i.price, :class => 'search-product-input-price') +
34   - '</div>' }.join('') %>
35   - <%= link_to_function _("Open Price"), '', :title => title, :class => "search-product-price-details" %>
36   - <% end %>
37   - </div>
38   - <% end %>
39   - <% else %>
40   - <span class="product-not-available"><%= _('Not available') %></div>
41   - <% end %>
42   -
43   - </div>
44   - <div class="search-product-item-second-column">
45   - <%= link_to_product product, :class => 'search-result-title' %>
46   - <div class="search-product-supplier">
47   - <span class="search-field-label"><%= _('Supplier') %> </span><%= link_to_homepage(product.enterprise.name, product.enterprise.identifier) %>
48   - </div>
49   - <div class="search-product-description">
50   - <% if product.description %>
51   - <% desc_stripped = strip_tags(product.description) %>
52   - <span class="search-field-label"><%= _('Description') %> </span><%= excerpt(desc_stripped, desc_stripped.first(3), 300) %>
53   - <% end %>
54   - </div>
55   - </div>
56   - <div class="search-product-item-third-column">
57   - <div class="search-product-region">
58   - <% if product.enterprise.region %>
59   - <span class="search-field-label"><%= _('City') %></span>
60   - <br /><%= city_with_state(product.enterprise.region) %>
61   - <% end %>
62   - </div>
63   - <div class="search-product-qualifiers">
64   - <% if product.product_qualifiers.count > 0 %>
65   - <span class="search-field-label"><%= _('Qualifiers') %></span>
66   - <% product.product_qualifiers.each do |pq| %>
67   - <% if pq.qualifier %>
68   - <span class="search-product-qualifier"><%= pq.qualifier.name + (pq.certifier.nil? ? _(";") : '') %></span>
69   - <% end %>
70   - <% if pq.certifier %>
71   - <span class="search-product-certifier">&nbsp;<%= _('cert. ') + pq.certifier.name + _(";") %></span>
72   - <% end %>
73   - <% end %>
74   - <% end %>
75   - </div>
76   - </div>
77   -
78   - <div style="clear: both"></div>
79   -
80   - <%= extra_content.join('\n') %>
81   - <% extra_properties.each do |property| %>
82   - <div><%= property[:name] + ': ' + instance_eval(&property[:content]) %></div>
83   - <% end %>
84   -
85   -</li>
app/views/search/_profile.html.erb
... ... @@ -1,42 +0,0 @@
1   -<li class="search-profile-item">
2   -<% if @empty_query or multiple_search? or !profile.enterprise? %>
3   - <%= profile_image_link profile, :portrait, 'div',
4   - @filter == 'more_recent' ? profile.send(@filter + '_label') + show_date(profile.created_at) : profile.send(@filter + '_label') %>
5   -<% else %>
6   - <div class="search-enterprise-item">
7   - <div class="search-enterprise-item-column-left">
8   - <%= profile_image_link profile, :portrait, 'div' %>
9   - </div>
10   - <div class="search-enterprise-item-column-right">
11   - <%= link_to_homepage(profile.name, profile.identifier, :class => "search-result-title") %>
12   - <div class="search-enterprise-description">
13   - <% if profile.description %>
14   - <% body_stripped = strip_tags(profile.description) %>
15   - <% elsif profile.home_page and profile.home_page.body %>
16   - <% body_stripped = strip_tags(profile.home_page.body) %>
17   - <% end %>
18   - <%= excerpt(body_stripped, body_stripped.first(3), 200) if body_stripped %>
19   - </div>
20   - <div class="search-enterprise-region">
21   - <span class="search-enterprise-region-label"><%= _("City") %></span>
22   - <% if profile.region %>
23   - <span class="search-enterprise-region-name"><%= city_with_state(profile.region) %></span>
24   - <% end %>
25   - </div>
26   -
27   - <div class="search-enterprise-categorization">
28   - <% profile.top_level_categorization.each do |parent, children| %>
29   - <div class="search-enterprise-category-<%=parent.id%> search-enterprise-category">
30   - <span class="search-enterprise-categorization-parent"><%= parent.name %></span>
31   - <span class="search-enterprise-categorization-children">
32   - <%= children.collect(&:name).join(', ') %>
33   - </span>
34   - </div>
35   - <% end %>
36   - </div>
37   - </div>
38   -
39   - <hr class="clearfix" />
40   - </div>
41   -<% end %>
42   -</li>
app/views/search/_sellers_form.html.erb
... ... @@ -4,7 +4,7 @@
4 4  
5 5 <div class="search-in-opt"><%= _('Search in:') %>
6 6 <dir>
7   - <%= labelled_radio_button _('Enterprises'), 'asset', 'enterprises', true %><br />
  7 + <%= labelled_radio_button __('Enterprises'), 'asset', 'enterprises', true %><br />
8 8 <%= labelled_radio_button _('Products'), 'asset', 'products', false %>
9 9 </dir>
10 10 </div>
... ...
app/views/search/_text_article.html.erb
... ... @@ -1,13 +0,0 @@
1   -<li class="search-text-article-item article-item">
2   - <%= link_to(text_article.title, text_article.url, :class => "search-result-title") %>
3   -
4   - <div class="search-content-first-column">
5   - <%= render :partial => 'image', :object => text_article %>
6   - </div>
7   - <table class="noborder search-content-second-column">
8   - <%= render :partial => 'article_common', :object => text_article %>
9   - </table>
10   - <%= render :partial => 'article_last_change', :object => text_article %>
11   -
12   - <div style="clear: both"></div>
13   -</li>
app/views/search/_uploaded_file.html.erb
... ... @@ -1,25 +0,0 @@
1   -<li class="search-uploaded-file-item article-item">
2   - <%= link_to uploaded_file.filename, uploaded_file.view_url, :class => 'search-result-title' %>
3   -
4   - <div class="search-content-first-column">
5   - <%= render :partial => 'image', :object => uploaded_file %>
6   - </div>
7   -
8   - <table class="noborder search-content-second-column">
9   - <%= render :partial => 'article_author', :object => uploaded_file %>
10   - <%= render :partial => 'article_description', :object => uploaded_file %>
11   -
12   - <% if uploaded_file.parent and uploaded_file.parent.published? %>
13   - <tr class="search-uploaded-file-parent">
14   - <td class="search-field-label"><%= uploaded_file.parent.gallery? ? _("Gallery") : _("Folder") %></td>
15   - <td><%= link_to uploaded_file.parent.name, uploaded_file.parent.url %></td>
16   - </tr>
17   - <% end %>
18   -
19   - <%= render :partial => 'article_tags', :object => uploaded_file.tags %>
20   - <%= render :partial => 'article_categories', :object => uploaded_file.categories %>
21   - </table>
22   - <%= render :partial => 'article_last_change', :object => uploaded_file %>
23   -
24   - <div style="clear:both"></div>
25   -</li>
app/views/search/articles.html.erb
... ... @@ -1,17 +0,0 @@
1   -<%= search_page_title( @titles[:articles], @category ) %>
2   -
3   -<div id="search-column-left">
4   - <% if !@empty_query %>
5   - <%= facets_menu(:articles, @facets) %>
6   - <% end %>
7   -</div>
8   -
9   -<div id="search-column-right">
10   - <%= render :partial => 'search_form', :locals => { :hint => _('Type the title, author or content desired') } %>
11   - <%= render :partial => 'results_header' %>
12   -
13   - <%= display_results %>
14   - <%= pagination_links @results[:articles] %>
15   -</div>
16   -
17   -<div style="clear: both"></div>
app/views/search/articles.html.erb 0 → 120000
... ... @@ -0,0 +1 @@
  1 +search_page.html.erb
0 2 \ No newline at end of file
... ...
app/views/search/communities.html.erb
... ... @@ -1,25 +0,0 @@
1   -<%= search_page_title( @titles[:communities], @category ) %>
2   -
3   -<div id='search-column-left'>
4   - <% if logged_in? %>
5   - <% button_bar do %>
6   - <%# FIXME shouldn't the user create the community in the current environment instead of going to its home environment? %>
7   - <%= button(:add, _('New community'), user.url.merge(:controller => 'memberships', :action => 'new_community', :profile => user.identifier)) %>
8   - <% end %>
9   - <% end %>
10   -
11   - <% if !@empty_query %>
12   - <%= facets_menu(:communities, @facets) %>
13   - <% end %>
14   -</div>
15   -
16   -<div id='search-column-right'>
17   - <%= render :partial => 'search_form', :locals => { :hint => _("Type words about the community you're looking for") } %>
18   - <%= render :partial => 'results_header' %>
19   -
20   - <%= display_results %>
21   - <%= pagination_links @results.values.first %>
22   -</div>
23   -
24   -<div style="clear: both"></div>
25   -
app/views/search/communities.html.erb 0 → 120000
... ... @@ -0,0 +1 @@
  1 +search_page.html.erb
0 2 \ No newline at end of file
... ...
app/views/search/contents.html.erb
... ... @@ -1 +0,0 @@
1   -articles.rhtml
2 0 \ No newline at end of file
app/views/search/enterprises.html.erb
... ... @@ -1,28 +0,0 @@
1   -<%= search_page_title( @titles[:enterprises], @category ) %>
2   -
3   -<div id="search-column-left">
4   - <% if logged_in? && environment.enabled?('enterprise_registration') %>
5   - <% button_bar do %>
6   - <%= button(:add, _('New enterprise'), {:controller => 'enterprise_registration'}) %>
7   - <% end %>
8   - <% end %>
9   -
10   - <% if !@empty_query %>
11   - <% button_bar do %>
12   - <%= display_map_list_button %>
13   - <% end %>
14   - <%= facets_menu(:enterprises, @facets) %>
15   - <% end %>
16   -</div>
17   -
18   -<div id="search-column-right">
19   - <%= render :partial => 'search_form', :locals => { :hint => _("Type words about the enterprise you're looking for") } %>
20   - <%= render :partial => 'results_header' %>
21   -
22   - <%= display_results(true) %>
23   - <% if params[:display] != 'map' %>
24   - <%= pagination_links @results[:enterprises] %>
25   - <% end %>
26   -</div>
27   -
28   -<div style="clear: both"></div>
app/views/search/enterprises.html.erb 0 → 120000
... ... @@ -0,0 +1 @@
  1 +search_page.html.erb
0 2 \ No newline at end of file
... ...
app/views/search/events.html.erb
1   -<%= search_page_title( Environment.default.name + "'s " + @titles[:events], @category ) %>
2   -
  1 +<%= search_page_title( Environment.default.name + "'s " + _('Events'), @category ) %>
3 2 <%= render :partial => 'events/agenda' %>
... ...
app/views/search/facets_browse.html.erb
... ... @@ -1,8 +0,0 @@
1   -<% results = @asset_class.map_facet_results(@facet, params[:facet], @facets, @all_facets) %>
2   -
3   -<% array = [] %>
4   -<% @asset_class.facet_result_sort(@facet, results, :alphabetically).each do |id, label, count| %>
5   - <% array << {:id => id, :name => facet_link_html(@facet, params.merge(:controller => 'search', :action => @asset), id, label, count)} %>
6   -<% end %>
7   -
8   -<%= facet_javascript('facet-input-'+@facet[:id].to_s, @facet, array) %>
app/views/search/people.html.erb
... ... @@ -1,19 +0,0 @@
1   -<%= search_page_title( @titles[:people], @category ) %>
2   -
3   -<div id='search-column-left'>
4   - <% if !@empty_query %>
5   - <%= facets_menu(:people, @facets) %>
6   - <% end %>
7   -</div>
8   -
9   -<div id='search-column-right'>
10   - <%= render :partial => 'search_form', :locals => { :hint => _("Type words about the person you're looking for") } %>
11   - <%= render :partial => 'results_header' %>
12   -
13   - <%= display_results %>
14   - <% if params[:display] != 'map' %>
15   - <%= pagination_links @results.values.first %>
16   - <% end %>
17   -</div>
18   -
19   -<div style="clear: both"></div>
app/views/search/people.html.erb 0 → 120000
... ... @@ -0,0 +1 @@
  1 +search_page.html.erb
0 2 \ No newline at end of file
... ...
app/views/search/products.html.erb
... ... @@ -1,26 +0,0 @@
1   -<%= search_page_title( @titles[:products], @category ) %>
2   -
3   -<div id="search-column-left">
4   - <% if !@empty_query %>
5   - <% button_bar do %>
6   - <%= display_map_list_button %>
7   -<% end %>
8   - <%= facets_menu(:products, @facets) %>
9   -<% end %>
10   -</div>
11   -
12   -<div id="search-column-right">
13   - <%= render :partial => 'search_form', :locals => { :hint => _('Type the product, service, city or qualifier desired') } %>
14   - <%= render :partial => 'results_header' %>
15   -
16   - <%= display_results(true) %>
17   - <% if !@one_page and params[:display] != 'map' %>
18   - <%= pagination_links @results[:products] %>
19   -<% end %>
20   -</div>
21   -
22   -<% javascript_tag do %>
23   - jQuery('.search-product-price-details').altBeautify();
24   -<% end %>
25   -
26   -<div style="clear: both"></div>
app/views/search/products.html.erb 0 → 120000
... ... @@ -0,0 +1 @@
  1 +search_page.html.erb
0 2 \ No newline at end of file
... ...