From 05b73d10bfd62a448e8645b51042e6438f2972eb Mon Sep 17 00:00:00 2001 From: MoisesMachado Date: Thu, 18 Oct 2007 23:35:32 +0000 Subject: [PATCH] ActionItem111: alguns bugs corrigidos e populate melhorado --- app/controllers/public/home_controller.rb | 4 +++- app/helpers/application_helper.rb | 19 +++++++++---------- app/models/person.rb | 8 ++++++++ app/views/role/edit.rhtml | 2 +- script/populate | 15 ++++++++++++++- 5 files changed, 35 insertions(+), 13 deletions(-) diff --git a/app/controllers/public/home_controller.rb b/app/controllers/public/home_controller.rb index 5f3a84b..791c908 100644 --- a/app/controllers/public/home_controller.rb +++ b/app/controllers/public/home_controller.rb @@ -1,5 +1,7 @@ class HomeController < PublicController design :holder => 'environment' - + def index +# redirect_to homepage_path(:profile => 'anhetegua') + end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index f7ef37c..8569ed9 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -118,7 +118,7 @@ module ApplicationHelper ( link_to_homepage(current_user.login) ), ( link_to(_('My account'), { :controller => 'account' }) ), ( link_to_myprofile _('My Enterprises'), {:controller => 'membership_editor'} ), - ( link_to(_('Admin'), { :controller => 'admin_panel' }) if current_user.person.role_assignments.map{|ra| ra.role.permissions}.any?{|ps|ps.any?{|p|ActiveRecord::Base::PERMISSIONS[:environment].keys.include?(p)}}), + ( link_to(_('Admin'), { :controller => 'admin_panel' }) if current_user.person.is_admin?), ].join("\n") content_tag('span', links, :id => 'user_links') end @@ -174,20 +174,19 @@ module ApplicationHelper def person_links links = [ - [(link_to_myprofile _('Edit visual design'), :controller => 'profile_editor', :action => 'design_editor'), 'edit_profile_design', profile], - [(link_to_myprofile _('Edit profile'), :controller => 'profile_editor'), 'edit_profile', profile], - [(link_to_myprofile _('Manage content'), :controller => 'cms'), 'post_content', profile], + [(link_to_myprofile _('Edit visual design'), {:controller => 'profile_editor', :action => 'design_editor'}, profile.identifier), 'edit_profile_design', profile], + [(link_to_myprofile _('Edit profile'), {:controller => 'profile_editor'}, profile.identifier), 'edit_profile', profile], + [(link_to_myprofile _('Manage content'), {:controller => 'cms'}, profile.identifier), 'post_content', profile], ] - end def enterprise_links links = [ - [(link_to_myprofile _('Edit visual design'), :controller => 'profile_editor', :action => 'design_editor'), 'edit_profile_design', profile], - [(link_to_myprofile _('Edit informations'), :controller => 'profile_editor'), 'edit_profile', profile], - [(link_to_myprofile _('Manage content'), :controller => 'cms'), 'post_content', profile], - [(link_to_myprofile _('Exclude'), :controller => 'enterprise_editor', :action => 'destroy'), 'edit_profile', profile], + [(link_to_myprofile _('Edit visual design'), {:controller => 'profile_editor', :action => 'design_editor'}, profile), 'edit_profile_design', profile], + [(link_to_myprofile _('Edit informations'), {:controller => 'profile_editor'}, profile), 'edit_profile', profile], + [(link_to_myprofile _('Manage content'), {:controller => 'cms'}, profile), 'post_content', profile], + [(link_to_myprofile _('Exclude'), {:controller => 'enterprise_editor', :action => 'destroy'}, profile), 'edit_profile', profile], ] end @@ -237,7 +236,7 @@ module ApplicationHelper # Current implementation generates a