Commit c3a2bee33987ea1e6b0def4ce43f84300f403f3a

Authored by Rodrigo Souto
1 parent c4582941

Small fixes

app/helpers/search_helper.rb
... ... @@ -70,7 +70,7 @@ module SearchHelper
70 70 if display?(asset, display)
71 71 display
72 72 else
73   - item.default_search_display
  73 + item.class.default_search_display
74 74 end
75 75 end
76 76  
... ... @@ -88,6 +88,7 @@ module SearchHelper
88 88 end
89 89  
90 90 def display_selector(asset, display, float = 'right')
  91 + display ||= asset_class(asset).default_search_display
91 92 if [display?(asset, :map), display?(asset, :compact), display?(asset, :full)].select {|option| option}.count > 1
92 93 compact_link = display?(asset, :compact) ? (display == 'compact' ? _('Compact') : link_to(_('Compact'), params.merge(:display => 'compact'))) : nil
93 94 map_link = display?(asset, :map) ? (display == 'map' ? _('Map') : link_to(_('Map'), params.merge(:display => 'map'))) : nil
... ...
app/models/article.rb
... ... @@ -18,7 +18,7 @@ class Article < ActiveRecord::Base
18 18  
19 19 SEARCH_DISPLAYS = %w[full]
20 20  
21   - def default_search_display
  21 + def self.default_search_display
22 22 'full'
23 23 end
24 24  
... ...
app/models/product.rb
... ... @@ -11,7 +11,7 @@ class Product < ActiveRecord::Base
11 11  
12 12 SEARCH_DISPLAYS = %w[map full]
13 13  
14   - def default_search_display
  14 + def self.default_search_display
15 15 'full'
16 16 end
17 17  
... ...
app/models/profile.rb
... ... @@ -15,7 +15,7 @@ class Profile < ActiveRecord::Base
15 15  
16 16 SEARCH_DISPLAYS = %w[compact]
17 17  
18   - def default_search_display
  18 + def self.default_search_display
19 19 'compact'
20 20 end
21 21  
... ...
app/views/search/category_index.rhtml
... ... @@ -4,8 +4,7 @@
4 4 <div id="category-image"><%= image_tag(@category.image.public_filename(:thumb), :id => 'category-image') if @category.image %></div>
5 5 <% end %>
6 6  
7   - <%= search_page_title(_('Search Results'), @category) %>
8   - <%= render :partial => 'search_form', :locals => { :hint => '' } %>
  7 + <h1><%= _("Category Index") %></h1>
9 8 <%= category_context(@category, params) %>
10 9 <%= display_results @searches %>
11 10  
... ...
plugins/solr/controllers/public/solr_plugin_public_controller.rb
... ... @@ -1,22 +0,0 @@
1   -# TODO This controller was created to remove the solr dependencies from
2   -# noosfero controllers. All actions here might not be working as they're
3   -# supposed to. Everything here must be reviewed!
4   -
5   -class SolrPluginPublicController < MyProfileController
6   -
7   - include SolrPlugin::ResultsHelper
8   -
9   -
10   - def facets_browse
11   - @asset = params[:asset].to_sym
12   - @asset_class = asset_class(@asset)
13   -
14   - @facets_only = true
15   - send(@asset)
16   -
17   - @facet = @asset_class.map_facets_for(environment).find { |facet| facet[:id] == params[:facet_id] }
18   - raise 'Facet not found' if @facet.nil?
19   -
20   - render :layout => false
21   - end
22   -end
plugins/solr/views/search/_facets_menu.html.erb
... ... @@ -23,7 +23,7 @@
23 23  
24 24 <% if facet_count > less_options_limit %>
25 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))}'); " +
  26 + "facet_options_toggle('#{facet[:id].to_s}', '#{url_for(params.merge(:controller => 'solr_plugin_controller' :action => 'facets_browse', :facet_id => facet[:id], :asset => @asset, :escape => false))}'); " +
27 27 "jQuery(this).toggleClass('facet-less-options')", :class => "facet-options-toggle" %>
28 28 <br />
29 29 <% end %>
... ...