Skip to content

Commit

Permalink
added wicked wizard
Browse files Browse the repository at this point in the history
  • Loading branch information
schadenfred committed Apr 9, 2012
1 parent e3b93a0 commit 5483ea5
Show file tree
Hide file tree
Showing 13 changed files with 95 additions and 29 deletions.
3 changes: 2 additions & 1 deletion Gemfile
Expand Up @@ -17,7 +17,8 @@ gem 'wicked'
# Asset handling
gem 'sass-rails'
gem 'bootstrap-sass'

gem 'font-awesome-rails'

group :assets do
gem 'coffee-script'
gem 'coffee-rails'
Expand Down
3 changes: 3 additions & 0 deletions Gemfile.lock
Expand Up @@ -96,6 +96,8 @@ GEM
faker (1.0.1)
i18n (~> 0.4)
ffi (1.0.11)
font-awesome-rails (0.2.1)
railties (~> 3.1)
gherkin (2.9.3)
json (>= 1.4.6)
gravatar_image_tag (1.0.0)
Expand Down Expand Up @@ -291,6 +293,7 @@ DEPENDENCIES
eventmachine
factory_girl_rails
faker (= 1.0.1)
font-awesome-rails
gravatar_image_tag (= 1.0.0)
guard
guard-bundler
Expand Down
1 change: 1 addition & 0 deletions app/assets/stylesheets/application.css
Expand Up @@ -4,5 +4,6 @@
* the top of the compiled file, but it's generally better to create a new file per style scope.
*= require_self
*= require_tree .
*= require 'font-awesome'
*/

13 changes: 8 additions & 5 deletions app/controllers/confirmations_controller.rb
Expand Up @@ -2,10 +2,13 @@ class ConfirmationsController < Devise::ConfirmationsController

def show
@title = "Confirm your account"
@user = User.find_by_confirmation_token(params[:confirmation_token])
@user.name = temporary_name(@user.email)
if !@user.present?
render_with_scope :new
if @user = User.find_by_confirmation_token(params[:confirmation_token])
@user.name = temporary_name(@user.email)
if !@user.present?
render_with_scope :new
end
else
render :root
end
end

Expand All @@ -15,7 +18,7 @@ def confirm_user
@user = User.confirm_by_token(@user.confirmation_token)
set_flash_message :notice, :confirmed
sign_in("user", @user)
redirect_to edit_user_registration_path
redirect_to after_signup_wizard_path(:choose_subdomain)
# sign_in_and_redirect(edit_user_registration_path, @user)
# sign_in("user", edit_user_registration_path)
# super
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/registrations_controller.rb
Expand Up @@ -45,7 +45,7 @@ def show

protected
def after_sign_up_path_for(resource)
after_register_path(:add_zip)
after_signup_wizard_path(:choose_password)
end
end

20 changes: 20 additions & 0 deletions app/views/after_signup_wizard/choose_password.html.haml
@@ -0,0 +1,20 @@
choooooz
= current_user

= link_to 'skip', next_wizard_path, class: "btn btn-primary"

= simple_form_for(resource, :url => confirm_user_path, class: "form-horizontal") do |f|
= devise_error_messages!
%fieldset
%legend
Choose a password:
= f.input :email
= f.input :name
= f.input :subdomain
= f.input :password
= f.input :password_confirmation
.form-actions
= f.button :submit, "Confirm that you own ", class: "btn btn-primary"
= link_to 'Home', root_url
%br/
= render :partial => 'devise/shared/links'
21 changes: 21 additions & 0 deletions app/views/after_signup_wizard/choose_subdomain.html.haml
@@ -0,0 +1,21 @@
.row-fluid
.span3.well
= render 'shared/mission_statement'
.span8
.row-fluid
.span3.label
Step 1: Sign up
.span3.label
Step 2: Choose Password
.span3.label.label-warning
Step 3: Choose Subdomain
%br/
%legend Step 3: Choose your subdomain
= simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put, class: "form-horizontal" } ) do |f|
= f.input :subdomain, wrapper: :append do
= f.input_field :subdomain, placeholder: @user.subdomain
= content_tag :span, ".merciboq.com", class: "add-on"
.form-actions
= f.button :submit, "Choose my subdomain", class: "btn btn-primary"
%br/
= render :partial => 'devise/shared/links'
2 changes: 1 addition & 1 deletion app/views/confirmations/new.html.haml
Expand Up @@ -2,7 +2,7 @@
%fieldset
%legend
Confirm your account and choose a password:
= form_for(resource, as: resource_name, :url => confirm_user_path) do |f|
= simple_form_for(resource, as: resource_name, :url => confirm_user_path, class: "form-horizontal") do |f|
= devise_error_messages!
%legend
= @user.email
Expand Down
37 changes: 23 additions & 14 deletions app/views/confirmations/show.html.haml
@@ -1,17 +1,26 @@
= simple_form_for(resource, :url => confirm_user_path, class: "form-horizontal") do |f|
= devise_error_messages!
%fieldset
%legend
Choose a password2:
= f.input :confirmation_token, as: :hidden
= f.input :email
= f.input :name
= f.input :subdomain
= f.input :password
= f.input :password_confirmation
.form-actions
= f.submit raw "Confirm that you own #{@user.email}"
= link_to 'Home', root_url
.row-fluid
.span3.well
= render 'shared/mission_statement'
.span8.form-horizontal
.row-fluid
.span3.label
Step 1: Sign up
.span3.label.label-warning
Step 2: Choose Password
.span3.label
Step 3: Choose Subdomain
%br/
%legend Step 2: Choose your password
= simple_form_for(resource, :url => confirm_user_path) do |f|
- if f.error_notification
.alert.alert-error.fade.in
%a.close{"data-dismiss" => "alert", :href => "#"}
= f.error_notification
= f.input :confirmation_token, as: :hidden
= f.input :password
= f.input :password_confirmation
.form-actions
= f.button :submit, "Choose my password", class: "btn btn-primary"
%br/
= render :partial => 'devise/shared/links'

