Commit 1225579ea14418ac5603d42d96723f8e85868d1f
1 parent
7923f4ff
Exists in
master
and in
23 other branches
ActionItem7: viewing profile info
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@454 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
6 changed files
with
32 additions
and
3 deletions
Show diff stats
app/helpers/application_helper.rb
| @@ -111,6 +111,7 @@ module ApplicationHelper | @@ -111,6 +111,7 @@ module ApplicationHelper | ||
| 111 | def user_links | 111 | def user_links |
| 112 | links = [ | 112 | links = [ |
| 113 | ( link_to(_('My account'), { :controller => 'account' }) ), | 113 | ( link_to(_('My account'), { :controller => 'account' }) ), |
| 114 | + ( link_to_myprofile(_('My profile'), { :controller => 'profile_editor' }) ), | ||
| 114 | ( link_to_homepage(_('My home page')) ), | 115 | ( link_to_homepage(_('My home page')) ), |
| 115 | ( link_to_cms(_('Manage content')) ), | 116 | ( link_to_cms(_('Manage content')) ), |
| 116 | ( link_to (_('Manage layout')), :controller => 'edit_template' ), | 117 | ( link_to (_('Manage layout')), :controller => 'edit_template' ), |
config/routes.rb
| @@ -23,8 +23,8 @@ ActionController::Routing::Routes.draw do |map| | @@ -23,8 +23,8 @@ ActionController::Routing::Routes.draw do |map| | ||
| 23 | ## Controllers that are profile-specific (for profile admins ) | 23 | ## Controllers that are profile-specific (for profile admins ) |
| 24 | ###################################################### | 24 | ###################################################### |
| 25 | # profile customization - "My profile" | 25 | # profile customization - "My profile" |
| 26 | - map.myprofile 'myprofile', :controller => 'myprofile' | ||
| 27 | - map.myprofile 'myprofile/:profile/:controller/:action/:id', :controller => /(enterprise)/ | 26 | + map.myprofile 'myprofile/:profile', :controller => 'profile_editor', :action => 'index' |
| 27 | + map.myprofile 'myprofile/:profile/:controller/:action/:id', :controller => /(enterprise|profile_editor)/ | ||
| 28 | # content administration | 28 | # content administration |
| 29 | map.cms 'cms/:profile/:action/:id', :controller => 'cms' | 29 | map.cms 'cms/:profile/:action/:id', :controller => 'cms' |
| 30 | 30 |
db/migrate/013_create_person_infos.rb
| @@ -4,6 +4,8 @@ class CreatePersonInfos < ActiveRecord::Migration | @@ -4,6 +4,8 @@ class CreatePersonInfos < ActiveRecord::Migration | ||
| 4 | t.column :photo, :text | 4 | t.column :photo, :text |
| 5 | t.column :address, :text | 5 | t.column :address, :text |
| 6 | t.column :contact_information, :text | 6 | t.column :contact_information, :text |
| 7 | + | ||
| 8 | + t.column :person_id, :integer | ||
| 7 | end | 9 | end |
| 8 | end | 10 | end |
| 9 | 11 |
| @@ -0,0 +1,18 @@ | @@ -0,0 +1,18 @@ | ||
| 1 | +require File.dirname(__FILE__) + '/../test_helper' | ||
| 2 | +require 'profile_editor_controller' | ||
| 3 | + | ||
| 4 | +# Re-raise errors caught by the controller. | ||
| 5 | +class ProfileEditorController; def rescue_action(e) raise e end; end | ||
| 6 | + | ||
| 7 | +class ProfileEditorControllerTest < Test::Unit::TestCase | ||
| 8 | + def setup | ||
| 9 | + @controller = ProfileEditorController.new | ||
| 10 | + @request = ActionController::TestRequest.new | ||
| 11 | + @response = ActionController::TestResponse.new | ||
| 12 | + end | ||
| 13 | + | ||
| 14 | + # Replace this with your real tests. | ||
| 15 | + def test_truth | ||
| 16 | + assert true | ||
| 17 | + end | ||
| 18 | +end |
test/integration/routing_test.rb
| @@ -26,9 +26,14 @@ class RoutingTest < ActionController::IntegrationTest | @@ -26,9 +26,14 @@ class RoutingTest < ActionController::IntegrationTest | ||
| 26 | end | 26 | end |
| 27 | 27 | ||
| 28 | def test_edit_template | 28 | def test_edit_template |
| 29 | + # FIXME: this is wrong | ||
| 29 | assert_routing('/admin/edit_template', :controller => 'edit_template', :action => 'index') | 30 | assert_routing('/admin/edit_template', :controller => 'edit_template', :action => 'index') |
| 30 | end | 31 | end |
| 31 | 32 | ||
| 33 | + def test_profile_editor | ||
| 34 | + assert_routing('/myprofile/ze', :profile => 'ze', :controller => 'profile_editor', :action => 'index') | ||
| 35 | + end | ||
| 36 | + | ||
| 32 | # virtual community administrative controllers (admin/*) | 37 | # virtual community administrative controllers (admin/*) |
| 33 | ################################################################ | 38 | ################################################################ |
| 34 | 39 | ||
| @@ -45,7 +50,7 @@ class RoutingTest < ActionController::IntegrationTest | @@ -45,7 +50,7 @@ class RoutingTest < ActionController::IntegrationTest | ||
| 45 | assert_routing('/admin/manage_tags', :controller => 'manage_tags', :action => 'index') | 50 | assert_routing('/admin/manage_tags', :controller => 'manage_tags', :action => 'index') |
| 46 | end | 51 | end |
| 47 | 52 | ||
| 48 | - # platform administrative controllers (metaadmin/*) | 53 | + # platform administrative controllers (system/*) |
| 49 | ################################################################ | 54 | ################################################################ |
| 50 | 55 | ||
| 51 | # external public controllers | 56 | # external public controllers |