Browse files

convert after_register controller to a wizard

  • Loading branch information...
1 parent bd3ab21 commit 42ef730074a0ed09edb575c0e0f39d7ed3871e5c @schneems committed Feb 24, 2012
View
2 Gemfile
@@ -40,3 +40,5 @@ gem "twitter-bootstrap-rails", "~> 2.0.1.0"
# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'
+
+gem 'wicked'
View
4 Gemfile.lock
@@ -122,6 +122,9 @@ GEM
multi_json (>= 1.0.2)
warden (1.1.1)
rack (>= 1.0)
+ wicked (0.0.2)
+ activesupport (>= 3.0.7)
+ rails (>= 3.0.7)
PLATFORMS
ruby
@@ -135,3 +138,4 @@ DEPENDENCIES
sqlite3
twitter-bootstrap-rails (~> 2.0.1.0)
uglifier (>= 1.0.3)
+ wicked
View
13 app/controllers/after_register_controller.rb
@@ -1,12 +1,21 @@
-class AfterRegisterController < ApplicationController
+class AfterRegisterController < Wicked::WizardController
before_filter :authenticate_user!
+ steps :add_zip, :add_twitter
def show
@user = current_user
+ case step
+ when :add_twitter
+ skip_step if @user.zip.blank?
+ end
+ render_wizard
end
def update
-
+ @user = current_user
+ @user.update_attributes(params[:user])
+ render_wizard @user
end
+
end
View
3 app/views/after_register/add_twitter.html.erb
@@ -0,0 +1,3 @@
+<%= link_to "Fake Twitter Connect", next_wizard_path, :class => 'btn btn-primary' %>
+
+<%= link_to 'skip' , next_wizard_path %>
View
8 app/views/after_register/add_zip.html.erb
@@ -0,0 +1,8 @@
+<h2>Thanks for signing up </h2>
+<%= form_for(@user, :url => wizard_path, :method => :put) do |f| %>
+ <%= f.text_field :zip, :placeholder => 'zip code' %>
+ <%= f.submit 'Next', :class => 'btn btn-primary' %>
+<% end %>
+
+
+<%= link_to 'skip', next_wizard_path %>
View
6 app/views/after_register/show.html.erb
@@ -1,6 +0,0 @@
-<h2>Thanks for Signing Up</h2>
-<p>Please Fill in your zip code!</p>
-<%= form_for(@user) do |f| %>
- <%= f.text_field :zip, :placeholder => "zip code" %>
- <%= f.submit 'Next', :class => 'btn btn-primary' %>
-<% end %>
View
0 public/mobile.html
No changes.
View
1 public/mobile/test.html
@@ -0,0 +1 @@
+foo

0 comments on commit 42ef730

Please sign in to comment.