12 changes: 10 additions & 2 deletions app/views/registrations/new.html.haml
Expand Up @@ -2,13 +2,21 @@
.span3.well
= render 'shared/mission_statement'
.span8
.row-fluid
.span3.label.label-warning
Step 1: Sign up
.span3.label
Step 2: Choose Password
.span3.label
Step 3: Choose Subdomain
%br/
%legend Step 1: Sign up
= simple_form_for(resource, :as => resource_name, html: { class: 'form-horizontal' }, :url => registration_path(resource_name)) do |f|
- if f.error_notification
.alert.alert-error.fade.in
%a.close{"data-dismiss" => "alert", :href => "#"} ×
= f.error_notification
%legend Sign up
= f.input :email
.form-actions
= f.button :submit, "Sign up", class: 'btn-large btn-primary'
= f.button :submit, "Sign up to get a confirmation email", class: 'btn-large btn-primary'
= render :partial => "devise/shared/links"
4 changes: 2 additions & 2 deletions features/email/thankyou_by_email/user_confirmation.feature
Expand Up @@ -15,7 +15,7 @@ Feature: Thankyous to unregistered users trigger
When she follows the confirmation in the email body
Then she should see "Confirm your account" in the title
And when she fills in her password and confirmation
And she presses "Confirm"
And she presses "Choose my password"
Then she should see "Your account was successfully confirmed"

Scenario: Unregistered WELCOMER signs up after receiving a thankyou
Expand All @@ -27,7 +27,7 @@ Feature: Thankyous to unregistered users trigger
When she follows the confirmation in the email body
Then she should see "Confirm your account" in the title
And when she fills in her password and confirmation
And she presses "Confirm that you own"
And she presses "Choose my password"
Then she should see "Your account was successfully confirmed"

Scenario: Unregistered WELCOMER signs up after a thankyou
Expand Down
4 changes: 2 additions & 2 deletions features/user/authentication/create_user_on_thankyou.feature
Expand Up @@ -17,7 +17,7 @@ Feature: Create new user on thankyou
When she follows the confirmation in the email body
Then she should see "Confirm your account" in the title
And when she fills in her password and confirmation
And she presses "Confirm that you own"
And she presses "Choose my password"
Then she should see "confirmed"

Scenario: Unregistered WELCOMER signs up after receiving a thankyou
Expand All @@ -29,7 +29,7 @@ Feature: Create new user on thankyou
When she follows the confirmation in the email body
Then she should see "Confirm your account" in the title
And when she fills in her password and confirmation
And she presses "Confirm"
And she presses "Choose my password"
Then she should see "confirmed"

Scenario: Unregistered WELCOMER signs up after a thankyou
Expand Down
2 changes: 1 addition & 1 deletion features/user/authentication/sign_up.feature
Expand Up @@ -25,7 +25,7 @@ Feature: Sign up
And I fill in the following:
| Password | password |
| Password confirmation | password |
And I press "Confirm that you own"
And I press "Choose my password"
Then I should see "Your account was successfully confirmed."

Scenario: Unregistered user signs up with invalid email
Expand Down

0 comments on commit 5483ea5

Please sign in to comment.