Mercurial > hg > soundsoftware-site
comparison app/controllers/my_controller.rb @ 108:d70a0b926135 luisf
Feature #52: All users can now view and edit their description and university
author | luisf |
---|---|
date | Fri, 17 Dec 2010 13:02:30 +0000 |
parents | 94944d00e43c |
children | bb9724ba3d60 |
comparison
equal
deleted
inserted
replaced
107:361f1e8b2e23 | 108:d70a0b926135 |
---|---|
50 | 50 |
51 # Edit user's account | 51 # Edit user's account |
52 def account | 52 def account |
53 @user = User.current | 53 @user = User.current |
54 @pref = @user.pref | 54 @pref = @user.pref |
55 @ssamr_user_details = @user.ssamr_user_detail | |
55 if request.post? | 56 if request.post? |
56 @user.attributes = params[:user] | 57 @user.attributes = params[:user] |
57 @user.mail_notification = params[:notification_option] || 'only_my_events' | 58 @user.mail_notification = params[:notification_option] || 'only_my_events' |
58 @user.pref.attributes = params[:pref] | 59 @user.pref.attributes = params[:pref] |
59 @user.pref[:no_self_notified] = (params[:no_self_notified] == '1') | 60 @user.pref[:no_self_notified] = (params[:no_self_notified] == '1') |
61 | |
62 if @user.ssamr_user_detail == nil | |
63 @ssamr_user_details = SsamrUserDetail.new() | |
64 @user.ssamr_user_detail = @ssamr_user_details | |
65 else | |
66 @ssamr_user_details = @user.ssamr_user_detail | |
67 end | |
68 | |
69 if params[:ssamr_user_details].nil? or params[:ssamr_user_details].empty? | |
70 @ssamr_user_details.description = @user.ssamr_user_detail.description | |
71 @ssamr_user_details.institution_id = @user.ssamr_user_detail.institution_id | |
72 else | |
73 @ssamr_user_details.description = params[:ssamr_user_details][:description] | |
74 @ssamr_user_details.institution_id = params[:ssamr_user_details][:institution_id] | |
75 @ssamr_user_details.save! | |
76 end | |
77 | |
60 if @user.save | 78 if @user.save |
61 @user.pref.save | 79 @user.pref.save |
62 @user.notified_project_ids = (params[:notification_option] == 'selected' ? params[:notified_project_ids] : []) | 80 @user.notified_project_ids = (params[:notification_option] == 'selected' ? params[:notified_project_ids] : []) |
63 set_language_if_valid @user.language | 81 set_language_if_valid @user.language |
64 flash[:notice] = l(:notice_account_updated) | 82 flash[:notice] = l(:notice_account_updated) |