Mercurial > hg > soundsoftware-site
comparison app/controllers/my_controller.rb @ 1484:51364c0cd58f redmine-2.4-integration
Merge from live branch. Still need to merge manually in files overridden by plugins.
author | Chris Cannam |
---|---|
date | Wed, 15 Jan 2014 09:59:14 +0000 |
parents | 261b3d9a4903 097d38a73624 |
children | c86dacc2ef0a |
comparison
equal
deleted
inserted
replaced
1464:261b3d9a4903 | 1484:51364c0cd58f |
---|---|
21 skip_before_filter :check_password_change, :only => :password | 21 skip_before_filter :check_password_change, :only => :password |
22 | 22 |
23 helper :issues | 23 helper :issues |
24 helper :users | 24 helper :users |
25 helper :custom_fields | 25 helper :custom_fields |
26 helper :projects | |
27 helper :activities | |
26 | 28 |
27 BLOCKS = { 'issuesassignedtome' => :label_assigned_to_me_issues, | 29 BLOCKS = { 'issuesassignedtome' => :label_assigned_to_me_issues, |
28 'issuesreportedbyme' => :label_reported_issues, | 30 'issuesreportedbyme' => :label_reported_issues, |
29 'issueswatched' => :label_watched_issues, | 31 'issueswatched' => :label_watched_issues, |
32 'activitymyprojects' => :label_activity_my_recent, | |
30 'news' => :label_news_latest, | 33 'news' => :label_news_latest, |
34 'tipoftheday' => :label_tipoftheday, | |
31 'calendar' => :label_calendar, | 35 'calendar' => :label_calendar, |
32 'documents' => :label_document_plural, | 36 'documents' => :label_document_plural, |
33 'timelog' => :label_spent_time | 37 'timelog' => :label_spent_time, |
38 'myprojects' => :label_my_projects, | |
39 'colleagues' => :label_my_colleagues | |
34 }.merge(Redmine::Views::MyPage::Block.additional_blocks).freeze | 40 }.merge(Redmine::Views::MyPage::Block.additional_blocks).freeze |
35 | 41 |
36 DEFAULT_LAYOUT = { 'left' => ['issuesassignedtome'], | 42 DEFAULT_LAYOUT = { 'left' => ['myprojects', 'activitymyprojects'], |
37 'right' => ['issuesreportedbyme'] | 43 'right' => ['colleagues', 'tipoftheday', 'issueswatched'] |
38 }.freeze | 44 }.freeze |
39 | 45 |
40 def index | 46 def index |
41 page | 47 page |
42 render :action => 'page' | 48 render :action => 'page' |
50 | 56 |
51 # Edit user's account | 57 # Edit user's account |
52 def account | 58 def account |
53 @user = User.current | 59 @user = User.current |
54 @pref = @user.pref | 60 @pref = @user.pref |
61 @ssamr_user_details = @user.ssamr_user_detail | |
62 | |
63 | |
64 if @user.ssamr_user_detail == nil | |
65 @selected_institution_id = nil | |
66 else | |
67 @selected_institution_id = @ssamr_user_details.institution_id.to_i | |
68 end | |
69 | |
55 if request.post? | 70 if request.post? |
56 @user.safe_attributes = params[:user] | 71 @user.safe_attributes = params[:user] |
57 @user.pref.attributes = params[:pref] | 72 @user.pref.attributes = params[:pref] |
73 | |
74 @user.pref[:no_self_notified] = (params[:no_self_notified] == '1') | |
75 | |
76 if @user.ssamr_user_detail == nil | |
77 @ssamr_user_details = SsamrUserDetail.new() | |
78 @user.ssamr_user_detail = @ssamr_user_details | |
79 else | |
80 @ssamr_user_details = @user.ssamr_user_detail | |
81 end | |
82 | |
83 if params[:ssamr_user_details].nil? or params[:ssamr_user_details].empty? | |
84 @ssamr_user_details.description = @user.ssamr_user_detail.description | |
85 @ssamr_user_details.institution_id = @user.ssamr_user_detail.institution_id | |
86 @institution_type = @ssamr_user_details.institution_type | |
87 @other_institution = @ssamr_user_details.other_institution | |
88 else | |
89 @ssamr_user_details.description = params[:ssamr_user_details][:description] | |
90 @ssamr_user_details.institution_id = params[:ssamr_user_details][:institution_id] | |
91 @ssamr_user_details.institution_type = params[:ssamr_user_details][:institution_type] | |
92 @ssamr_user_details.other_institution = params[:ssamr_user_details][:other_institution] | |
93 end | |
94 | |
58 if @user.save | 95 if @user.save |
59 @user.pref.save | 96 @user.pref.save |
60 set_language_if_valid @user.language | 97 set_language_if_valid @user.language |
61 flash[:notice] = l(:notice_account_updated) | 98 flash[:notice] = l(:notice_account_updated) |
62 redirect_to my_account_path | 99 redirect_to my_account_path |