From 8e26b58a58b890b394e970e9afef57644b379e9b Mon Sep 17 00:00:00 2001 From: bsag Date: Sat, 18 Feb 2006 19:38:43 +0000 Subject: [PATCH] Added code to hide the admin_email field from non-admin users. It should only be set by the admin user, and other users don't need to see it unless they encounter the /login/nosignup page. git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@189 a4c988fc-2ded-0310-b66e-134b36920a42 --- tracks/app/views/user/preference_edit_form.rhtml | 5 ++++- tracks/app/views/user/preferences.rhtml | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tracks/app/views/user/preference_edit_form.rhtml b/tracks/app/views/user/preference_edit_form.rhtml index 0a112b4f..87ef509d 100644 --- a/tracks/app/views/user/preference_edit_form.rhtml +++ b/tracks/app/views/user/preference_edit_form.rhtml @@ -5,7 +5,9 @@
  • staleness_starts: the number of days before items with no due date get marked as stale (with a yellow highlight)
  • date_format: the format in which you'd like dates to be shown. For example, for the date 31st January 2006, %d/%m/%Y will show 31/01/2006, %b-%e-%y will show Jan-31-06. See the strftime manual for more formatting options for the date.
  • no_completed: number of completed actions to show on the home page
  • -
  • admin_email: email address for the admin user of Tracks (displayed on the signup page for users to contact to obtain an account)
  • + <% if @user.is_admin? %> +
  • admin_email: email address for the admin user of Tracks (displayed on the signup page for users to contact to obtain an account)
  • + <% end %>
  • week_starts: day of the week shown as the start of the week on the popup calendar. 0 = Sunday, 1 = Monday etc.
  • due_style: style in which due dates for the range 2-7 days away is shown. 0 = "Due in 3 days", 1 = "Due on Wednesday"
  • @@ -15,6 +17,7 @@ <%= start_form_tag :action => 'update_preferences' %> <% @prefs.each do |k,v| %> + <% next if !@user.is_admin? and k == "admin_email" %> diff --git a/tracks/app/views/user/preferences.rhtml b/tracks/app/views/user/preferences.rhtml index ecc53b13..f9da66a8 100644 --- a/tracks/app/views/user/preferences.rhtml +++ b/tracks/app/views/user/preferences.rhtml @@ -8,7 +8,9 @@
  • Show the last <%= @prefs["no_completed"] %> completed items on the home page
  • Staleness starts after <%= @prefs["staleness_starts"] %> days
  • Due style: <%= @prefs["due_style"] %>
  • -
  • Admin email: <%= @prefs["admin_email"] %>
  • + <% if @user.is_admin? %> +
  • Admin email: <%= @prefs["admin_email"] %>
  • + <% end %> <%= link_to "Edit preferences", :controller => 'user', :action => 'edit_preferences' %>