From 1225579ea14418ac5603d42d96723f8e85868d1f Mon Sep 17 00:00:00 2001 From: AntonioTerceiro Date: Wed, 12 Sep 2007 01:58:20 +0000 Subject: [PATCH] ActionItem7: viewing profile info --- app/controllers/profile_editor_controller.rb | 3 +++ app/helpers/application_helper.rb | 1 + config/routes.rb | 4 ++-- db/migrate/013_create_person_infos.rb | 2 ++ test/functional/profile_editor_controller_test.rb | 18 ++++++++++++++++++ test/integration/routing_test.rb | 7 ++++++- 6 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 app/controllers/profile_editor_controller.rb create mode 100644 test/functional/profile_editor_controller_test.rb diff --git a/app/controllers/profile_editor_controller.rb b/app/controllers/profile_editor_controller.rb new file mode 100644 index 0000000..48675ec --- /dev/null +++ b/app/controllers/profile_editor_controller.rb @@ -0,0 +1,3 @@ +class ProfileEditorController < ApplicationController + helper :profile +end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 799ca8c..6dd96c2 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -111,6 +111,7 @@ module ApplicationHelper def user_links links = [ ( link_to(_('My account'), { :controller => 'account' }) ), + ( link_to_myprofile(_('My profile'), { :controller => 'profile_editor' }) ), ( link_to_homepage(_('My home page')) ), ( link_to_cms(_('Manage content')) ), ( link_to (_('Manage layout')), :controller => 'edit_template' ), diff --git a/config/routes.rb b/config/routes.rb index b0b7a1e..50a06c1 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -23,8 +23,8 @@ ActionController::Routing::Routes.draw do |map| ## Controllers that are profile-specific (for profile admins ) ###################################################### # profile customization - "My profile" - map.myprofile 'myprofile', :controller => 'myprofile' - map.myprofile 'myprofile/:profile/:controller/:action/:id', :controller => /(enterprise)/ + map.myprofile 'myprofile/:profile', :controller => 'profile_editor', :action => 'index' + map.myprofile 'myprofile/:profile/:controller/:action/:id', :controller => /(enterprise|profile_editor)/ # content administration map.cms 'cms/:profile/:action/:id', :controller => 'cms' diff --git a/db/migrate/013_create_person_infos.rb b/db/migrate/013_create_person_infos.rb index 145823d..46fae21 100644 --- a/db/migrate/013_create_person_infos.rb +++ b/db/migrate/013_create_person_infos.rb @@ -4,6 +4,8 @@ class CreatePersonInfos < ActiveRecord::Migration t.column :photo, :text t.column :address, :text t.column :contact_information, :text + + t.column :person_id, :integer end end diff --git a/test/functional/profile_editor_controller_test.rb b/test/functional/profile_editor_controller_test.rb new file mode 100644 index 0000000..10906ad --- /dev/null +++ b/test/functional/profile_editor_controller_test.rb @@ -0,0 +1,18 @@ +require File.dirname(__FILE__) + '/../test_helper' +require 'profile_editor_controller' + +# Re-raise errors caught by the controller. +class ProfileEditorController; def rescue_action(e) raise e end; end + +class ProfileEditorControllerTest < Test::Unit::TestCase + def setup + @controller = ProfileEditorController.new + @request = ActionController::TestRequest.new + @response = ActionController::TestResponse.new + end + + # Replace this with your real tests. + def test_truth + assert true + end +end diff --git a/test/integration/routing_test.rb b/test/integration/routing_test.rb index a3d3730..509578a 100644 --- a/test/integration/routing_test.rb +++ b/test/integration/routing_test.rb @@ -26,9 +26,14 @@ class RoutingTest < ActionController::IntegrationTest end def test_edit_template + # FIXME: this is wrong assert_routing('/admin/edit_template', :controller => 'edit_template', :action => 'index') end + def test_profile_editor + assert_routing('/myprofile/ze', :profile => 'ze', :controller => 'profile_editor', :action => 'index') + end + # virtual community administrative controllers (admin/*) ################################################################ @@ -45,7 +50,7 @@ class RoutingTest < ActionController::IntegrationTest assert_routing('/admin/manage_tags', :controller => 'manage_tags', :action => 'index') end - # platform administrative controllers (metaadmin/*) + # platform administrative controllers (system/*) ################################################################ # external public controllers -- libgit2 0.21.2