Commit 9e93def48e622adfe4cc81992c4e7d5a715b9841
1 parent
a50b650c
Exists in
master
and in
29 other branches
ActionItem155: integrating the categories menu with the assets menu
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1630 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
2 changed files
with
15 additions
and
11 deletions
Show diff stats
app/views/shared/categories_menu.rhtml
... | ... | @@ -5,7 +5,11 @@ |
5 | 5 | <%= item.name %> |
6 | 6 | <ul> |
7 | 7 | <% item.children.each do |child| %> |
8 | - <li><%= link_to(content_tag('span', child.name), :controller => 'search', :action => 'category_index', :category_path => child.explode_path) %></li> | |
8 | + <% if (params[:controller] == 'search') && (params[:action] == 'assets') %> | |
9 | + <li><%= link_to(content_tag('span', child.name), :controller => 'search', :action => 'assets', :asset => params[:asset], :category_path => child.explode_path) %></li> | |
10 | + <% else %> | |
11 | + <li><%= link_to(content_tag('span', child.name), :controller => 'search', :action => 'category_index', :category_path => child.explode_path) %></li> | |
12 | + <% end %> | |
9 | 13 | <% end %> |
10 | 14 | </ul> |
11 | 15 | </li> | ... | ... |
test/integration/categories_menu_test.rb
... | ... | @@ -2,27 +2,27 @@ require "#{File.dirname(__FILE__)}/../test_helper" |
2 | 2 | |
3 | 3 | class CategoriesMenuTest < ActionController::IntegrationTest |
4 | 4 | |
5 | - should 'display link to categories' do | |
5 | + def setup | |
6 | 6 | Category.delete_all |
7 | - cat1 = Category.create!(:name => 'Food', :environment => Environment.default, :display_color => 1) | |
8 | - cat2 = Category.create!(:name => 'Vegetables', :environment => Environment.default, :parent => cat1) | |
7 | + @cat1 = Category.create!(:name => 'Food', :environment => Environment.default, :display_color => 1) | |
8 | + @cat2 = Category.create!(:name => 'Vegetables', :environment => Environment.default, :parent => @cat1) | |
9 | + end | |
9 | 10 | |
11 | + should 'display link to categories' do | |
10 | 12 | get '/' |
11 | - | |
12 | 13 | assert_tag :tag => 'a', :attributes => { :href => '/cat/food/vegetables' } |
13 | - | |
14 | 14 | end |
15 | 15 | |
16 | 16 | should 'display link to sub-categories' do |
17 | - Category.delete_all | |
18 | - cat1 = Category.create!(:name => 'Food', :environment => Environment.default) | |
19 | - cat2 = Category.create!(:name => 'Vegetables', :environment => Environment.default, :parent => cat1) | |
20 | - | |
21 | 17 | get '/cat/food' |
22 | - | |
23 | 18 | # there must be a link to the subcategory |
24 | 19 | assert_tag :tag => 'a', :attributes => { :href => '/cat/food/vegetables' } |
20 | + end | |
25 | 21 | |
22 | + should 'link to other assets in the same category when viewing an asset' do | |
23 | + get '/assets/articles/food/vegetables' | |
24 | + assert_no_tag :tag => 'a', :attributes => { :href => '/cat/food/vegetables' } | |
25 | + assert_tag :tag => 'a', :attributes => { :href => '/assets/enterprises/food/vegetables' } | |
26 | 26 | end |
27 | 27 | |
28 | 28 | end | ... | ... |