Permalink
Browse files

Changed the signup page to show the human form after submitting the h…

…uman form
  • Loading branch information...
1 parent e9f58ee commit 62c4dc67dcf68c455fbf1a65369b80d07e29f73f @jferris committed Oct 19, 2008
Showing with 35 additions and 2 deletions.
  1. +7 −2 app/views/users/new.html.erb
  2. +28 −0 test/functional/users_controller_test.rb
@@ -1,7 +1,10 @@
<div id="account-changes">
<div class="signup-map" id="map" style="width: 475px; height: 169px;"></div>
- <% form_tag openid_path, :id => "openid_form" do %>
+ <% form_tag openid_path,
+ :id => "openid_form",
+ :style => "display: #{params[:user_type] == 'human' ? 'none' : 'block'};" do %>
+ <%= hidden_field_tag 'user_type', 'openid' %>
<div class="text_field">
<label for="openid_identifier">
Open ID <%= link_to_function "Login like a Human", "$('openid_form').hide(); $('new_user').show();" %>
@@ -18,7 +21,9 @@
</p>
<% end %>
- <% form_for @user, :html => { :style => "display: none;" } do |form| %>
+ <% form_for @user,
+ :html => { :style => "display: #{params[:user_type] == 'human' ? 'block' : 'none'};" } do |form| %>
+ <%= hidden_field_tag 'user_type', 'human' %>
<%= form.error_messages %>
<div class="text_field">
<label for="user_email">
@@ -15,6 +15,34 @@ class UsersControllerTest < ActionController::TestCase
should_have_map_observer map
end
end
+
+ context "POST to create as a human" do
+ setup do
+ post :create, :user_type => 'human'
+ end
+
+ should "display the human form" do
+ assert_select '#new_user[style="display: block;"]'
+ end
+
+ should "hide the openid form" do
+ assert_select '#openid_form[style="display: none;"]'
+ end
+ end
+
+ context "POST to create using openid" do
+ setup do
+ post :create, :user_type => 'openid'
+ end
+
+ should "hide the human form" do
+ assert_select '#new_user[style="display: none;"]'
+ end
+
+ should "display the openid form" do
+ assert_select '#openid_form[style="display: block;"]'
+ end
+ end
public_context do
context "with a user" do

0 comments on commit 62c4dc6

Please sign in to comment.