Commit f619be458f482b0e9159d6cbdd2151f950cdde14
1 parent
f73c8033
Exists in
master
and in
29 other branches
Only show the "admin" link for admins
(ActionItem1608)
Showing
2 changed files
with
4 additions
and
1 deletions
Show diff stats
app/views/layouts/application-ng.rhtml
@@ -44,7 +44,7 @@ | @@ -44,7 +44,7 @@ | ||
44 | <div id="user"> | 44 | <div id="user"> |
45 | <span class='logged-in' style='display: none;'> | 45 | <span class='logged-in' style='display: none;'> |
46 | <%= _('Welcome, %s.') % link_to('<i></i><strong>%{login}</strong>', '/%{login}', :id => "homepage-link", :title => _('Go to your homepage')) %> | 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 | <%= link_to('<i class="icon-menu-ctrl-panel"></i><strong>' + _('Control panel') + '</strong>', '/myprofile/%{login}', :id => "controlpanel", :title => _("Configure your personal account and content")) %> | 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 | <%= link_to('<i class="icon-menu-logout"></i><strong>' + _('Logout') + '</strong>', { :controller => 'account', :action => 'logout'} , :id => "logout", :title => _("Leave the system")) %> | 49 | <%= link_to('<i class="icon-menu-logout"></i><strong>' + _('Logout') + '</strong>', { :controller => 'account', :action => 'logout'} , :id => "logout", :title => _("Leave the system")) %> |
50 | </span> | 50 | </span> |
public/javascripts/application.js
@@ -446,6 +446,9 @@ jQuery(function($) { | @@ -446,6 +446,9 @@ jQuery(function($) { | ||
446 | }); | 446 | }); |
447 | var html = $(this).html().replace('%{login}', data.login).replace('%{month}', data.since_month).replace('%{year}', data.since_year); | 447 | var html = $(this).html().replace('%{login}', data.login).replace('%{month}', data.since_month).replace('%{year}', data.since_year); |
448 | $(this).html(html).fadeIn(); | 448 | $(this).html(html).fadeIn(); |
449 | + if (data.is_admin) { | ||
450 | + $('#user .admin-link').show(); | ||
451 | + } | ||
449 | }); | 452 | }); |
450 | } else { | 453 | } else { |
451 | // not logged in | 454 | // not logged in |