Mercurial > hg > soundsoftware-site
comparison app/controllers/my_controller.rb @ 511:107d36338b70 live
Merge from branch "cannam"
author | Chris Cannam |
---|---|
date | Thu, 14 Jul 2011 10:43:07 +0100 |
parents | ef125e1f3a10 |
children | 5e80956cc792 |
comparison
equal
deleted
inserted
replaced
451:a9f6345cb43d | 511:107d36338b70 |
---|---|
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, |
31 'documents' => :label_document_plural, | 32 'documents' => :label_document_plural, |
32 'timelog' => :label_spent_time | 33 'timelog' => :label_spent_time |
33 }.merge(Redmine::Views::MyPage::Block.additional_blocks).freeze | 34 }.merge(Redmine::Views::MyPage::Block.additional_blocks).freeze |
34 | 35 |
35 DEFAULT_LAYOUT = { 'left' => ['tipoftheday', 'activitymyprojects'], | 36 DEFAULT_LAYOUT = { 'left' => ['tipoftheday', 'activitymyprojects'], |
36 'right' => ['issueswatched','calendar'] | 37 'right' => ['issueswatched'] |
37 }.freeze | 38 }.freeze |
38 | 39 |
39 verify :xhr => true, | 40 verify :xhr => true, |
40 :only => [:add_block, :remove_block, :order_blocks] | 41 :only => [:add_block, :remove_block, :order_blocks] |
41 | 42 |
62 else | 63 else |
63 @selected_institution_id = @ssamr_user_details.institution_id.to_i | 64 @selected_institution_id = @ssamr_user_details.institution_id.to_i |
64 end | 65 end |
65 | 66 |
66 if request.post? | 67 if request.post? |
67 @user.attributes = params[:user] | 68 @user.safe_attributes = params[:user] |
68 @user.mail_notification = params[:notification_option] || 'only_my_events' | |
69 @user.pref.attributes = params[:pref] | 69 @user.pref.attributes = params[:pref] |
70 @user.pref[:no_self_notified] = (params[:no_self_notified] == '1') | 70 @user.pref[:no_self_notified] = (params[:no_self_notified] == '1') |
71 | 71 |
72 if @user.ssamr_user_detail == nil | 72 if @user.ssamr_user_detail == nil |
73 @ssamr_user_details = SsamrUserDetail.new() | 73 @ssamr_user_details = SsamrUserDetail.new() |
88 @ssamr_user_details.other_institution = params[:ssamr_user_details][:other_institution] | 88 @ssamr_user_details.other_institution = params[:ssamr_user_details][:other_institution] |
89 end | 89 end |
90 | 90 |
91 if @user.save | 91 if @user.save |
92 @user.pref.save | 92 @user.pref.save |
93 @user.notified_project_ids = (params[:notification_option] == 'selected' ? params[:notified_project_ids] : []) | 93 @user.notified_project_ids = (@user.mail_notification == 'selected' ? params[:notified_project_ids] : []) |
94 set_language_if_valid @user.language | 94 set_language_if_valid @user.language |
95 flash[:notice] = l(:notice_account_updated) | 95 flash[:notice] = l(:notice_account_updated) |
96 redirect_to :action => 'account' | 96 redirect_to :action => 'account' |
97 return | 97 return |
98 end | 98 end |
99 end | 99 end |
100 @notification_options = @user.valid_notification_options | |
101 @notification_option = @user.mail_notification #? ? 'all' : (@user.notified_projects_ids.empty? ? 'none' : 'selected') | |
102 end | 100 end |
103 | 101 |
104 # Manage user's password | 102 # Manage user's password |
105 def password | 103 def password |
106 @user = User.current | 104 @user = User.current |