Commit f15fb2d2976d99242c5ff73787215f5d0ae2aac3
1 parent
61cbb60b
Exists in
master
and in
23 other branches
ActionItem41: adding link to admin area
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1325 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
2 changed files
with
9 additions
and
0 deletions
Show diff stats
app/models/profile.rb
| @@ -187,6 +187,10 @@ class Profile < ActiveRecord::Base | @@ -187,6 +187,10 @@ class Profile < ActiveRecord::Base | ||
| 187 | generate_url(url_options.merge(:controller => 'content_viewer', :action => 'view_page', :page => [])) | 187 | generate_url(url_options.merge(:controller => 'content_viewer', :action => 'view_page', :page => [])) |
| 188 | end | 188 | end |
| 189 | 189 | ||
| 190 | + def admin_url | ||
| 191 | + generate_url(url_options.merge(:controller => 'profile_editor', :action => 'index')) | ||
| 192 | + end | ||
| 193 | + | ||
| 190 | def generate_url(options) | 194 | def generate_url(options) |
| 191 | url_for(url_options.merge(options)) | 195 | url_for(url_options.merge(options)) |
| 192 | end | 196 | end |
test/unit/profile_test.rb
| @@ -260,6 +260,11 @@ class ProfileTest < Test::Unit::TestCase | @@ -260,6 +260,11 @@ class ProfileTest < Test::Unit::TestCase | ||
| 260 | assert_equal 'http://mycolivre.net/testprofile', profile.url | 260 | assert_equal 'http://mycolivre.net/testprofile', profile.url |
| 261 | end | 261 | end |
| 262 | 262 | ||
| 263 | + should 'provide URL to admin area' do | ||
| 264 | + profile = Profile.create!(:name => "Test Profile", :identifier => 'testprofile', :environment_id => create_environment('mycolivre.net').id) | ||
| 265 | + assert_equal 'http://mycolivre.net/myprofile/testprofile', profile.admin_url | ||
| 266 | + end | ||
| 267 | + | ||
| 263 | should 'generate URL' do | 268 | should 'generate URL' do |
| 264 | profile = Profile.create!(:name => "Test Profile", :identifier => 'testprofile', :environment_id => create_environment('mycolivre.net').id) | 269 | profile = Profile.create!(:name => "Test Profile", :identifier => 'testprofile', :environment_id => create_environment('mycolivre.net').id) |
| 265 | 270 |