Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

convert after_register controller to a wizard

  • Loading branch information...
commit 42ef730074a0ed09edb575c0e0f39d7ed3871e5c 1 parent bd3ab21
Richard Schneeman authored
2  Gemfile
View
@@ -40,3 +40,5 @@ gem "twitter-bootstrap-rails", "~> 2.0.1.0"
# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'
+
+gem 'wicked'
4 Gemfile.lock
View
@@ -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
13 app/controllers/after_register_controller.rb
View
@@ -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
3  app/views/after_register/add_twitter.html.erb
View
@@ -0,0 +1,3 @@
+<%= link_to "Fake Twitter Connect", next_wizard_path, :class => 'btn btn-primary' %>
+
+<%= link_to 'skip' , next_wizard_path %>
8 app/views/after_register/add_zip.html.erb
View
@@ -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 %>
6 app/views/after_register/show.html.erb
View
@@ -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 %>
0  public/mobile.html
View
No changes.
1  public/mobile/test.html
View
@@ -0,0 +1 @@
+foo
Please sign in to comment.
Something went wrong with that request. Please try again.