From 97f0da0b1a6f1d55e5c87558a0cbaa847cedba20 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 30 Dec 2007 11:44:46 +0000 Subject: [PATCH] Moved login and logout links to ApplicationHelper methods for easier customization. git-svn-id: http://redmine.rubyforge.org/svn/trunk@1030 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/helpers/application_helper.rb | 8 ++++++++ app/views/layouts/base.rhtml | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 7f412e730..2c6a1ba49 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -31,6 +31,14 @@ module ApplicationHelper def link_to_if_authorized(name, options = {}, html_options = nil, *parameters_for_method_reference) link_to(name, options, html_options, *parameters_for_method_reference) if authorize_for(options[:controller] || params[:controller], options[:action]) end + + def link_to_signin + link_to l(:label_login), { :controller => 'account', :action => 'login' }, :class => 'signin' + end + + def link_to_signout + link_to l(:label_logout), { :controller => 'account', :action => 'logout' }, :class => 'logout' + end # Display a link to user's account page def link_to_user(user) diff --git a/app/views/layouts/base.rhtml b/app/views/layouts/base.rhtml index c98f2b45b..5f85c78f8 100644 --- a/app/views/layouts/base.rhtml +++ b/app/views/layouts/base.rhtml @@ -23,9 +23,9 @@ <% if User.current.logged? %> <%=l(:label_logged_as)%> <%= User.current.login %> - <%= link_to l(:label_my_account), { :controller => 'my', :action => 'account' }, :class => 'myaccount' %> - <%= link_to l(:label_logout), { :controller => 'account', :action => 'logout' }, :class => 'logout' %> + <%= link_to_signout %> <% else %> - <%= link_to l(:label_login), { :controller => 'account', :action => 'login' }, :class => 'signin' %> + <%= link_to_signin %> <%= link_to(l(:label_register), { :controller => 'account',:action => 'register' }, :class => 'register') if Setting.self_registration? %> <% end %> -- 2.39.5