Commit dd055e71c124f046b7f5c33b64067a50e690e07e

Authored by AntonioTerceiro
1 parent 9c3cf816

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
app/models/profile.rb
... ... @@ -191,6 +191,10 @@ class Profile < ActiveRecord::Base
191 191 generate_url(url_options.merge(:controller => 'profile_editor', :action => 'index'))
192 192 end
193 193  
  194 + def public_profile_url
  195 + generate_url(url_options.merge(:controller => 'profile', :action => 'index'))
  196 + end
  197 +
194 198 def generate_url(options)
195 199 url_for(url_options.merge(options))
196 200 end
... ...
app/views/blocks/profile_info.rhtml
... ... @@ -4,6 +4,7 @@
4 4  
5 5 <ul>
6 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 9 </ul>
9 10  
... ...
test/unit/profile_test.rb
... ... @@ -265,6 +265,11 @@ class ProfileTest &lt; Test::Unit::TestCase
265 265 assert_equal 'http://mycolivre.net/myprofile/testprofile', profile.admin_url
266 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 273 should 'generate URL' do
269 274 profile = Profile.create!(:name => "Test Profile", :identifier => 'testprofile', :environment_id => create_environment('mycolivre.net').id)
270 275  
... ...