aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/models/user.rb6
-rw-r--r--app/views/body/show.rhtml2
-rw-r--r--app/views/request/show.rhtml2
-rw-r--r--app/views/user/show.rhtml5
4 files changed, 8 insertions, 7 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index 73fe50a3a..f401b9609 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -21,7 +21,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: user.rb,v 1.63 2008-08-27 00:52:07 francis Exp $
+# $Id: user.rb,v 1.64 2008-08-29 12:23:01 francis Exp $
require 'digest/sha1'
@@ -167,6 +167,10 @@ class User < ActiveRecord::Base
def owns_every_request?
self.admin_level == 'super'
end
+ # Does the user get "(admin)" links on each page on the main site?
+ def admin_page_links?
+ self.admin_level == 'super'
+ end
private
diff --git a/app/views/body/show.rhtml b/app/views/body/show.rhtml
index 07cf3ce8e..c7196be85 100644
--- a/app/views/body/show.rhtml
+++ b/app/views/body/show.rhtml
@@ -10,7 +10,7 @@
<p class="subtitle">
<%=@public_body.type_of_authority(true)%> in the UK<% if not @public_body.short_name.empty? %>, also called <%= h(@public_body.short_name) %><% end %>
(<%= link_to "home page", @public_body.calculated_home_page %>)
-<% if !@user.nil? && @user.owns_every_request? %>
+<% if !@user.nil? && @user.admin_page_links? %>
(<%= link_to "admin", public_body_admin_url(@public_body) %>)
<% end %>
</p>
diff --git a/app/views/request/show.rhtml b/app/views/request/show.rhtml
index 5e4b28d2b..b8bc288a2 100644
--- a/app/views/request/show.rhtml
+++ b/app/views/request/show.rhtml
@@ -45,7 +45,7 @@
<%= public_body_link(@info_request.public_body) %>
by
<%= user_link(@info_request.user) %>
- <% if !@user.nil? && @user.owns_every_request? %>
+ <% if !@user.nil? && @user.admin_page_links? %>
(<%= link_to "admin", request_admin_url(@info_request) %>)
<% end %>
</p>
diff --git a/app/views/user/show.rhtml b/app/views/user/show.rhtml
index 834d8792a..59d834e0a 100644
--- a/app/views/user/show.rhtml
+++ b/app/views/user/show.rhtml
@@ -16,12 +16,9 @@
<h1><%=@title%></h1>
<p class="subtitle">
Joined WhatDoTheyKnow on <%= simple_date(@display_user.created_at) %>
- <% if !@user.nil? && @user.owns_every_request? %>
+ <% if !@user.nil? && @user.admin_page_links? %>
(<%= link_to "admin", user_admin_url(@display_user) %>)
<% end %>
- <% if false # @display_user.owns_every_request? # should this be public? %>
- and is a site admin.
- <% end %>
</p>
<p>