Project

General

Profile

« Previous | Next » 

Revision d0ff9068

Added by Marc Dequènes over 15 years ago

  • ID d0ff90685657026f9316e7455a54dc35690a97eb

[evol] created a simple logon system, protected admin pages, and added a logon indicator/link (no user management yet, only a deadend entry in the menu if admin)

View differences:

app/views/layouts/application.rhtml
<div id="header">
<h1><%= link_to_unless_current "~°~ #{site_name} ~°~", root_path %></h1>
<ul class="nav" id="menu">
<%
current_user ||= ((session[:user_id] && User.find_by_id(session[:user_id])) || nil)
if current_user
%>
<li><strong><%= _("Setup the Cyma") %></strong>
<ul>
<li><%= link_to _("Manage Artworks"), admin_artworks_url %></li>
......
<li><%= link_to _("Manage Artwork Sets & Groups"), admin_artwork_sets_url %></li>
<li><%= link_to _("Manage Artwork Sizes"), admin_artwork_sizes_url %></li>
<li><%= link_to _("Manage Techniques"), admin_techniques_url %></li>
<% if current_user.admin %>
<li>-------</li>
<li><%= link_to _("Manage Users"), admin_users_url %></li>
<% end %>
</ul>
</li>
<% end %>
<li><strong><%= _("About") %></strong>
<ul>
<li><%= link_to _("Project page"), MyCyma::Info::url, :popup => true %></li>
......
</ul>
</li>
</ul>
<!-- <div id="user_info" style="float: right;text-align: center;"><%= session[:login] ? "Loggued in as '#{session[:login]}'<br/>(#{link_to "logout", { :controller => 'logon', :action => 'logout'}})" : "Not loggued in" %></div> -->
<div id="user_info" style="float: right;text-align: center;"><%= current_user ?
sprintf(_("Loggued in as '%s'"), current_user.login) + "<br/>(#{link_to _("logout"), { :controller => '/logon', :action => 'logout'}})" :
_("Not loggued in") + "<br/>(#{link_to _("login"), { :controller => '/logon', :action => 'login'}})"
%></div>
</div>
<div style="clear: both;"></div>
<%= render_flash_messages %>

Also available in: Unified diff