changeset 189:b55279e641b8 cannam-pre-20110113-merge

Merge from branch "feature_55"
author Chris Cannam
date Thu, 03 Feb 2011 15:55:45 +0000
parents 752184172a34 (current diff) f9fe5ef6156e (diff)
children c56dcdfe6722
files
diffstat 5 files changed, 14 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/app/controllers/my_controller.rb	Thu Feb 03 15:34:57 2011 +0000
+++ b/app/controllers/my_controller.rb	Thu Feb 03 15:55:45 2011 +0000
@@ -54,6 +54,13 @@
     @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.attributes = params[:user]
       @user.mail_notification = params[:notification_option] || 'only_my_events'
@@ -63,13 +70,10 @@
       if @user.ssamr_user_detail == nil
         @ssamr_user_details = SsamrUserDetail.new()
         @user.ssamr_user_detail = @ssamr_user_details
-        @selected_institution_id = NULL
       else
         @ssamr_user_details = @user.ssamr_user_detail
-        @selected_institution_id = @ssamr_user_details.institution_id.to_i
       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
@@ -81,8 +85,6 @@
         @ssamr_user_details.institution_type = params[:ssamr_user_details][:institution_type]
         @ssamr_user_details.other_institution = params[:ssamr_user_details][:other_institution]
       end
-
-      @selected_institution_id = @ssamr_user_details.institution_id.to_i
                   
       if @user.save
         @user.pref.save
--- a/app/controllers/users_controller.rb	Thu Feb 03 15:34:57 2011 +0000
+++ b/app/controllers/users_controller.rb	Thu Feb 03 15:55:45 2011 +0000
@@ -189,7 +189,6 @@
       @ssamr_user_details.institution_id = params[:ssamr_user_details][:institution_id]
       @ssamr_user_details.other_institution = params[:ssamr_user_details][:other_institution]
       @ssamr_user_details.institution_type = params[:ssamr_user_details][:institution_type]
-      @ssamr_user_details.save!
     end
 
     if @user.save
--- a/app/views/my/account.rhtml	Thu Feb 03 15:34:57 2011 +0000
+++ b/app/views/my/account.rhtml	Thu Feb 03 15:55:45 2011 +0000
@@ -1,7 +1,4 @@
 <%= javascript_include_tag "ssamr_institutions" %>
-<%= javascript_include_tag "ssamr_registration" %>
-
-
 
 <div class="contextual">
 <%= link_to(l(:button_change_password), :action => 'password') if @user.change_password_allowed? %>
--- a/app/views/users/_form.rhtml	Thu Feb 03 15:34:57 2011 +0000
+++ b/app/views/users/_form.rhtml	Thu Feb 03 15:55:45 2011 +0000
@@ -1,6 +1,5 @@
+<%= javascript_include_tag "ssamr_institutions" %>
 
-<%= javascript_include_tag "ssamr_institutions" %>
-<%= javascript_include_tag "ssamr_registration" %>
 
 <%= error_messages_for 'user' %>
 
--- a/public/javascripts/ssamr_institutions.js	Thu Feb 03 15:34:57 2011 +0000
+++ b/public/javascripts/ssamr_institutions.js	Thu Feb 03 15:55:45 2011 +0000
@@ -19,6 +19,12 @@
         $('ssamr_user_details_other_institution').disable();
     else if($('ssamr_user_details_institution_type_false').checked)
         $('ssamr_user_details_institution_id').disable();
+	else {
+		$('ssamr_user_details_other_institution').disable();
+	  	$('ssamr_user_details_institution_id').enable();
+	  	$('ssamr_user_details_institution_type_true').checked = true;
+	  	$('ssamr_user_details_institution_type_false').checked = false;
+	}
 }
 );