Commit aa583a316faea34e1291209aaabca79b6cc1b6ed
Exists in
master
and in
29 other branches
Merge branch 'stable'
Showing
20 changed files
with
97 additions
and
55 deletions
Show diff stats
app/controllers/my_profile/cms_controller.rb
app/controllers/my_profile/memberships_controller.rb
... | ... | @@ -29,7 +29,7 @@ class MembershipsController < MyProfileController |
29 | 29 | @community = Community.find(params[:id]) |
30 | 30 | if request.post? |
31 | 31 | if @community.destroy |
32 | - flash[:notice] = _('%s was destroyed!') % @community.short_name | |
32 | + flash[:notice] = _('%s was removed.') % @community.short_name | |
33 | 33 | redirect_to :action => 'index' |
34 | 34 | end |
35 | 35 | end | ... | ... |
app/controllers/public/profile_controller.rb
... | ... | @@ -21,7 +21,7 @@ class ProfileController < PublicController |
21 | 21 | end |
22 | 22 | end |
23 | 23 | |
24 | - def tag | |
24 | + def content_tagged | |
25 | 25 | @tag = params[:id] |
26 | 26 | @tag_cache_key = "tag_#{CGI.escape(@tag.to_s)}_#{profile.id.to_s}_page_#{params[:npage]}" |
27 | 27 | if is_cache_expired?(@tag_cache_key, true) |
... | ... | @@ -37,7 +37,7 @@ class ProfileController < PublicController |
37 | 37 | tagged, |
38 | 38 | :title => _("%s's contents tagged with \"%s\"") % [profile.name, @tag], |
39 | 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 | 42 | render :text => data, :content_type => "text/xml" |
43 | 43 | end | ... | ... |
app/models/person.rb
... | ... | @@ -270,20 +270,20 @@ class Person < Profile |
270 | 270 | |
271 | 271 | def communities_cache_key(params = {}) |
272 | 272 | page = params[:npage] || '1' |
273 | - identifier + '-communities-page-' + page | |
273 | + cache_key + '-communities-page-' + page | |
274 | 274 | end |
275 | 275 | |
276 | 276 | def friends_cache_key(params = {}) |
277 | 277 | page = params[:npage] || '1' |
278 | - identifier + '-friends-page-' + page | |
278 | + cache_key + '-friends-page-' + page | |
279 | 279 | end |
280 | 280 | |
281 | 281 | def manage_friends_cache_key(params = {}) |
282 | 282 | page = params[:npage] || '1' |
283 | - identifier + '-manage-friends-page-' + page | |
283 | + cache_key + '-manage-friends-page-' + page | |
284 | 284 | end |
285 | 285 | |
286 | 286 | def relationships_cache_key |
287 | - identifier + '-profile-relationships' | |
287 | + cache_key + '-profile-relationships' | |
288 | 288 | end |
289 | 289 | end | ... | ... |
app/models/profile.rb
app/models/tags_block.rb
... | ... | @@ -32,7 +32,7 @@ class TagsBlock < Block |
32 | 32 | block_title(title) + |
33 | 33 | "\n<div class='tag_cloud'>\n"+ |
34 | 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 | 36 | :max_size => 16, :min_size => 9 ) + |
37 | 37 | "\n</div><!-- end class='tag_cloud' -->\n"; |
38 | 38 | end | ... | ... |
app/views/content_viewer/view_page.rhtml
... | ... | @@ -66,7 +66,7 @@ |
66 | 66 | <% if !@page.tags.empty? %> |
67 | 67 | <div id="article-tags"> |
68 | 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 | 70 | </div> |
71 | 71 | <% end %> |
72 | 72 | ... | ... |
... | ... | @@ -0,0 +1,23 @@ |
1 | +<% add_rss_feed_to_head(_("%s's contents tagged with \"%s\"") % [profile.name, @tag], tag_feed_path) %> | |
2 | + | |
3 | +<h1><%= _('Content tagged with "%s"') % @tag %></h1> | |
4 | + | |
5 | +<p> | |
6 | +<%= link_to image_tag('icons-mime/rss-feed.png', :alt => _('Feed for this tag'), :title => _('Feed for this tag')), tag_feed_path, :class => 'blog-feed-link'%> | |
7 | +</p> | |
8 | + | |
9 | +<% cache_timeout(@tag_cache_key, 4.hour.from_now) do %> | |
10 | + <div class='search-tagged-items'> | |
11 | + <ul> | |
12 | + <% for doc in @tagged %> | |
13 | + <li><%= link_to doc.title, doc.url %></li> | |
14 | + <% end %> | |
15 | + </ul> | |
16 | + </div> | |
17 | + | |
18 | + <%= pagination_links @tagged, :param_name => 'npage' %> | |
19 | + | |
20 | + <div> | |
21 | + <%= link_to _('See content tagged with "%s" in the entire site') % @tag, :controller => 'search', :action => 'tag', :tag => @tag %> | |
22 | + </div> | |
23 | +<% end %> | ... | ... |
app/views/profile/index.rhtml
... | ... | @@ -4,19 +4,19 @@ |
4 | 4 | |
5 | 5 | <% if @action %> |
6 | 6 | <%= render :partial => 'private_profile' %> |
7 | -<% end %> | |
8 | - | |
9 | -<% if !@action %> | |
10 | - <div class='public-profile-description'> | |
11 | - <%= profile.description %> | |
12 | - </div> | |
7 | +<% else %> | |
8 | + <% unless profile.description.blank? %> | |
9 | + <div class='public-profile-description'> | |
10 | + <%= profile.description %> | |
11 | + </div> | |
12 | + <% end %> | |
13 | 13 | <% end %> |
14 | 14 | |
15 | 15 | <table class='profile'> |
16 | 16 | <%= render :partial => partial_for_class(profile.class) %> |
17 | 17 | |
18 | 18 | <% unless @action %> |
19 | - <% cache_timeout(profile.identifier + '-profile-general-info', 4.hours.from_now) do %> | |
19 | + <% cache_timeout(profile.cache_key + '-profile-general-info', 4.hours.from_now) do %> | |
20 | 20 | <tr> |
21 | 21 | <th colspan='2'> |
22 | 22 | <%= _('Content') %> |
... | ... | @@ -51,7 +51,7 @@ |
51 | 51 | <%= _('Tags:') %> |
52 | 52 | </td> |
53 | 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 | 55 | </td> |
56 | 56 | </tr> |
57 | 57 | ... | ... |
app/views/profile/tag.rhtml
... | ... | @@ -1,23 +0,0 @@ |
1 | -<% add_rss_feed_to_head(_("%s's contents tagged with \"%s\"") % [profile.name, @tag], tag_feed_path) %> | |
2 | - | |
3 | -<h1><%= _('Content tagged with "%s"') % @tag %></h1> | |
4 | - | |
5 | -<p> | |
6 | -<%= link_to image_tag('icons-mime/rss-feed.png', :alt => _('Feed for this tag'), :title => _('Feed for this tag')), tag_feed_path, :class => 'blog-feed-link'%> | |
7 | -</p> | |
8 | - | |
9 | -<% cache_timeout(@tag_cache_key, 4.hour.from_now) do %> | |
10 | - <div class='search-tagged-items'> | |
11 | - <ul> | |
12 | - <% for doc in @tagged %> | |
13 | - <li><%= link_to doc.title, doc.url %></li> | |
14 | - <% end %> | |
15 | - </ul> | |
16 | - </div> | |
17 | - | |
18 | - <%= pagination_links @tagged, :param_name => 'npage' %> | |
19 | - | |
20 | - <div> | |
21 | - <%= link_to _('See content tagged with "%s" in the entire site') % @tag, :controller => 'search', :action => 'tag', :tag => @tag %> | |
22 | - </div> | |
23 | -<% end %> |
app/views/profile/tags.rhtml
... | ... | @@ -2,6 +2,6 @@ |
2 | 2 | |
3 | 3 | <div class='tag_cloud'> |
4 | 4 | <% cache_timeout(@tags_cache_key, 4.hour.from_now) do %> |
5 | - <%= tag_cloud @tags, :id, { :action => :tag}, {:show_count => true} %> | |
5 | + <%= tag_cloud @tags, :id, { :action => :tags }, {:show_count => true} %> | |
6 | 6 | <% end %> |
7 | 7 | </div> | ... | ... |
config/routes.rb
... | ... | @@ -66,7 +66,11 @@ ActionController::Routing::Routes.draw do |map| |
66 | 66 | map.invite 'profile/:profile/invite/:action', :controller => 'invite', :profile => /#{Noosfero.identifier_format}/ |
67 | 67 | |
68 | 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 | + | |
71 | + # profile tags | |
72 | + map.tag 'profile/:profile/tags/:id', :controller => 'profile', :action => 'content_tagged', :id => /.+/, :profile => /#{Noosfero.identifier_format}/ | |
73 | + map.tag 'profile/:profile/tags', :controller => 'profile', :action => 'tags', :profile => /#{Noosfero.identifier_format}/ | |
70 | 74 | |
71 | 75 | # public profile information |
72 | 76 | map.profile 'profile/:profile/:action/:id', :controller => 'profile', :action => 'index', :id => /.*/, :profile => /#{Noosfero.identifier_format}/ | ... | ... |
features/tags.feature
... | ... | @@ -31,3 +31,12 @@ Feature: tags |
31 | 31 | And I follow "whales" |
32 | 32 | Then I should see "save the whales" |
33 | 33 | And I should not see "the Amazon is being destroyed" |
34 | + | |
35 | + Scenario: viewing profile's tag cloud | |
36 | + When I go to /profile/joaoaraujo/tags | |
37 | + Then I should see "amazon" | |
38 | + And I should not see "whales" | |
39 | + | |
40 | + Scenario: viewing profile's content tagged | |
41 | + When I go to /profile/joaoaraujo/tags/amazon | |
42 | + Then I should see "the Amazon is being destroyed" | ... | ... |
lib/noosfero.rb
public/designs/themes/base/style.css
... | ... | @@ -3,6 +3,7 @@ |
3 | 3 | |
4 | 4 | .button { |
5 | 5 | -moz-border-radius: 3px; |
6 | + -webkit-border-radius: 3px; | |
6 | 7 | } |
7 | 8 | |
8 | 9 | #content input.button, #content a.button { |
... | ... | @@ -112,6 +113,7 @@ body, th, td, input { |
112 | 113 | width: 160px; |
113 | 114 | border: 1px solid #BBB; |
114 | 115 | -moz-border-radius: 3px; |
116 | + -webkit-border-radius: 3px; | |
115 | 117 | color: #CCC; |
116 | 118 | } |
117 | 119 | #user form.focused input { |
... | ... | @@ -555,11 +557,14 @@ div#notice { |
555 | 557 | background-color: #EEE; |
556 | 558 | background-position: 4px 50%; |
557 | 559 | -moz-border-radius: 4px; |
560 | + -webkit-border-radius: 4px; | |
558 | 561 | } |
559 | 562 | |
560 | 563 | #content .link-list-block li a.link-this-page { |
561 | 564 | -moz-border-radius-topright: 0px; |
562 | 565 | -moz-border-radius-bottomright: 0px; |
566 | + -webkit-border-radius-topright: 0px; | |
567 | + -webkit-border-radius-bottomright: 0px; | |
563 | 568 | background-color: #cecece; |
564 | 569 | max-width: 175px; |
565 | 570 | width: 200px; |
... | ... | @@ -786,6 +791,7 @@ X.sep { |
786 | 791 | .controller-search #content .search_form { |
787 | 792 | background: #DDD; |
788 | 793 | -moz-border-radius: 5px; |
794 | + -webkit-border-radius: 5px; | |
789 | 795 | padding: 12px 15px 13px 15px; |
790 | 796 | position: relative; |
791 | 797 | text-align: left; |
... | ... | @@ -813,6 +819,7 @@ X.sep { |
813 | 819 | .controller-search .search-options { |
814 | 820 | border: 1px solid #777; |
815 | 821 | -moz-border-radius: 5px; |
822 | + -webkit-border-radius: 5px; | |
816 | 823 | } |
817 | 824 | .controller-search .search-options ul li { |
818 | 825 | position: relative; |
... | ... | @@ -962,6 +969,7 @@ hr.pre-posts, hr.sep-posts { |
962 | 969 | text-decoration: none; |
963 | 970 | padding: 0px 2px; |
964 | 971 | -moz-border-radius: 3px; |
972 | + -webkit-border-radius: 3px; | |
965 | 973 | background: #BBB; |
966 | 974 | color: #FFF; |
967 | 975 | } |
... | ... | @@ -984,6 +992,7 @@ hr.pre-posts, hr.sep-posts { |
984 | 992 | |
985 | 993 | .post_comment_box.closed h4 { |
986 | 994 | -moz-border-radius: 4px; |
995 | + -webkit-border-radius: 4px; | |
987 | 996 | } |
988 | 997 | |
989 | 998 | .post_comment_box.opened h4 { |
... | ... | @@ -1119,6 +1128,7 @@ hr.pre-posts, hr.sep-posts { |
1119 | 1128 | .common-profile-list-block .vcard a:hover { |
1120 | 1129 | border: 1px solid #CCC; |
1121 | 1130 | -moz-border-radius: 5px; |
1131 | + -webkit-border-radius: 5px; | |
1122 | 1132 | background: #EEE; |
1123 | 1133 | text-decoration: none; |
1124 | 1134 | } |
... | ... | @@ -1137,6 +1147,7 @@ table.profile th { |
1137 | 1147 | background-color: #FFF; |
1138 | 1148 | border: 1px solid #EEE; |
1139 | 1149 | -moz-border-radius: 9px; |
1150 | + -webkit-border-radius: 9px; | |
1140 | 1151 | margin-bottom: 10px; |
1141 | 1152 | } |
1142 | 1153 | |
... | ... | @@ -1149,6 +1160,7 @@ table.profile th { |
1149 | 1160 | border: 1px solid #CCC; |
1150 | 1161 | background-color: #EEE; |
1151 | 1162 | -moz-border-radius: 4px; |
1163 | + -webkit-border-radius: 4px; | |
1152 | 1164 | } |
1153 | 1165 | |
1154 | 1166 | /************************** Control Panel ****************************/ | ... | ... |
public/stylesheets/application.css
... | ... | @@ -132,6 +132,7 @@ div#notice { |
132 | 132 | background-color: #000; |
133 | 133 | color: white; |
134 | 134 | -moz-border-radius: 15px; |
135 | + -webkit-border-radius: 15px; | |
135 | 136 | font-size: 16px; |
136 | 137 | font-weight: bold; |
137 | 138 | z-index: 100000; |
... | ... | @@ -454,6 +455,7 @@ div.pending-tasks { |
454 | 455 | #content #not-found, |
455 | 456 | #content #access-denied { |
456 | 457 | -moz-border-radius: 6px; |
458 | + -webkit-border-radius: 6px; | |
457 | 459 | } |
458 | 460 | |
459 | 461 | #content #not-found p, |
... | ... | @@ -3100,6 +3102,7 @@ h1#agenda-title { |
3100 | 3102 | .controller-profile_editor .control-panel a:hover { |
3101 | 3103 | background-color: #d2e0f0; |
3102 | 3104 | -moz-border-radius: 3px; |
3105 | + -webkit-border-radius: 3px; | |
3103 | 3106 | } |
3104 | 3107 | |
3105 | 3108 | .controller-profile_editor a.control-panel-groups { background-image: url(../images/control-panel/system-users.png) } | ... | ... |
test/functional/content_viewer_controller_test.rb
... | ... | @@ -251,11 +251,11 @@ class ContentViewerControllerTest < Test::Unit::TestCase |
251 | 251 | get :view_page, :profile => profile.identifier, :page => [ 'myarticle' ] |
252 | 252 | assert_tag :tag => 'div', :attributes => { :id => 'article-tags' }, :descendant => { |
253 | 253 | :tag => 'a', |
254 | - :attributes => { :href => "/profile/#{profile.identifier}/tag/tag1" } | |
254 | + :attributes => { :href => "/profile/#{profile.identifier}/tags/tag1" } | |
255 | 255 | } |
256 | 256 | assert_tag :tag => 'div', :attributes => { :id => 'article-tags' }, :descendant => { |
257 | 257 | :tag => 'a', |
258 | - :attributes => { :href => "/profile/#{profile.identifier}/tag/tag2" } | |
258 | + :attributes => { :href => "/profile/#{profile.identifier}/tags/tag2" } | |
259 | 259 | } |
260 | 260 | |
261 | 261 | assert_tag :tag => 'div', :attributes => { :id => 'article-tags' }, :descendant => { :content => /This article's tags:/ } | ... | ... |
test/functional/profile_controller_test.rb
... | ... | @@ -142,13 +142,13 @@ class ProfileControllerTest < Test::Unit::TestCase |
142 | 142 | should 'display tag for profile' do |
143 | 143 | @profile.articles.create!(:name => 'testarticle', :tag_list => 'tag1') |
144 | 144 | |
145 | - get :tag, :profile => @profile.identifier, :id => 'tag1' | |
145 | + get :content_tagged, :profile => @profile.identifier, :id => 'tag1' | |
146 | 146 | assert_tag :tag => 'a', :attributes => { :href => /testuser\/testarticle$/ } |
147 | 147 | end |
148 | 148 | |
149 | 149 | should 'link to the same tag but for whole environment' do |
150 | 150 | @profile.articles.create!(:name => 'testarticle', :tag_list => 'tag1') |
151 | - get :tag, :profile => @profile.identifier, :id => 'tag1' | |
151 | + get :content_tagged, :profile => @profile.identifier, :id => 'tag1' | |
152 | 152 | |
153 | 153 | assert_tag :tag => 'a', :attributes => { :href => '/tag/tag1' }, :content => 'See content tagged with "tag1" in the entire site' |
154 | 154 | end |
... | ... | @@ -311,8 +311,8 @@ class ProfileControllerTest < Test::Unit::TestCase |
311 | 311 | Person.any_instance.stubs(:article_tags).returns({ 'one' => 1, 'two' => 2}) |
312 | 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 | 316 | end |
317 | 317 | |
318 | 318 | should 'show e-mail for friends on profile page' do |
... | ... | @@ -683,6 +683,19 @@ class ProfileControllerTest < Test::Unit::TestCase |
683 | 683 | assert_tag :tag => 'div', :attributes => { :class => 'public-profile-description' }, :content => /Person\'s description/ |
684 | 684 | end |
685 | 685 | |
686 | + should 'not show description of orgarnization if not filled' do | |
687 | + login_as(@profile.identifier) | |
688 | + ent = fast_create(Enterprise) | |
689 | + get :index, :profile => ent.identifier | |
690 | + assert_no_tag :tag => 'div', :attributes => { :class => 'public-profile-description' } | |
691 | + end | |
692 | + | |
693 | + should 'not show description of person if not filled' do | |
694 | + login_as(@profile.identifier) | |
695 | + get :index, :profile => @profile.identifier | |
696 | + assert_no_tag :tag => 'div', :attributes => { :class => 'public-profile-description' } | |
697 | + end | |
698 | + | |
686 | 699 | should 'ask for login if user not logged' do |
687 | 700 | enterprise = fast_create(Enterprise) |
688 | 701 | get :unblock, :profile => enterprise.identifier | ... | ... |
test/integration/routing_test.rb
... | ... | @@ -119,7 +119,7 @@ class RoutingTest < ActionController::IntegrationTest |
119 | 119 | end |
120 | 120 | |
121 | 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 => 'content_tagged', :id => 'tag.withdot') | |
123 | 123 | end |
124 | 124 | |
125 | 125 | def test_profile_with_tilde_routing | ... | ... |
test/unit/tags_block_test.rb
... | ... | @@ -22,9 +22,9 @@ class TagsBlockTest < Test::Unit::TestCase |
22 | 22 | end |
23 | 23 | |
24 | 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 | 28 | end |
29 | 29 | |
30 | 30 | should 'return (none) when no tags to display' do |
... | ... | @@ -34,7 +34,7 @@ class TagsBlockTest < Test::Unit::TestCase |
34 | 34 | |
35 | 35 | should 'generate links when profile has own hostname' do |
36 | 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 | 38 | end |
39 | 39 | |
40 | 40 | end | ... | ... |