diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index c107be8..6d5a93c 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -714,6 +714,13 @@ module ApplicationHelper
title
end
+ def search_page_link_to_all(options={})
+ if options[:category]
+ title = "
" + _('In all categories') + "
"
+ link_to title, :action => 'assets', :asset => options[:asset], :category_path => []
+ end
+ end
+
def template_stylesheet_tag
if profile.nil?
stylesheet_link_tag '/designs/templates/default/stylesheets/style.css'
diff --git a/app/views/search/articles.rhtml b/app/views/search/articles.rhtml
index ba6fb4c..32ee821 100644
--- a/app/views/search/articles.rhtml
+++ b/app/views/search/articles.rhtml
@@ -4,6 +4,9 @@
:region => @region ? @region.name : nil,
:distance => @radius } ) %>
+<%= search_page_link_to_all( { :asset => params[:asset],
+ :category => @category }) %>
+
<%= render :partial => 'search_form', :locals => { :form_title => @query.blank? ? _('Search') : _("Refine your search"), :simple_search => true } %>
<%# FIXME ARMENGUE %>
diff --git a/app/views/search/communities.rhtml b/app/views/search/communities.rhtml
index cd1eb52..ead5352 100644
--- a/app/views/search/communities.rhtml
+++ b/app/views/search/communities.rhtml
@@ -4,6 +4,9 @@
:region => @region ? @region.name : nil,
:distance => @radius } ) %>
+<%= search_page_link_to_all( { :asset => params[:asset],
+ :category => @category }) %>
+
<%= render :partial => 'search_form', :locals => { :form_title => @query.blank? ? _('Search') : _("Refine your search"), :simple_search => true } %>
<%# FIXME ARMENGUE %>
diff --git a/app/views/search/enterprises.rhtml b/app/views/search/enterprises.rhtml
index 0c82a03..4ee954f 100644
--- a/app/views/search/enterprises.rhtml
+++ b/app/views/search/enterprises.rhtml
@@ -10,6 +10,9 @@
<%=h (_('Within %s km from %s') % [@radius, @region.name]) %>
<% end %>
+<%= search_page_link_to_all( { :asset => params[:asset],
+ :category => @category }) %>
+
<%= render :partial => 'search_form', :locals => { :form_title => _("Refine your search"), :simple_search => true } %>
<% if @categories_menu %>
diff --git a/app/views/search/people.rhtml b/app/views/search/people.rhtml
index 5d63519..b8d6995 100644
--- a/app/views/search/people.rhtml
+++ b/app/views/search/people.rhtml
@@ -4,6 +4,9 @@
:region => @region ? @region.name : nil,
:distance => @radius } ) %>
+<%= search_page_link_to_all( { :asset => params[:asset],
+ :category => @category }) %>
+
<%= render :partial => 'search_form', :locals => { :form_title => @query.blank? ? _('Search') : _("Refine your search"), :simple_search => true } %>
<%# FIXME ARMENGUE %>
diff --git a/app/views/search/products.rhtml b/app/views/search/products.rhtml
index 0088219..2fa7088 100644
--- a/app/views/search/products.rhtml
+++ b/app/views/search/products.rhtml
@@ -4,6 +4,9 @@
:region => @region ? @region.name : nil,
:distance => @radius } ) %>
+<%= search_page_link_to_all( { :asset => params[:asset],
+ :category => @category }) %>
+
<%= render :partial => 'search_form', :locals => { :form_title => _("Refine your search"), :simple_search => true } %>
<% if @categories_menu %>
diff --git a/test/functional/search_controller_test.rb b/test/functional/search_controller_test.rb
index 0e1a716..4baf41b 100644
--- a/test/functional/search_controller_test.rb
+++ b/test/functional/search_controller_test.rb
@@ -957,6 +957,21 @@ class SearchControllerTest < Test::Unit::TestCase
assert_equal 20, assigns(:results)[:enterprises].total_entries
end
+ should 'add link to list in all categories when in a category' do
+ ['people', 'enterprises', 'products', 'communities', 'articles'].each do |asset|
+ get :index, :asset => asset, :category_path => [ 'my-category' ]
+ assert_tag :tag => 'div', :content => 'In all categories'
+ end
+ end
+
+ should 'not add link to list in all categories when not in a category' do
+ ['people', 'enterprises', 'products', 'communities', 'articles'].each do |asset|
+ get :index, :asset => asset
+ assert_no_tag :tag => 'div', :content => 'In all categories'
+ end
+ end
+
+
##################################################################
##################################################################
--
libgit2 0.21.2