Commit dd055e71c124f046b7f5c33b64067a50e690e07e
1 parent
9c3cf816
Exists in
master
and in
28 other branches
ActionItem154: adding a link to the public profile in the profile info block
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1352 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
3 changed files
with
11 additions
and
1 deletions
Show diff stats
app/models/profile.rb
@@ -191,6 +191,10 @@ class Profile < ActiveRecord::Base | @@ -191,6 +191,10 @@ class Profile < ActiveRecord::Base | ||
191 | generate_url(url_options.merge(:controller => 'profile_editor', :action => 'index')) | 191 | generate_url(url_options.merge(:controller => 'profile_editor', :action => 'index')) |
192 | end | 192 | end |
193 | 193 | ||
194 | + def public_profile_url | ||
195 | + generate_url(url_options.merge(:controller => 'profile', :action => 'index')) | ||
196 | + end | ||
197 | + | ||
194 | def generate_url(options) | 198 | def generate_url(options) |
195 | url_for(url_options.merge(options)) | 199 | url_for(url_options.merge(options)) |
196 | end | 200 | end |
app/views/blocks/profile_info.rhtml
@@ -4,6 +4,7 @@ | @@ -4,6 +4,7 @@ | ||
4 | 4 | ||
5 | <ul> | 5 | <ul> |
6 | <li><%= _('Since %d') % block.owner.created_at.year %></li> | 6 | <li><%= _('Since %d') % block.owner.created_at.year %></li> |
7 | - <li><%= link_to_homepage _('Homepage'), block.owner.url %></li> | 7 | + <li><%= link_to _('Homepage'), block.owner.url %></li> |
8 | + <li><%= link_to _('View profile'), block.owner.public_profile_url %></li> | ||
8 | </ul> | 9 | </ul> |
9 | 10 |
test/unit/profile_test.rb
@@ -265,6 +265,11 @@ class ProfileTest < Test::Unit::TestCase | @@ -265,6 +265,11 @@ class ProfileTest < Test::Unit::TestCase | ||
265 | assert_equal 'http://mycolivre.net/myprofile/testprofile', profile.admin_url | 265 | assert_equal 'http://mycolivre.net/myprofile/testprofile', profile.admin_url |
266 | end | 266 | end |
267 | 267 | ||
268 | + should 'provide URL to public profile' do | ||
269 | + profile = Profile.create!(:name => "Test Profile", :identifier => 'testprofile', :environment_id => create_environment('mycolivre.net').id) | ||
270 | + assert_equal 'http://mycolivre.net/profile/testprofile', profile.public_profile_url | ||
271 | + end | ||
272 | + | ||
268 | should 'generate URL' do | 273 | should 'generate URL' do |
269 | profile = Profile.create!(:name => "Test Profile", :identifier => 'testprofile', :environment_id => create_environment('mycolivre.net').id) | 274 | profile = Profile.create!(:name => "Test Profile", :identifier => 'testprofile', :environment_id => create_environment('mycolivre.net').id) |
270 | 275 |