Mercurial > hg > soundsoftware-site
comparison app/controllers/my_controller.rb @ 117:af80e5618e9b redmine-1.1
* Update to Redmine 1.1-stable branch (Redmine SVN rev 4707)
author | Chris Cannam |
---|---|
date | Thu, 13 Jan 2011 12:53:21 +0000 |
parents | 94944d00e43c |
children | 73ff0e6a11b1 cbb26bc654de |
comparison
equal
deleted
inserted
replaced
39:150ceac17a8d | 117:af80e5618e9b |
---|---|
17 | 17 |
18 class MyController < ApplicationController | 18 class MyController < ApplicationController |
19 before_filter :require_login | 19 before_filter :require_login |
20 | 20 |
21 helper :issues | 21 helper :issues |
22 helper :users | |
22 helper :custom_fields | 23 helper :custom_fields |
23 | 24 |
24 BLOCKS = { 'issuesassignedtome' => :label_assigned_to_me_issues, | 25 BLOCKS = { 'issuesassignedtome' => :label_assigned_to_me_issues, |
25 'issuesreportedbyme' => :label_reported_issues, | 26 'issuesreportedbyme' => :label_reported_issues, |
26 'issueswatched' => :label_watched_issues, | 27 'issueswatched' => :label_watched_issues, |
51 # Edit user's account | 52 # Edit user's account |
52 def account | 53 def account |
53 @user = User.current | 54 @user = User.current |
54 @pref = @user.pref | 55 @pref = @user.pref |
55 if request.post? | 56 if request.post? |
56 @user.attributes = params[:user] | 57 @user.safe_attributes = params[:user] |
57 @user.mail_notification = params[:notification_option] || 'only_my_events' | |
58 @user.pref.attributes = params[:pref] | 58 @user.pref.attributes = params[:pref] |
59 @user.pref[:no_self_notified] = (params[:no_self_notified] == '1') | 59 @user.pref[:no_self_notified] = (params[:no_self_notified] == '1') |
60 if @user.save | 60 if @user.save |
61 @user.pref.save | 61 @user.pref.save |
62 @user.notified_project_ids = (params[:notification_option] == 'selected' ? params[:notified_project_ids] : []) | 62 @user.notified_project_ids = (@user.mail_notification == 'selected' ? params[:notified_project_ids] : []) |
63 set_language_if_valid @user.language | 63 set_language_if_valid @user.language |
64 flash[:notice] = l(:notice_account_updated) | 64 flash[:notice] = l(:notice_account_updated) |
65 redirect_to :action => 'account' | 65 redirect_to :action => 'account' |
66 return | 66 return |
67 end | 67 end |
68 end | 68 end |
69 @notification_options = @user.valid_notification_options | |
70 @notification_option = @user.mail_notification #? ? 'all' : (@user.notified_projects_ids.empty? ? 'none' : 'selected') | |
71 end | 69 end |
72 | 70 |
73 # Manage user's password | 71 # Manage user's password |
74 def password | 72 def password |
75 @user = User.current | 73 @user = User.current |