diff 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
line wrap: on
line diff
--- a/app/controllers/my_controller.rb	Tue Jan 14 14:37:42 2014 +0000
+++ b/app/controllers/my_controller.rb	Wed Jan 15 09:59:14 2014 +0000
@@ -23,18 +23,24 @@
   helper :issues
   helper :users
   helper :custom_fields
+  helper :projects
+  helper :activities
 
   BLOCKS = { 'issuesassignedtome' => :label_assigned_to_me_issues,
              'issuesreportedbyme' => :label_reported_issues,
              'issueswatched' => :label_watched_issues,
+             'activitymyprojects' => :label_activity_my_recent,
              'news' => :label_news_latest,
+             'tipoftheday' => :label_tipoftheday,
              'calendar' => :label_calendar,
              'documents' => :label_document_plural,
-             'timelog' => :label_spent_time
+             'timelog' => :label_spent_time,
+             'myprojects' => :label_my_projects,
+             'colleagues' => :label_my_colleagues
            }.merge(Redmine::Views::MyPage::Block.additional_blocks).freeze
 
-  DEFAULT_LAYOUT = {  'left' => ['issuesassignedtome'],
-                      'right' => ['issuesreportedbyme']
+  DEFAULT_LAYOUT = {  'left' => ['myprojects', 'activitymyprojects'], 
+                      'right' => ['colleagues', 'tipoftheday', 'issueswatched'] 
                    }.freeze
 
   def index
@@ -52,9 +58,40 @@
   def account
     @user = User.current
     @pref = @user.pref
+    @ssamr_user_details = @user.ssamr_user_detail
+    
+    
+    if @user.ssamr_user_detail == nil
+       @selected_institution_id = nil
+     else
+       @selected_institution_id = @ssamr_user_details.institution_id.to_i
+     end    
+    
     if request.post?
       @user.safe_attributes = params[:user]
       @user.pref.attributes = params[:pref]
+
+      @user.pref[:no_self_notified] = (params[:no_self_notified] == '1')
+
+      if @user.ssamr_user_detail == nil
+        @ssamr_user_details = SsamrUserDetail.new()
+        @user.ssamr_user_detail = @ssamr_user_details
+      else
+        @ssamr_user_details = @user.ssamr_user_detail
+      end
+
+      if params[:ssamr_user_details].nil? or params[:ssamr_user_details].empty?
+        @ssamr_user_details.description = @user.ssamr_user_detail.description
+        @ssamr_user_details.institution_id = @user.ssamr_user_detail.institution_id
+        @institution_type = @ssamr_user_details.institution_type
+        @other_institution = @ssamr_user_details.other_institution
+      else
+        @ssamr_user_details.description = params[:ssamr_user_details][:description]
+        @ssamr_user_details.institution_id = params[:ssamr_user_details][:institution_id]
+        @ssamr_user_details.institution_type = params[:ssamr_user_details][:institution_type]
+        @ssamr_user_details.other_institution = params[:ssamr_user_details][:other_institution]
+      end
+                  
       if @user.save
         @user.pref.save
         set_language_if_valid @user.language