diff --git a/app/views/shared/categories_menu.rhtml b/app/views/shared/categories_menu.rhtml
index 7b1c596..f517ad8 100644
--- a/app/views/shared/categories_menu.rhtml
+++ b/app/views/shared/categories_menu.rhtml
@@ -5,7 +5,11 @@
<%= item.name %>
<% item.children.each do |child| %>
- - <%= link_to(content_tag('span', child.name), :controller => 'search', :action => 'category_index', :category_path => child.explode_path) %>
+ <% if (params[:controller] == 'search') && (params[:action] == 'assets') %>
+ - <%= link_to(content_tag('span', child.name), :controller => 'search', :action => 'assets', :asset => params[:asset], :category_path => child.explode_path) %>
+ <% else %>
+ - <%= link_to(content_tag('span', child.name), :controller => 'search', :action => 'category_index', :category_path => child.explode_path) %>
+ <% end %>
<% end %>
diff --git a/test/integration/categories_menu_test.rb b/test/integration/categories_menu_test.rb
index ecd3067..3f818c2 100644
--- a/test/integration/categories_menu_test.rb
+++ b/test/integration/categories_menu_test.rb
@@ -2,27 +2,27 @@ require "#{File.dirname(__FILE__)}/../test_helper"
class CategoriesMenuTest < ActionController::IntegrationTest
- should 'display link to categories' do
+ def setup
Category.delete_all
- cat1 = Category.create!(:name => 'Food', :environment => Environment.default, :display_color => 1)
- cat2 = Category.create!(:name => 'Vegetables', :environment => Environment.default, :parent => cat1)
+ @cat1 = Category.create!(:name => 'Food', :environment => Environment.default, :display_color => 1)
+ @cat2 = Category.create!(:name => 'Vegetables', :environment => Environment.default, :parent => @cat1)
+ end
+ should 'display link to categories' do
get '/'
-
assert_tag :tag => 'a', :attributes => { :href => '/cat/food/vegetables' }
-
end
should 'display link to sub-categories' do
- Category.delete_all
- cat1 = Category.create!(:name => 'Food', :environment => Environment.default)
- cat2 = Category.create!(:name => 'Vegetables', :environment => Environment.default, :parent => cat1)
-
get '/cat/food'
-
# there must be a link to the subcategory
assert_tag :tag => 'a', :attributes => { :href => '/cat/food/vegetables' }
+ end
+ should 'link to other assets in the same category when viewing an asset' do
+ get '/assets/articles/food/vegetables'
+ assert_no_tag :tag => 'a', :attributes => { :href => '/cat/food/vegetables' }
+ assert_tag :tag => 'a', :attributes => { :href => '/assets/enterprises/food/vegetables' }
end
end
--
libgit2 0.21.2