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)
<% 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 %>
</div>