diff --git a/app/views/search/_display_results.rhtml b/app/views/search/_display_results.rhtml index fb436c0..e3af92f 100644 --- a/app/views/search/_display_results.rhtml +++ b/app/views/search/_display_results.rhtml @@ -18,10 +18,19 @@ <%= @names[name] %> <% end %> - <%= link_to( results.respond_to?(:total_entries) ? _('see all (%d)') % results.total_entries : _('see all...'), - params.merge(:action => 'index', - :asset => name ), - :class => 'see-more' ) if @results.size > 1 %> + <%# FIXME: don't hardcode an asset like this %> + <% if name == :most_commented_articles %> + <%= link_to( results.respond_to?(:total_entries) ? _('see all (%d)') % results.total_entries : _('see all...'), + params.merge(:action => 'index', + :asset => 'articles' ), + :class => 'see-more' ) if @results.size > 1 %> + + <% else %> + <%= link_to( results.respond_to?(:total_entries) ? _('see all (%d)') % results.total_entries : _('see all...'), + params.merge(:action => 'index', + :asset => name ), + :class => 'see-more' ) if @results.size > 1 %> + <% end %> <% end %> <% partial = partial_for_class results.first.class %>
diff --git a/test/functional/search_controller_test.rb b/test/functional/search_controller_test.rb index 605b5e6..f7965be 100644 --- a/test/functional/search_controller_test.rb +++ b/test/functional/search_controller_test.rb @@ -928,6 +928,17 @@ class SearchControllerTest < Test::Unit::TestCase assert_not_includes assigns(:results)[:products], p2 end + should 'show link to article asset in the see all foot link of the most_commented_articles block in the category page' do + art = create_user('teste').person.articles.create!(:name => 'an article to be found') + most_commented = [art] + finder = CategoryFinder.new(@category) + finder.expects(:most_commented_articles).returns(most_commented) + CategoryFinder.expects(:new).with(@category).returns(finder) + + get :category_index, :category_path => [ 'my-category' ] + assert_tag :tag => 'div', :attributes => {:class => /search-results-most_commented_articles/} , :descendant => {:tag => 'a', :attributes => { :href => '/search/index/my-category?asset=articles'}} + end + ################################################################## ################################################################## -- libgit2 0.21.2