"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
This commit is contained in:
Jean-Philippe Lang 2006-12-03 20:51:17 +00:00
parent 362633d486
commit 948e2190f8
8 changed files with 21 additions and 2 deletions

View File

@ -44,7 +44,10 @@ class MyController < ApplicationController
# Edit user's account # Edit user's account
def account def account
@user = self.logged_in_user @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 set_localization
flash.now[:notice] = l(:notice_account_updated) flash.now[:notice] = l(:notice_account_updated)
self.logged_in_user.reload self.logged_in_user.reload

View File

@ -1,7 +1,7 @@
<h2><%= @user.display_name %></h2> <h2><%= @user.display_name %></h2>
<p> <p>
<%= mail_to @user.mail %> <%= mail_to @user.mail unless @user.pref.hide_mail %>
<ul> <ul>
<li><%=l(:label_registered_on)%>: <%= format_date(@user.created_on) %></li> <li><%=l(:label_registered_on)%>: <%= format_date(@user.created_on) %></li>
<% for custom_value in @custom_values %> <% for custom_value in @custom_values %>

View File

@ -28,6 +28,9 @@
<p><label for="user_mail_notification"><%=l(:field_mail_notification)%></label> <p><label for="user_mail_notification"><%=l(:field_mail_notification)%></label>
<%= check_box 'user', 'mail_notification' %></p> <%= 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> <center><%= submit_tag l(:button_save) %></center>
<%= end_form_tag %> <%= end_form_tag %>
</div> </div>

View File

@ -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

View File

@ -134,6 +134,7 @@ field_attr_mail: Emailattribut
field_onthefly: On-the-fly Benutzerkreation field_onthefly: On-the-fly Benutzerkreation
field_start_date: Beginn field_start_date: Beginn
field_done_ratio: %% Getan field_done_ratio: %% Getan
field_hide_mail: Mein email address verstecken
label_user: Benutzer label_user: Benutzer
label_user_plural: Benutzer label_user_plural: Benutzer

View File

@ -134,6 +134,7 @@ field_attr_mail: Email attribute
field_onthefly: On-the-fly user creation field_onthefly: On-the-fly user creation
field_start_date: Start field_start_date: Start
field_done_ratio: %% Done field_done_ratio: %% Done
field_hide_mail: Hide my email address
label_user: User label_user: User
label_user_plural: Users label_user_plural: Users

View File

@ -134,6 +134,7 @@ field_attr_mail: Cualidad del Email
field_onthefly: Creación del usuario On-the-fly field_onthefly: Creación del usuario On-the-fly
field_start_date: Comienzo field_start_date: Comienzo
field_done_ratio: %% Realizado field_done_ratio: %% Realizado
field_hide_mail: Ocultar mi email address
label_user: Usuario label_user: Usuario
label_user_plural: Usuarios label_user_plural: Usuarios

View File

@ -135,6 +135,7 @@ field_onthefly: Création des utilisateurs à la volée
field_start_date: Début field_start_date: Début
field_done_ratio: %% Réalisé field_done_ratio: %% Réalisé
field_auth_source: Mode d'authentification field_auth_source: Mode d'authentification
field_hide_mail: Cacher mon adresse mail
label_user: Utilisateur label_user: Utilisateur
label_user_plural: Utilisateurs label_user_plural: Utilisateurs