changeset 190:440c4f4bf2d6 feature_64

created the model validation and the checkbox in the registration view.
author luisf
date Thu, 03 Feb 2011 17:11:33 +0000
parents f9fe5ef6156e
children d1713ab10813
files app/models/user.rb app/views/account/register.rhtml config/locales/en-GB.yml config/locales/en.yml
diffstat 4 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/app/models/user.rb	Thu Feb 03 15:54:00 2011 +0000
+++ b/app/models/user.rb	Thu Feb 03 17:11:33 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
--- a/app/views/account/register.rhtml	Thu Feb 03 15:54:00 2011 +0000
+++ b/app/views/account/register.rhtml	Thu Feb 03 17:11:33 2011 +0000
@@ -63,5 +63,9 @@
 <!--[eoform:user]-->
 </div>
 
+<%= check_box :user, :terms_and_conditions %> I have read and agree with the terms and conditions.
+<br />
+<br />
+
 <%= submit_tag l(:button_submit) %>
 <% end %>
--- a/config/locales/en-GB.yml	Thu Feb 03 15:54:00 2011 +0000
+++ b/config/locales/en-GB.yml	Thu Feb 03 17:11:33 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
   
@@ -416,6 +417,7 @@
   
   label_tipoftheday: Tip of the day
   label_notifications: Important Message
+  field_terms_and_conditions: 'Terms and Conditions:'
   label_ssamr_description: Research description
   label_ssamr_details: Other Details
   label_ssamr_institution: Institution
--- a/config/locales/en.yml	Thu Feb 03 15:54:00 2011 +0000
+++ b/config/locales/en.yml	Thu Feb 03 17:11:33 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
   
@@ -307,6 +307,7 @@
   
   setting_tipoftheday_text: Tip of the Day
   setting_notifications_text: Notifications
+  field_terms_and_conditions: 'Terms and Conditions:'
   label_ssamr_description: Research description
   setting_app_title: Application title
   setting_app_subtitle: Application subtitle