Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Wizards: From WTF to Wicked

Wizards: From WTF to Wicked

A lightning talk I gave at RailsConf about Wicked http://github.com/schneems/wicked

Richard Schneeman

April 25, 2012
Tweet

More Decks by Richard Schneeman

Other Decks in Programming

Transcript

  1. Wizards:
    From
    WTF to
    Wicked Richard Schneeman
    @schneems
    works for
    @heroku


    View full-size slide

  2. Step By
    Step
    Wizards

    View full-size slide

  3. class Web::Users::SignupFlowController < Web::
    before_filter :ensure_authenticated
    ## FLOW #
    ############################################
    # signed up with facebook => :confirm
    # signed up with form => :find_friends
    ############################################

    View full-size slide

  4. What if
    Everything

    View full-size slide

  5. You ever
    wanted

    View full-size slide

  6. (about step-by-step
    w
    izards)

    View full-size slide

  7. Wicked


    View full-size slide

  8. Wicked


    rocket edition

    View full-size slide

  9. include
    Wicked::Wizard

    View full-size slide

  10. steps :add_zip, :add_twitter

    View full-size slide

  11. /views
    /after_register
    /add_zip.html.erb
    /add_twiter.html.erb

    View full-size slide

  12. render_wizard

    View full-size slide

  13. steps :add_zip, :add_twitter
    def show
    @user = current_user
    render_wizard
    end

    View full-size slide

  14. def update
    @user = current_user
    @user.update_attributes(params[:user])
    render_wizard @user
    end

    View full-size slide

  15. class AfterRegisterController < ApplicationCon
    include Wicked::Wizard
    steps :add_zip, :add_twitter
    def show
    @user = current_user
    render_wizard
    end
    def update
    @user = current_user
    @user.update_attributes(params[:user])
    render_wizard @user
    end
    end

    View full-size slide

  16. It’s a state
    machine!!

    View full-size slide

  17. Wicked


    by
    @schneems
    Use

    View full-size slide