Commit f86b160c

mo k <m@mokhan.ca>
2012-02-08 03:37:57
enable the submit button if the terms are accepted.
1 parent 0a80554
Changed files (1)
app
views
devise
app/views/devise/sessions/new.html.erb
@@ -1,3 +1,20 @@
+<% content_for :head do %>
+<% end %>
+
+<script type="text/javascript">
+  $(document).ready(function(){
+    $('#submit-registration').attr('disabled', 'disabled');
+    $('#accepted').click(function(){
+      if( $('#accepted').is(':checked')){
+        $('#submit-registration').removeAttr('disabled');
+      }
+      else{
+        $('#submit-registration').attr('disabled', 'disabled');
+      }
+    });
+  });
+</script>
+
 <div class="row">
   <div class="span16">
     <div class="row">
@@ -36,7 +53,8 @@
           <p><%= f.email_field :email, :placeholder => 'Email', :class=> "xlarge"%></p>
           <p><%= f.password_field :password, :placeholder => 'Password', :class=> "xlarge"%></p>
           <p><%= f.password_field :password_confirmation, :placeholder => 'Confirm Password', :class=> "xlarge"%></p>
-          <p><%= f.submit "Sign up", :style => "height:28px;", :class => "btn primary" %></p>
+          <p><input id="accepted" name="accepted" type="checkbox" value="" /> I have read the <a href="/terms.html">terms and conditions</a> and the <a href="/privacy.html">privacy policy</a></p>
+          <p><%= f.submit "Sign up", :style => "height:28px;", :class => "btn primary", :id => "submit-registration" %></p>
         <% end %>
       </div>
     </div>