Commit c3a2bee33987ea1e6b0def4ce43f84300f403f3a
1 parent
c4582941
Exists in
master
and in
29 other branches
Small fixes
Showing
7 changed files
with
7 additions
and
29 deletions
Show diff stats
app/helpers/search_helper.rb
@@ -70,7 +70,7 @@ module SearchHelper | @@ -70,7 +70,7 @@ module SearchHelper | ||
70 | if display?(asset, display) | 70 | if display?(asset, display) |
71 | display | 71 | display |
72 | else | 72 | else |
73 | - item.default_search_display | 73 | + item.class.default_search_display |
74 | end | 74 | end |
75 | end | 75 | end |
76 | 76 | ||
@@ -88,6 +88,7 @@ module SearchHelper | @@ -88,6 +88,7 @@ module SearchHelper | ||
88 | end | 88 | end |
89 | 89 | ||
90 | def display_selector(asset, display, float = 'right') | 90 | def display_selector(asset, display, float = 'right') |
91 | + display ||= asset_class(asset).default_search_display | ||
91 | if [display?(asset, :map), display?(asset, :compact), display?(asset, :full)].select {|option| option}.count > 1 | 92 | if [display?(asset, :map), display?(asset, :compact), display?(asset, :full)].select {|option| option}.count > 1 |
92 | compact_link = display?(asset, :compact) ? (display == 'compact' ? _('Compact') : link_to(_('Compact'), params.merge(:display => 'compact'))) : nil | 93 | compact_link = display?(asset, :compact) ? (display == 'compact' ? _('Compact') : link_to(_('Compact'), params.merge(:display => 'compact'))) : nil |
93 | map_link = display?(asset, :map) ? (display == 'map' ? _('Map') : link_to(_('Map'), params.merge(:display => 'map'))) : nil | 94 | map_link = display?(asset, :map) ? (display == 'map' ? _('Map') : link_to(_('Map'), params.merge(:display => 'map'))) : nil |
app/models/article.rb
app/models/product.rb
@@ -11,7 +11,7 @@ class Product < ActiveRecord::Base | @@ -11,7 +11,7 @@ class Product < ActiveRecord::Base | ||
11 | 11 | ||
12 | SEARCH_DISPLAYS = %w[map full] | 12 | SEARCH_DISPLAYS = %w[map full] |
13 | 13 | ||
14 | - def default_search_display | 14 | + def self.default_search_display |
15 | 'full' | 15 | 'full' |
16 | end | 16 | end |
17 | 17 |
app/models/profile.rb
@@ -15,7 +15,7 @@ class Profile < ActiveRecord::Base | @@ -15,7 +15,7 @@ class Profile < ActiveRecord::Base | ||
15 | 15 | ||
16 | SEARCH_DISPLAYS = %w[compact] | 16 | SEARCH_DISPLAYS = %w[compact] |
17 | 17 | ||
18 | - def default_search_display | 18 | + def self.default_search_display |
19 | 'compact' | 19 | 'compact' |
20 | end | 20 | end |
21 | 21 |
app/views/search/category_index.rhtml
@@ -4,8 +4,7 @@ | @@ -4,8 +4,7 @@ | ||
4 | <div id="category-image"><%= image_tag(@category.image.public_filename(:thumb), :id => 'category-image') if @category.image %></div> | 4 | <div id="category-image"><%= image_tag(@category.image.public_filename(:thumb), :id => 'category-image') if @category.image %></div> |
5 | <% end %> | 5 | <% end %> |
6 | 6 | ||
7 | - <%= search_page_title(_('Search Results'), @category) %> | ||
8 | - <%= render :partial => 'search_form', :locals => { :hint => '' } %> | 7 | + <h1><%= _("Category Index") %></h1> |
9 | <%= category_context(@category, params) %> | 8 | <%= category_context(@category, params) %> |
10 | <%= display_results @searches %> | 9 | <%= display_results @searches %> |
11 | 10 |
plugins/solr/controllers/public/solr_plugin_public_controller.rb
@@ -1,22 +0,0 @@ | @@ -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,7 +23,7 @@ | ||
23 | 23 | ||
24 | <% if facet_count > less_options_limit %> | 24 | <% if facet_count > less_options_limit %> |
25 | <%= link_to_function _("Options"), | 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 | "jQuery(this).toggleClass('facet-less-options')", :class => "facet-options-toggle" %> | 27 | "jQuery(this).toggleClass('facet-less-options')", :class => "facet-options-toggle" %> |
28 | <br /> | 28 | <br /> |
29 | <% end %> | 29 | <% end %> |