Commit 1225579ea14418ac5603d42d96723f8e85868d1f

Authored by AntonioTerceiro
1 parent 7923f4ff

ActionItem7: viewing profile info



git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@454 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/controllers/profile_editor_controller.rb 0 → 100644
... ... @@ -0,0 +1,3 @@
  1 +class ProfileEditorController < ApplicationController
  2 + helper :profile
  3 +end
... ...
app/helpers/application_helper.rb
... ... @@ -111,6 +111,7 @@ module ApplicationHelper
111 111 def user_links
112 112 links = [
113 113 ( link_to(_('My account'), { :controller => 'account' }) ),
  114 + ( link_to_myprofile(_('My profile'), { :controller => 'profile_editor' }) ),
114 115 ( link_to_homepage(_('My home page')) ),
115 116 ( link_to_cms(_('Manage content')) ),
116 117 ( link_to (_('Manage layout')), :controller => 'edit_template' ),
... ...
config/routes.rb
... ... @@ -23,8 +23,8 @@ ActionController::Routing::Routes.draw do |map|
23 23 ## Controllers that are profile-specific (for profile admins )
24 24 ######################################################
25 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 28 # content administration
29 29 map.cms 'cms/:profile/:action/:id', :controller => 'cms'
30 30  
... ...
db/migrate/013_create_person_infos.rb
... ... @@ -4,6 +4,8 @@ class CreatePersonInfos &lt; ActiveRecord::Migration
4 4 t.column :photo, :text
5 5 t.column :address, :text
6 6 t.column :contact_information, :text
  7 +
  8 + t.column :person_id, :integer
7 9 end
8 10 end
9 11  
... ...
test/functional/profile_editor_controller_test.rb 0 → 100644
... ... @@ -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 &lt; ActionController::IntegrationTest
26 26 end
27 27  
28 28 def test_edit_template
  29 + # FIXME: this is wrong
29 30 assert_routing('/admin/edit_template', :controller => 'edit_template', :action => 'index')
30 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 37 # virtual community administrative controllers (admin/*)
33 38 ################################################################
34 39  
... ... @@ -45,7 +50,7 @@ class RoutingTest &lt; ActionController::IntegrationTest
45 50 assert_routing('/admin/manage_tags', :controller => 'manage_tags', :action => 'index')
46 51 end
47 52  
48   - # platform administrative controllers (metaadmin/*)
  53 + # platform administrative controllers (system/*)
49 54 ################################################################
50 55  
51 56 # external public controllers
... ...