Commit f619be458f482b0e9159d6cbdd2151f950cdde14

Authored by Antonio Terceiro
1 parent f73c8033

Only show the "admin" link for admins

(ActionItem1608)
app/views/layouts/application-ng.rhtml
... ... @@ -44,7 +44,7 @@
44 44 <div id="user">
45 45 <span class='logged-in' style='display: none;'>
46 46 <%= _('Welcome, %s.') % link_to('<i></i><strong>%{login}</strong>', '/%{login}', :id => "homepage-link", :title => _('Go to your homepage')) %>
47   - <%= link_to('<i class="icon-menu-admin"></i><strong>' + _('Administration') + '</strong>', { :controller => 'admin_panel', :action => 'index' }, :id => "controlpanel", :title => _("Configure the environment"), :class => 'admin-link') %>
  47 + <%= link_to('<i class="icon-menu-admin"></i><strong>' + _('Administration') + '</strong>', { :controller => 'admin_panel', :action => 'index' }, :id => "controlpanel", :title => _("Configure the environment"), :class => 'admin-link', :style => 'display: none') %>
48 48 <%= link_to('<i class="icon-menu-ctrl-panel"></i><strong>' + _('Control panel') + '</strong>', '/myprofile/%{login}', :id => "controlpanel", :title => _("Configure your personal account and content")) %>
49 49 <%= link_to('<i class="icon-menu-logout"></i><strong>' + _('Logout') + '</strong>', { :controller => 'account', :action => 'logout'} , :id => "logout", :title => _("Leave the system")) %>
50 50 </span>
... ...
public/javascripts/application.js
... ... @@ -446,6 +446,9 @@ jQuery(function($) {
446 446 });
447 447 var html = $(this).html().replace('%{login}', data.login).replace('%{month}', data.since_month).replace('%{year}', data.since_year);
448 448 $(this).html(html).fadeIn();
  449 + if (data.is_admin) {
  450 + $('#user .admin-link').show();
  451 + }
449 452 });
450 453 } else {
451 454 // not logged in
... ...