Commit c456c608bb2973d5d9ff9c80fa60971e6dbffebd
Committed by
Joenio Costa
1 parent
fe0c4489
Exists in
master
and in
29 other branches
Tag routes uses "tags" for single or group tags
(ActionItem1558)
Showing
9 changed files
with
19 additions
and
14 deletions
Show diff stats
app/controllers/public/profile_controller.rb
@@ -37,7 +37,7 @@ class ProfileController < PublicController | @@ -37,7 +37,7 @@ class ProfileController < PublicController | ||
37 | tagged, | 37 | tagged, |
38 | :title => _("%s's contents tagged with \"%s\"") % [profile.name, @tag], | 38 | :title => _("%s's contents tagged with \"%s\"") % [profile.name, @tag], |
39 | :description => _("%s's contents tagged with \"%s\"") % [profile.name, @tag], | 39 | :description => _("%s's contents tagged with \"%s\"") % [profile.name, @tag], |
40 | - :link => url_for(:action => 'tag') | 40 | + :link => url_for(:action => 'tags') |
41 | ) | 41 | ) |
42 | render :text => data, :content_type => "text/xml" | 42 | render :text => data, :content_type => "text/xml" |
43 | end | 43 | end |
app/models/tags_block.rb
@@ -32,7 +32,7 @@ class TagsBlock < Block | @@ -32,7 +32,7 @@ class TagsBlock < Block | ||
32 | block_title(title) + | 32 | block_title(title) + |
33 | "\n<div class='tag_cloud'>\n"+ | 33 | "\n<div class='tag_cloud'>\n"+ |
34 | tag_cloud( tags, :id, | 34 | tag_cloud( tags, :id, |
35 | - owner.public_profile_url.merge(:controller => 'profile', :action => 'tag'), | 35 | + owner.public_profile_url.merge(:controller => 'profile', :action => 'tags'), |
36 | :max_size => 16, :min_size => 9 ) + | 36 | :max_size => 16, :min_size => 9 ) + |
37 | "\n</div><!-- end class='tag_cloud' -->\n"; | 37 | "\n</div><!-- end class='tag_cloud' -->\n"; |
38 | end | 38 | end |
app/views/content_viewer/view_page.rhtml
@@ -66,7 +66,7 @@ | @@ -66,7 +66,7 @@ | ||
66 | <% if !@page.tags.empty? %> | 66 | <% if !@page.tags.empty? %> |
67 | <div id="article-tags"> | 67 | <div id="article-tags"> |
68 | <%= _("This article's tags:") %> | 68 | <%= _("This article's tags:") %> |
69 | - <%= @page.tags.map { |t| link_to(t, :controller => 'profile', :profile => @profile.identifier, :action => 'tag', :id => t.name ) }.join("\n") %> | 69 | + <%= @page.tags.map { |t| link_to(t, :controller => 'profile', :profile => @profile.identifier, :action => 'tags', :id => t.name ) }.join("\n") %> |
70 | </div> | 70 | </div> |
71 | <% end %> | 71 | <% end %> |
72 | 72 |
app/views/profile/index.rhtml
@@ -51,7 +51,7 @@ | @@ -51,7 +51,7 @@ | ||
51 | <%= _('Tags:') %> | 51 | <%= _('Tags:') %> |
52 | </td> | 52 | </td> |
53 | <td> | 53 | <td> |
54 | - <%= tag_cloud @tags, :id, { :action => 'tag' }, :max_size => 18, :min_size => 10%> | 54 | + <%= tag_cloud @tags, :id, { :action => 'tags' }, :max_size => 18, :min_size => 10%> |
55 | </td> | 55 | </td> |
56 | </tr> | 56 | </tr> |
57 | 57 |
config/routes.rb
@@ -66,7 +66,12 @@ ActionController::Routing::Routes.draw do |map| | @@ -66,7 +66,12 @@ ActionController::Routing::Routes.draw do |map| | ||
66 | map.invite 'profile/:profile/invite/:action', :controller => 'invite', :profile => /#{Noosfero.identifier_format}/ | 66 | map.invite 'profile/:profile/invite/:action', :controller => 'invite', :profile => /#{Noosfero.identifier_format}/ |
67 | 67 | ||
68 | # feeds per tag | 68 | # feeds per tag |
69 | - map.tag_feed 'profile/:profile/tag/:id/feed', :controller => 'profile', :action =>'tag_feed', :id => /.*/, :profile => /#{Noosfero.identifier_format}/ | 69 | + map.tag_feed 'profile/:profile/tags/:id/feed', :controller => 'profile', :action =>'tag_feed', :id => /.+/, :profile => /#{Noosfero.identifier_format}/ |
70 | + map.tag 'profile/:profile/tags/:id', :controller => 'profile', :action => 'tag', :id => /.+/, :profile => /#{Noosfero.identifier_format}/ | ||
71 | + | ||
72 | + # profile tags | ||
73 | + map.tag 'profile/:profile/tags/:id', :controller => 'profile', :action => 'tag', :id => /.+/, :profile => /#{Noosfero.identifier_format}/ | ||
74 | + map.tag 'profile/:profile/tag', :controller => 'profile', :action => 'tags', :profile => /#{Noosfero.identifier_format}/ | ||
70 | 75 | ||
71 | # public profile information | 76 | # public profile information |
72 | map.profile 'profile/:profile/:action/:id', :controller => 'profile', :action => 'index', :id => /.*/, :profile => /#{Noosfero.identifier_format}/ | 77 | map.profile 'profile/:profile/:action/:id', :controller => 'profile', :action => 'index', :id => /.*/, :profile => /#{Noosfero.identifier_format}/ |
test/functional/content_viewer_controller_test.rb
@@ -251,11 +251,11 @@ class ContentViewerControllerTest < Test::Unit::TestCase | @@ -251,11 +251,11 @@ class ContentViewerControllerTest < Test::Unit::TestCase | ||
251 | get :view_page, :profile => profile.identifier, :page => [ 'myarticle' ] | 251 | get :view_page, :profile => profile.identifier, :page => [ 'myarticle' ] |
252 | assert_tag :tag => 'div', :attributes => { :id => 'article-tags' }, :descendant => { | 252 | assert_tag :tag => 'div', :attributes => { :id => 'article-tags' }, :descendant => { |
253 | :tag => 'a', | 253 | :tag => 'a', |
254 | - :attributes => { :href => "/profile/#{profile.identifier}/tag/tag1" } | 254 | + :attributes => { :href => "/profile/#{profile.identifier}/tags/tag1" } |
255 | } | 255 | } |
256 | assert_tag :tag => 'div', :attributes => { :id => 'article-tags' }, :descendant => { | 256 | assert_tag :tag => 'div', :attributes => { :id => 'article-tags' }, :descendant => { |
257 | :tag => 'a', | 257 | :tag => 'a', |
258 | - :attributes => { :href => "/profile/#{profile.identifier}/tag/tag2" } | 258 | + :attributes => { :href => "/profile/#{profile.identifier}/tags/tag2" } |
259 | } | 259 | } |
260 | 260 | ||
261 | assert_tag :tag => 'div', :attributes => { :id => 'article-tags' }, :descendant => { :content => /This article's tags:/ } | 261 | assert_tag :tag => 'div', :attributes => { :id => 'article-tags' }, :descendant => { :content => /This article's tags:/ } |
test/functional/profile_controller_test.rb
@@ -311,8 +311,8 @@ class ProfileControllerTest < Test::Unit::TestCase | @@ -311,8 +311,8 @@ class ProfileControllerTest < Test::Unit::TestCase | ||
311 | Person.any_instance.stubs(:article_tags).returns({ 'one' => 1, 'two' => 2}) | 311 | Person.any_instance.stubs(:article_tags).returns({ 'one' => 1, 'two' => 2}) |
312 | get :tags, :profile => 'testuser' | 312 | get :tags, :profile => 'testuser' |
313 | 313 | ||
314 | - assert_tag :tag => 'div', :attributes => { :class => /main-block/ }, :descendant => { :tag => 'a', :attributes => { :href => '/profile/testuser/tag/one'} } | ||
315 | - assert_tag :tag => 'div', :attributes => { :class => /main-block/ }, :descendant => { :tag => 'a', :attributes => { :href => '/profile/testuser/tag/two'} } | 314 | + assert_tag :tag => 'div', :attributes => { :class => /main-block/ }, :descendant => { :tag => 'a', :attributes => { :href => '/profile/testuser/tags/one'} } |
315 | + assert_tag :tag => 'div', :attributes => { :class => /main-block/ }, :descendant => { :tag => 'a', :attributes => { :href => '/profile/testuser/tags/two'} } | ||
316 | end | 316 | end |
317 | 317 | ||
318 | should 'show e-mail for friends on profile page' do | 318 | should 'show e-mail for friends on profile page' do |
test/integration/routing_test.rb
@@ -119,7 +119,7 @@ class RoutingTest < ActionController::IntegrationTest | @@ -119,7 +119,7 @@ class RoutingTest < ActionController::IntegrationTest | ||
119 | end | 119 | end |
120 | 120 | ||
121 | def test_profile_route_for_tags_with_dot | 121 | def test_profile_route_for_tags_with_dot |
122 | - assert_routing('/profile/ze/tag/tag.withdot', :controller => 'profile', :profile => 'ze', :action => 'tag', :id => 'tag.withdot') | 122 | + assert_routing('/profile/ze/tags/tag.withdot', :controller => 'profile', :profile => 'ze', :action => 'tag', :id => 'tag.withdot') |
123 | end | 123 | end |
124 | 124 | ||
125 | def test_profile_with_tilde_routing | 125 | def test_profile_with_tilde_routing |
test/unit/tags_block_test.rb
@@ -22,9 +22,9 @@ class TagsBlockTest < Test::Unit::TestCase | @@ -22,9 +22,9 @@ class TagsBlockTest < Test::Unit::TestCase | ||
22 | end | 22 | end |
23 | 23 | ||
24 | should 'generate links to tags' do | 24 | should 'generate links to tags' do |
25 | - assert_match /profile\/testinguser\/tag\/first-tag/, block.content | ||
26 | - assert_match /profile\/testinguser\/tag\/second-tag/, block.content | ||
27 | - assert_match /profile\/testinguser\/tag\/third-tag/, block.content | 25 | + assert_match /profile\/testinguser\/tags\/first-tag/, block.content |
26 | + assert_match /profile\/testinguser\/tags\/second-tag/, block.content | ||
27 | + assert_match /profile\/testinguser\/tags\/third-tag/, block.content | ||
28 | end | 28 | end |
29 | 29 | ||
30 | should 'return (none) when no tags to display' do | 30 | should 'return (none) when no tags to display' do |
@@ -34,7 +34,7 @@ class TagsBlockTest < Test::Unit::TestCase | @@ -34,7 +34,7 @@ class TagsBlockTest < Test::Unit::TestCase | ||
34 | 34 | ||
35 | should 'generate links when profile has own hostname' do | 35 | should 'generate links when profile has own hostname' do |
36 | @user.domains << Domain.new(:name => 'testuser.net'); @user.save! | 36 | @user.domains << Domain.new(:name => 'testuser.net'); @user.save! |
37 | - assert_match /profile\/testinguser\/tag\/first-tag/, block.content | 37 | + assert_match /profile\/testinguser\/tags\/first-tag/, block.content |
38 | end | 38 | end |
39 | 39 | ||
40 | end | 40 | end |