From f15fb2d2976d99242c5ff73787215f5d0ae2aac3 Mon Sep 17 00:00:00 2001 From: AntonioTerceiro Date: Fri, 8 Feb 2008 23:38:11 +0000 Subject: [PATCH] ActionItem41: adding link to admin area --- app/models/profile.rb | 4 ++++ test/unit/profile_test.rb | 5 +++++ 2 files changed, 9 insertions(+), 0 deletions(-) diff --git a/app/models/profile.rb b/app/models/profile.rb index 7bc5ca1..c293874 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -187,6 +187,10 @@ class Profile < ActiveRecord::Base generate_url(url_options.merge(:controller => 'content_viewer', :action => 'view_page', :page => [])) end + def admin_url + generate_url(url_options.merge(:controller => 'profile_editor', :action => 'index')) + end + def generate_url(options) url_for(url_options.merge(options)) end diff --git a/test/unit/profile_test.rb b/test/unit/profile_test.rb index e8fbb36..9c08b99 100644 --- a/test/unit/profile_test.rb +++ b/test/unit/profile_test.rb @@ -260,6 +260,11 @@ class ProfileTest < Test::Unit::TestCase assert_equal 'http://mycolivre.net/testprofile', profile.url end + should 'provide URL to admin area' do + profile = Profile.create!(:name => "Test Profile", :identifier => 'testprofile', :environment_id => create_environment('mycolivre.net').id) + assert_equal 'http://mycolivre.net/myprofile/testprofile', profile.admin_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