summaryrefslogtreecommitdiffstats
path: root/redmine
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2006-12-03 20:51:17 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2006-12-03 20:51:17 +0000
commit948e2190f877fcc7ab93e8b4ab5b80da53a57911 (patch)
tree5d05626a09b7d5eb329ce72cdc50f9f98e8319a3 /redmine
parent362633d486e31503e1b9d82368cd274db4615f9d (diff)
downloadredmine-948e2190f877fcc7ab93e8b4ab5b80da53a57911.tar.gz
redmine-948e2190f877fcc7ab93e8b4ab5b80da53a57911.zip
"hide my email address" preference added, so that it's not displayed on account/show
git-svn-id: http://redmine.rubyforge.org/svn/trunk@63 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'redmine')
-rw-r--r--redmine/app/controllers/my_controller.rb5
-rw-r--r--redmine/app/views/account/show.rhtml2
-rw-r--r--redmine/app/views/my/account.rhtml3
-rw-r--r--redmine/db/migrate/009_add_hide_mail_pref.rb9
-rw-r--r--redmine/lang/de.yml1
-rw-r--r--redmine/lang/en.yml1
-rw-r--r--redmine/lang/es.yml1
-rw-r--r--redmine/lang/fr.yml1
8 files changed, 21 insertions, 2 deletions
diff --git a/redmine/app/controllers/my_controller.rb b/redmine/app/controllers/my_controller.rb
index 25f362df2..ff12b74d7 100644
--- a/redmine/app/controllers/my_controller.rb
+++ b/redmine/app/controllers/my_controller.rb
@@ -44,7 +44,10 @@ class MyController < ApplicationController
# Edit user's account
def account
@user = self.logged_in_user
- if request.post? and @user.update_attributes(@params[:user])
+ @pref = @user.pref
+ @user.attributes = params[:user]
+ @user.pref.attributes = params[:pref]
+ if request.post? and @user.save
set_localization
flash.now[:notice] = l(:notice_account_updated)
self.logged_in_user.reload
diff --git a/redmine/app/views/account/show.rhtml b/redmine/app/views/account/show.rhtml
index 4fa306764..985238951 100644
--- a/redmine/app/views/account/show.rhtml
+++ b/redmine/app/views/account/show.rhtml
@@ -1,7 +1,7 @@
<h2><%= @user.display_name %></h2>
<p>
-<%= mail_to @user.mail %>
+<%= mail_to @user.mail unless @user.pref.hide_mail %>
<ul>
<li><%=l(:label_registered_on)%>: <%= format_date(@user.created_on) %></li>
<% for custom_value in @custom_values %>
diff --git a/redmine/app/views/my/account.rhtml b/redmine/app/views/my/account.rhtml
index 3a2c5f3ad..58b0867eb 100644
--- a/redmine/app/views/my/account.rhtml
+++ b/redmine/app/views/my/account.rhtml
@@ -28,6 +28,9 @@
<p><label for="user_mail_notification"><%=l(:field_mail_notification)%></label>
<%= check_box 'user', 'mail_notification' %></p>
+ <p><label for="pref_hide_mail"><%=l(:field_hide_mail)%></label>
+ <%= check_box 'pref', 'hide_mail' %></p>
+
<center><%= submit_tag l(:button_save) %></center>
<%= end_form_tag %>
</div>
diff --git a/redmine/db/migrate/009_add_hide_mail_pref.rb b/redmine/db/migrate/009_add_hide_mail_pref.rb
new file mode 100644
index 000000000..a22eafd93
--- /dev/null
+++ b/redmine/db/migrate/009_add_hide_mail_pref.rb
@@ -0,0 +1,9 @@
+class AddHideMailPref < ActiveRecord::Migration
+ def self.up
+ add_column :user_preferences, :hide_mail, :boolean, :default => false
+ end
+
+ def self.down
+ remove_column :user_preferences, :hide_mail
+ end
+end
diff --git a/redmine/lang/de.yml b/redmine/lang/de.yml
index 98625237b..7eaa3d05a 100644
--- a/redmine/lang/de.yml
+++ b/redmine/lang/de.yml
@@ -134,6 +134,7 @@ field_attr_mail: Emailattribut
field_onthefly: On-the-fly Benutzerkreation
field_start_date: Beginn
field_done_ratio: %% Getan
+field_hide_mail: Mein email address verstecken
label_user: Benutzer
label_user_plural: Benutzer
diff --git a/redmine/lang/en.yml b/redmine/lang/en.yml
index acdd8c66f..a3aad0467 100644
--- a/redmine/lang/en.yml
+++ b/redmine/lang/en.yml
@@ -134,6 +134,7 @@ field_attr_mail: Email attribute
field_onthefly: On-the-fly user creation
field_start_date: Start
field_done_ratio: %% Done
+field_hide_mail: Hide my email address
label_user: User
label_user_plural: Users
diff --git a/redmine/lang/es.yml b/redmine/lang/es.yml
index 6cfb5c78f..f87a31133 100644
--- a/redmine/lang/es.yml
+++ b/redmine/lang/es.yml
@@ -134,6 +134,7 @@ field_attr_mail: Cualidad del Email
field_onthefly: Creación del usuario On-the-fly
field_start_date: Comienzo
field_done_ratio: %% Realizado
+field_hide_mail: Ocultar mi email address
label_user: Usuario
label_user_plural: Usuarios
diff --git a/redmine/lang/fr.yml b/redmine/lang/fr.yml
index 5530b5152..8e7829b19 100644
--- a/redmine/lang/fr.yml
+++ b/redmine/lang/fr.yml
@@ -135,6 +135,7 @@ field_onthefly: Création des utilisateurs à la volée
field_start_date: Début
field_done_ratio: %% Réalisé
field_auth_source: Mode d'authentification
+field_hide_mail: Cacher mon adresse mail
label_user: Utilisateur
label_user_plural: Utilisateurs