diff --git a/app/models/profile.rb b/app/models/profile.rb index c110fff..640c51f 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -191,6 +191,10 @@ class Profile < ActiveRecord::Base generate_url(url_options.merge(:controller => 'profile_editor', :action => 'index')) end + def public_profile_url + generate_url(url_options.merge(:controller => 'profile', :action => 'index')) + end + def generate_url(options) url_for(url_options.merge(options)) end diff --git a/app/views/blocks/profile_info.rhtml b/app/views/blocks/profile_info.rhtml index a4e9164..bb4f5b0 100644 --- a/app/views/blocks/profile_info.rhtml +++ b/app/views/blocks/profile_info.rhtml @@ -4,6 +4,7 @@ diff --git a/test/unit/profile_test.rb b/test/unit/profile_test.rb index 45ddd51..f2e2854 100644 --- a/test/unit/profile_test.rb +++ b/test/unit/profile_test.rb @@ -265,6 +265,11 @@ class ProfileTest < Test::Unit::TestCase assert_equal 'http://mycolivre.net/myprofile/testprofile', profile.admin_url end + should 'provide URL to public profile' do + profile = Profile.create!(:name => "Test Profile", :identifier => 'testprofile', :environment_id => create_environment('mycolivre.net').id) + assert_equal 'http://mycolivre.net/profile/testprofile', profile.public_profile_url + end + should 'generate URL' do profile = Profile.create!(:name => "Test Profile", :identifier => 'testprofile', :environment_id => create_environment('mycolivre.net').id) -- libgit2 0.21.2