Project

General

Profile

« Previous | Next » 

Revision d0ff9068

Added by Marc Dequènes almost 13 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
17 17
		<div id="header">
18 18
			<h1><%= link_to_unless_current "~°~ #{site_name} ~°~", root_path %></h1>
19 19
			<ul class="nav" id="menu">
20
<%
21
  current_user ||= ((session[:user_id] && User.find_by_id(session[:user_id])) || nil)
22
  if current_user
23
%>
20 24
				<li><strong><%= _("Setup the Cyma") %></strong>
21 25
					<ul>
22 26
						<li><%= link_to _("Manage Artworks"), admin_artworks_url %></li>
......
26 30
						<li><%= link_to _("Manage Artwork Sets & Groups"), admin_artwork_sets_url %></li>
27 31
						<li><%= link_to _("Manage Artwork Sizes"), admin_artwork_sizes_url %></li>
28 32
						<li><%= link_to _("Manage Techniques"), admin_techniques_url %></li>
33
<% if current_user.admin %>
34
						<li>-------</li>
35
						<li><%= link_to _("Manage Users"), admin_users_url %></li>
36
<% end %>
29 37
					</ul>
30 38
				</li>
39
<% end %>
31 40
				<li><strong><%= _("About") %></strong>
32 41
					<ul>
33 42
						<li><%= link_to _("Project page"), MyCyma::Info::url, :popup => true %></li>
......
35 44
					</ul>
36 45
				</li>
37 46
			</ul>
38
			<!-- <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> -->
47
			<div id="user_info" style="float: right;text-align: center;"><%= current_user ?
48
                          sprintf(_("Loggued in as '%s'"), current_user.login) + "<br/>(#{link_to _("logout"), { :controller => '/logon', :action => 'logout'}})" :
49
                           _("Not loggued in") + "<br/>(#{link_to _("login"), { :controller => '/logon', :action => 'login'}})"
50
                           %></div>
39 51
		</div>
40 52
		<div style="clear: both;"></div>
41 53
		<%= render_flash_messages %>

Also available in: Unified diff