# HG changeset patch # User Chris Cannam # Date 1297084596 0 # Node ID c56dcdfe67225328ab3be4bcb13eb3bfe0403153 # Parent b55279e641b897c4a63a072191dfde1cea2c0cd9# Parent d1713ab108133933412d2422aefc9fa3d25c03f6 Merge from branch "feature_64" diff -r b55279e641b8 -r c56dcdfe6722 app/controllers/account_controller.rb --- a/app/controllers/account_controller.rb Thu Feb 03 15:55:45 2011 +0000 +++ b/app/controllers/account_controller.rb Mon Feb 07 13:16:36 2011 +0000 @@ -108,7 +108,9 @@ # associates the 2 objects @user.ssamr_user_detail = @ssamr_user_details + @selected_institution_id = params[:ssamr_user_details][:institution_id].to_i + case Setting.self_registration when '1' register_by_email_activation(@user) diff -r b55279e641b8 -r c56dcdfe6722 app/models/user.rb --- a/app/models/user.rb Thu Feb 03 15:55:45 2011 +0000 +++ b/app/models/user.rb Mon Feb 07 13:16:36 2011 +0000 @@ -79,6 +79,8 @@ validates_length_of :mail, :maximum => 60, :allow_nil => true validates_confirmation_of :password, :allow_nil => true + validates_acceptance_of :terms_and_conditions, :on => :create, :message => :must_accept_terms_and_conditions + def before_create self.mail_notification = Setting.default_notification_option if self.mail_notification.blank? true diff -r b55279e641b8 -r c56dcdfe6722 app/views/account/register.rhtml --- a/app/views/account/register.rhtml Thu Feb 03 15:55:45 2011 +0000 +++ b/app/views/account/register.rhtml Mon Feb 07 13:16:36 2011 +0000 @@ -43,7 +43,7 @@
<%= ssamr_user_detail.radio_button :institution_type, true %> - <%= ssamr_user_detail.collection_select(:institution_id, Institution.find(:all, :order => "institutions.order"), :id, :name, {:prompt => true}).gsub('&', '&') %> + <%= ssamr_user_detail.collection_select(:institution_id, Institution.find(:all, :order => "institutions.order"), :id, :name, {:selected => @selected_institution_id, :prompt => true}).gsub('&', '&') %>
@@ -63,5 +63,9 @@
+<%= check_box :user, :terms_and_conditions %> <%= l(:accept_terms_and_conditions) %> <%= link_to("Terms and Conditions", "https://code.soundsoftware.ac.uk/projects/soundsoftware-site/wiki/TandCs", {:target => "_blank"}) %>.
+
+
+
<%= submit_tag l(:button_submit) %>
<% end %>
diff -r b55279e641b8 -r c56dcdfe6722 config/locales/en-GB.yml
--- a/config/locales/en-GB.yml Thu Feb 03 15:55:45 2011 +0000
+++ b/config/locales/en-GB.yml Mon Feb 07 13:16:36 2011 +0000
@@ -123,6 +123,7 @@
not_same_project: "doesn't belong to the same project"
circular_dependency: "This relation would create a circular dependency"
cant_link_an_issue_with_a_descendant: "An issue can not be linked to one of its subtasks"
+ must_accept_terms_and_conditions: "You must accept the Terms and Conditions"
actionview_instancetag_blank_option: Please select
@@ -417,6 +418,8 @@
label_tipoftheday: Tip of the day
label_notifications: Important Message
+ field_terms_and_conditions: 'Terms and Conditions:'
+ accept_terms_and_conditions: 'I have read and agree with the '
label_ssamr_description: Research description
label_ssamr_details: Other Details
label_ssamr_institution: Institution
diff -r b55279e641b8 -r c56dcdfe6722 config/locales/en.yml
--- a/config/locales/en.yml Thu Feb 03 15:55:45 2011 +0000
+++ b/config/locales/en.yml Mon Feb 07 13:16:36 2011 +0000
@@ -86,7 +86,6 @@
gb: "GB"
tb: "TB"
-
# Used in array.to_sentence.
support:
array:
@@ -120,6 +119,7 @@
not_same_project: "doesn't belong to the same project"
circular_dependency: "This relation would create a circular dependency"
cant_link_an_issue_with_a_descendant: "An issue can not be linked to one of its subtasks"
+ must_accept_terms_and_conditions: "You must accept the Terms and Conditions"
actionview_instancetag_blank_option: Please select
@@ -308,6 +308,8 @@
setting_tipoftheday_text: Tip of the Day
setting_notifications_text: Notifications
+ field_terms_and_conditions: 'Terms and Conditions:'
+ accept_terms_and_conditions: 'I have read and agree with the '
label_ssamr_description: Research description
setting_app_title: Application title
setting_app_subtitle: Application subtitle
diff -r b55279e641b8 -r c56dcdfe6722 public/javascripts/ssamr_registration.js
--- a/public/javascripts/ssamr_registration.js Thu Feb 03 15:55:45 2011 +0000
+++ b/public/javascripts/ssamr_registration.js Mon Feb 07 13:16:36 2011 +0000
@@ -5,12 +5,14 @@
/* institution related functions */
Event.observe(window, 'load',
function() {
-
- $('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;
-}
+
+ if(!$('ssamr_user_details_institution_type_true').checked && $('ssamr_user_details_institution_type_true').checked){
+ $('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;
+ }
+ }
);