wicked 1.0.3 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +10 -9
- data/Appraisals +24 -0
- data/CHANGELOG.md +7 -0
- data/CONTRIBUTING.md +19 -0
- data/Gemfile +6 -18
- data/README.md +49 -12
- data/VERSION +1 -1
- data/gemfiles/3.0.gemfile +12 -0
- data/gemfiles/3.1.gemfile +12 -0
- data/gemfiles/3.2.gemfile +12 -0
- data/gemfiles/4.0.gemfile +12 -0
- data/gemfiles/4.1.gemfile +12 -0
- data/lib/wicked/controller/concerns/render_redirect.rb +1 -1
- data/lib/wicked/controller/concerns/steps.rb +7 -5
- data/lib/wicked/wizard.rb +2 -2
- data/test/dummy/app/controllers/dynamic_different_steps_controller.rb +18 -0
- data/test/dummy/app/controllers/jump_controller.rb +2 -2
- data/test/dummy/app/controllers/redirect_to_next_controller.rb +1 -1
- data/test/dummy/app/views/dynamic_different_steps/first.html.erb +3 -0
- data/test/dummy/app/views/jump/last_step.html.erb +3 -1
- data/test/dummy/app/views/jump/second.html.erb +3 -1
- data/test/dummy/config/environments/development.rb +0 -1
- data/test/dummy/config/routes.rb +1 -0
- data/test/integration/dynamic_steps_test.rb +8 -1
- data/test/integration/jump_test.rb +16 -0
- data/wicked.gemspec +15 -16
- metadata +16 -50
- data/.rvmrc +0 -19
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 422663ab2ae1282691a5dad438aa8e48382865d1
         | 
| 4 | 
            +
              data.tar.gz: 5996f5dd1a945154fa6fccdc472df091cbb6cc79
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: d7ee081ed8b29d38c0fb03beefd823f786e108900b7081b9c93a1d900743a23c0b0dece7dfab2c6db7195feab73c62ee96feca2c92e59b3f528863cb7ecbf8fb
         | 
| 7 | 
            +
              data.tar.gz: 989fe808368a8995b63da9d458144a98325c116b6befbf6694c84ceb1c14bda7f1d2051827e9bf8036c65194149e9875cd4f158e0a130d82b74ea6b10a2fe1b8
         | 
    
        data/.travis.yml
    CHANGED
    
    | @@ -2,21 +2,22 @@ language: ruby | |
| 2 2 | 
             
            rvm:
         | 
| 3 3 | 
             
              - 1.9.3
         | 
| 4 4 | 
             
              - 2.0.0
         | 
| 5 | 
            +
              - 2.1.1
         | 
| 5 6 | 
             
              - ruby-head
         | 
| 6 7 | 
             
              - jruby-19mode
         | 
| 7 8 |  | 
| 8 | 
            -
             | 
| 9 | 
            -
              -  | 
| 10 | 
            -
              -  | 
| 11 | 
            -
              -  | 
| 12 | 
            -
              -  | 
| 13 | 
            -
              -  | 
| 14 | 
            -
              - "RAILS_VERSION=master"
         | 
| 9 | 
            +
            gemfile:
         | 
| 10 | 
            +
              - gemfiles/3.0.gemfile
         | 
| 11 | 
            +
              - gemfiles/3.1.gemfile
         | 
| 12 | 
            +
              - gemfiles/3.2.gemfile
         | 
| 13 | 
            +
              - gemfiles/4.0.gemfile
         | 
| 14 | 
            +
              - gemfiles/4.1.gemfile
         | 
| 15 15 |  | 
| 16 16 | 
             
            matrix:
         | 
| 17 17 | 
             
              allow_failures:
         | 
| 18 | 
            -
                -  | 
| 18 | 
            +
                - gemfile: gemfiles/3.0.gemfile
         | 
| 19 19 | 
             
                  rvm: 2.0.0
         | 
| 20 | 
            -
                -  | 
| 20 | 
            +
                - gemfile: gemfiles/3.0.gemfile
         | 
| 21 | 
            +
                  rvm: 2.1.1
         | 
| 21 22 | 
             
                - rvm: ruby-head
         | 
| 22 23 |  | 
    
        data/Appraisals
    ADDED
    
    | @@ -0,0 +1,24 @@ | |
| 1 | 
            +
            appraise "3.0" do
         | 
| 2 | 
            +
              gem "rails", "~> 3.0.7"
         | 
| 3 | 
            +
              gemspec
         | 
| 4 | 
            +
            end
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            appraise "3.1" do
         | 
| 7 | 
            +
              gem "rails", "~> 3.1.0"
         | 
| 8 | 
            +
              gemspec
         | 
| 9 | 
            +
            end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            appraise "3.2" do
         | 
| 12 | 
            +
              gem "rails", "~> 3.2.15"
         | 
| 13 | 
            +
              gemspec
         | 
| 14 | 
            +
            end
         | 
| 15 | 
            +
             | 
| 16 | 
            +
            appraise "4.0" do
         | 
| 17 | 
            +
              gem "rails", "~> 4.0.0"
         | 
| 18 | 
            +
              gemspec
         | 
| 19 | 
            +
            end
         | 
| 20 | 
            +
             | 
| 21 | 
            +
            appraise "4.1" do
         | 
| 22 | 
            +
              gem "rails", "~> 4.1.0"
         | 
| 23 | 
            +
              gemspec
         | 
| 24 | 
            +
            end
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -1,3 +1,10 @@ | |
| 1 | 
            +
            ## Master
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            ## 1.1.0 (9/15/2014)
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            * [#136] `skip_step` and `jump_to` now take redirect options. You can use
         | 
| 6 | 
            +
            this to effectively pass parameters to a redirect initiated by either of these method.
         | 
| 7 | 
            +
             | 
| 1 8 | 
             
            ## 1.0.3 (4/25/2014)
         | 
| 2 9 |  | 
| 3 10 | 
             
            * All `to_sym` have been removed. Symbol attacks are no longer possible.
         | 
    
        data/CONTRIBUTING.md
    ADDED
    
    | @@ -0,0 +1,19 @@ | |
| 1 | 
            +
            # Contributing
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            There are two main ways to contribute to this project.
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            ## Content
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            * Write articles
         | 
| 8 | 
            +
            * Recording screencasts
         | 
| 9 | 
            +
            * Submit presentations
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            ## Development
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            Using [CodeTriage](http://www.codetriage.com/schneems/wicked) as a volunteer, you'll receive an email each day with a link to an open issue that needs to be triaged in this project. You'll also receive instructions on how to triage issues.
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            1. Fork it! ( https://github.com/schneems/wicked/fork )
         | 
| 16 | 
            +
            2. Create your feature branch: `git checkout -b my-new-feature`
         | 
| 17 | 
            +
            3. Commit your changes: `git commit -am 'Add some feature'`
         | 
| 18 | 
            +
            4. Push to the branch: `git push origin my-new-feature`
         | 
| 19 | 
            +
            5. Create a new Pull Request :D
         | 
    
        data/Gemfile
    CHANGED
    
    | @@ -1,25 +1,13 @@ | |
| 1 | 
            -
             | 
| 2 | 
            -
             | 
| 3 | 
            -
             | 
| 4 | 
            -
             | 
| 5 | 
            -
            rails = case rails_version
         | 
| 6 | 
            -
            when "master"
         | 
| 7 | 
            -
              {:github => "rails/rails"}
         | 
| 8 | 
            -
            when "default"
         | 
| 9 | 
            -
              ">= 3.0.7"
         | 
| 10 | 
            -
            else
         | 
| 11 | 
            -
              "~> #{rails_version}"
         | 
| 12 | 
            -
            end
         | 
| 1 | 
            +
            # this gemfile is used by jeweler for generating a gemspec.
         | 
| 2 | 
            +
            # yeah, it's backwards...but it was the hotness when I first wrote this
         | 
| 3 | 
            +
            # gem.
         | 
| 13 4 |  | 
| 14 | 
            -
             | 
| 5 | 
            +
            source "https://rubygems.org"
         | 
| 15 6 |  | 
| 7 | 
            +
            gem "rails", ">= 3.0.7"
         | 
| 16 8 |  | 
| 17 9 | 
             
            group :development, :test do
         | 
| 18 | 
            -
              gem 'rake'
         | 
| 19 | 
            -
              gem 'jeweler'
         | 
| 20 | 
            -
              gem "capybara", "~> 1.1.2"
         | 
| 21 | 
            -
              gem "launchy"
         | 
| 22 | 
            -
             | 
| 23 10 | 
             
              gem "sqlite3",                          :platform => [:ruby, :mswin, :mingw]
         | 
| 24 11 | 
             
              gem "activerecord-jdbcsqlite3-adapter", '>= 1.3.0.beta', :platform => :jruby
         | 
| 12 | 
            +
              gem "jeweler"
         | 
| 25 13 | 
             
            end
         | 
    
        data/README.md
    CHANGED
    
    | @@ -165,7 +165,7 @@ Now you've got a fully functioning AfterSignup controller! If you have questions | |
| 165 165 |  | 
| 166 166 | 
             
            ## Quick Reference
         | 
| 167 167 |  | 
| 168 | 
            -
            View/URL Helpers
         | 
| 168 | 
            +
            **View/URL Helpers:**
         | 
| 169 169 |  | 
| 170 170 | 
             
            ```ruby
         | 
| 171 171 | 
             
            wizard_path                  # Grabs the current path in the wizard
         | 
| @@ -178,7 +178,7 @@ previous_wizard_path         # Url of the previous step | |
| 178 178 | 
             
            ```
         | 
| 179 179 |  | 
| 180 180 |  | 
| 181 | 
            -
            Controller Tidbits | 
| 181 | 
            +
            **Controller Tidbits:**
         | 
| 182 182 |  | 
| 183 183 | 
             
            ```ruby
         | 
| 184 184 | 
             
            steps  :first, :second       # Sets the order of steps
         | 
| @@ -188,11 +188,24 @@ previous_step                # Gets previous step | |
| 188 188 | 
             
            skip_step                    # Tells render_wizard to skip to the next logical step
         | 
| 189 189 | 
             
            jump_to(:specific_step)      # Jump to :specific_step
         | 
| 190 190 | 
             
            render_wizard                # Renders the current step
         | 
| 191 | 
            -
            render_wizard(@user)         # Shows next_step if @user.save, otherwise renders | 
| 191 | 
            +
            render_wizard(@user)         # Shows next_step if @user.save, otherwise renders
         | 
| 192 192 | 
             
            ```
         | 
| 193 193 |  | 
| 194 | 
            +
            **Redirect options**
         | 
| 194 195 |  | 
| 195 | 
            -
             | 
| 196 | 
            +
            Both `skip_step` and `jump_to` will cause a redirect. If you want to pass params to the step you are skipping to you can pass it into those.
         | 
| 197 | 
            +
             | 
| 198 | 
            +
            ```
         | 
| 199 | 
            +
            skip_step(foo: "bar")
         | 
| 200 | 
            +
            ```
         | 
| 201 | 
            +
             | 
| 202 | 
            +
            and
         | 
| 203 | 
            +
             | 
| 204 | 
            +
            ```
         | 
| 205 | 
            +
            jump_to(:specific_step, foo: "bar")
         | 
| 206 | 
            +
            ```
         | 
| 207 | 
            +
             | 
| 208 | 
            +
            **Finally:**
         | 
| 196 209 |  | 
| 197 210 | 
             
            Don't forget to create your named views
         | 
| 198 211 |  | 
| @@ -206,7 +219,7 @@ app/ | |
| 206 219 | 
             
            ```
         | 
| 207 220 |  | 
| 208 221 |  | 
| 209 | 
            -
             | 
| 222 | 
            +
            ## Finish Wizard Path
         | 
| 210 223 |  | 
| 211 224 | 
             
            You can specify the url that your user goes to by over-riding the `finish_wizard_path` in your wizard controller.
         | 
| 212 225 |  | 
| @@ -217,7 +230,6 @@ def finish_wizard_path | |
| 217 230 | 
             
            end
         | 
| 218 231 | 
             
            ```
         | 
| 219 232 |  | 
| 220 | 
            -
             | 
| 221 233 | 
             
            ### Testing with RSpec
         | 
| 222 234 |  | 
| 223 235 | 
             
            ```ruby
         | 
| @@ -228,7 +240,6 @@ get :show, id: :find_friends | |
| 228 240 | 
             
            put :update, {'id' => 'find_friends', "user" => { "id" => @user.id.to_s }}
         | 
| 229 241 | 
             
            ```
         | 
| 230 242 |  | 
| 231 | 
            -
             | 
| 232 243 | 
             
            ### Internationalization of URLS (I18n)
         | 
| 233 244 |  | 
| 234 245 | 
             
            If your site works in multiple languages, or if you just want more control over how your URLs look you can now use I18n with wicked. To do so you need to replace this:
         | 
| @@ -305,7 +316,6 @@ end | |
| 305 316 |  | 
| 306 317 | 
             
            Instead you need to use `wizard_value` to get the "reverse translation" in your controller code like this:
         | 
| 307 318 |  | 
| 308 | 
            -
             | 
| 309 319 | 
             
            ```ruby
         | 
| 310 320 | 
             
            steps :confirm_password, :confirm_profile, :find_friends
         | 
| 311 321 |  | 
| @@ -347,6 +357,7 @@ Now you can change the values in the URLs to whatever you want without changing | |
| 347 357 | 
             
            ```ruby
         | 
| 348 358 | 
             
            config.i18n.default_locale = :de
         | 
| 349 359 | 
             
            ```
         | 
| 360 | 
            +
             | 
| 350 361 | 
             
            **Important:** Don't forget to use `wizard_value()` method to make
         | 
| 351 362 | 
             
            sure you are using the right cannonical values of `step`,
         | 
| 352 363 | 
             
            `previous_step`, `next_step`, etc. If you are comparing them to non
         | 
| @@ -356,11 +367,12 @@ Custom crafted wizard urls: just another way Wicked makes your app a little more | |
| 356 367 |  | 
| 357 368 | 
             
            ## Dynamic Step Names
         | 
| 358 369 |  | 
| 359 | 
            -
            If you wish to set the order of your steps dynamically you can do this  | 
| 370 | 
            +
            If you wish to set the order of your steps dynamically you can do this by manually calling  and `self.steps = [# <some steps> ]` in a `before_action` method. Then call `before_action :setup_wizard` after so that wicked knows when it is safe to initializelike this:
         | 
| 360 371 |  | 
| 361 372 | 
             
            ```ruby
         | 
| 362 373 | 
             
            include Wicked::Wizard
         | 
| 363 | 
            -
             | 
| 374 | 
            +
            before_action :set_steps
         | 
| 375 | 
            +
            before_action :setup_wizard
         | 
| 364 376 |  | 
| 365 377 | 
             
            # ...
         | 
| 366 378 |  | 
| @@ -374,6 +386,8 @@ def set_steps | |
| 374 386 | 
             
            end
         | 
| 375 387 | 
             
            ```
         | 
| 376 388 |  | 
| 389 | 
            +
            NOTE: The order of the `before_action` matters, when `setup_wizard` is called it will validate the presence of `self.steps`, you must call your custom step setting code before this point.
         | 
| 390 | 
            +
             | 
| 377 391 | 
             
            ## Keywords
         | 
| 378 392 |  | 
| 379 393 | 
             
            There are a few "magical" keywords that will take you to the first step,
         | 
| @@ -389,10 +403,10 @@ Wicked::FINISH_STEP | |
| 389 403 | 
             
            ```
         | 
| 390 404 |  | 
| 391 405 | 
             
            You can build links using these constants
         | 
| 392 | 
            -
            `after_signup_path(Wicked:: | 
| 406 | 
            +
            `after_signup_path(Wicked::FIRST_STEP)` which will redirect the user to
         | 
| 393 407 | 
             
            the first step you've specified. This might be useful for redirecting a
         | 
| 394 408 | 
             
            user to a step when you're not already in a Wicked controller. If you
         | 
| 395 | 
            -
            change the  | 
| 409 | 
            +
            change the constants, they are expected to be strings (not symbols).
         | 
| 396 410 |  | 
| 397 411 | 
             
            ## About
         | 
| 398 412 |  | 
| @@ -401,3 +415,26 @@ Please poke around the source code, if you see easier ways to get a Rails contro | |
| 401 415 | 
             
            If you have a question file an issue or, find me on the Twitters [@schneems](http://twitter.com/schneems).
         | 
| 402 416 |  | 
| 403 417 | 
             
            This project rocks and uses MIT-LICENSE.
         | 
| 418 | 
            +
             | 
| 419 | 
            +
            ## Compatibility
         | 
| 420 | 
            +
             | 
| 421 | 
            +
            This gem works with Rails 3.0, 3.1, 3.2, 4.0 and 4.1, and is compatible with Ruby 1.9.3, 2.0.0, 2.1.1 or JRuby (with some exceptions).
         | 
| 422 | 
            +
             | 
| 423 | 
            +
            Refer to the Travis CI test matrix for test using your version of Ruby and Rails.
         | 
| 424 | 
            +
             | 
| 425 | 
            +
            Exceptions: Rails 3.0 support is only for Ruby 1.9.3 or JRuby, not Ruby 2.0.0 or newer.
         | 
| 426 | 
            +
             | 
| 427 | 
            +
            ## Running Gem Tests
         | 
| 428 | 
            +
             | 
| 429 | 
            +
            Run tests with `rake`.
         | 
| 430 | 
            +
             | 
| 431 | 
            +
            To run tests against all the appraisal gemfiles, use `appraisal rake`. To run tests against one specific gemfile,
         | 
| 432 | 
            +
            use `appraisal 4.1 rake`.
         | 
| 433 | 
            +
             | 
| 434 | 
            +
            Note that Rails 3.0 tests don't pass in Ruby 2.0.0 or newer, so during development it may be easier to disable this
         | 
| 435 | 
            +
            gemfile if you are using a current version of Ruby.
         | 
| 436 | 
            +
             | 
| 437 | 
            +
            ## Contributing
         | 
| 438 | 
            +
             | 
| 439 | 
            +
            See the [Contributing guide](https://github.com/schneems/wicked/blob/master/CONTRIBUTING.md).
         | 
| 440 | 
            +
             | 
    
        data/VERSION
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            1.0 | 
| 1 | 
            +
            1.1.0
         | 
| @@ -0,0 +1,12 @@ | |
| 1 | 
            +
            # This file was generated by Appraisal
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            source "https://rubygems.org"
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            gem "rails", "~> 3.0.7"
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            group :development, :test do
         | 
| 8 | 
            +
              gem "sqlite3", :platform => [:ruby, :mswin, :mingw]
         | 
| 9 | 
            +
              gem "activerecord-jdbcsqlite3-adapter", ">= 1.3.0.beta", :platform => :jruby
         | 
| 10 | 
            +
            end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            gemspec :path => "../"
         | 
| @@ -0,0 +1,12 @@ | |
| 1 | 
            +
            # This file was generated by Appraisal
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            source "https://rubygems.org"
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            gem "rails", "~> 3.1.0"
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            group :development, :test do
         | 
| 8 | 
            +
              gem "sqlite3", :platform => [:ruby, :mswin, :mingw]
         | 
| 9 | 
            +
              gem "activerecord-jdbcsqlite3-adapter", ">= 1.3.0.beta", :platform => :jruby
         | 
| 10 | 
            +
            end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            gemspec :path => "../"
         | 
| @@ -0,0 +1,12 @@ | |
| 1 | 
            +
            # This file was generated by Appraisal
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            source "https://rubygems.org"
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            gem "rails", "~> 3.2.15"
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            group :development, :test do
         | 
| 8 | 
            +
              gem "sqlite3", :platform => [:ruby, :mswin, :mingw]
         | 
| 9 | 
            +
              gem "activerecord-jdbcsqlite3-adapter", ">= 1.3.0.beta", :platform => :jruby
         | 
| 10 | 
            +
            end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            gemspec :path => "../"
         | 
| @@ -0,0 +1,12 @@ | |
| 1 | 
            +
            # This file was generated by Appraisal
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            source "https://rubygems.org"
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            gem "rails", "~> 4.0.0"
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            group :development, :test do
         | 
| 8 | 
            +
              gem "sqlite3", :platform => [:ruby, :mswin, :mingw]
         | 
| 9 | 
            +
              gem "activerecord-jdbcsqlite3-adapter", ">= 1.3.0.beta", :platform => :jruby
         | 
| 10 | 
            +
            end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            gemspec :path => "../"
         | 
| @@ -0,0 +1,12 @@ | |
| 1 | 
            +
            # This file was generated by Appraisal
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            source "https://rubygems.org"
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            gem "rails", "~> 4.1.0"
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            group :development, :test do
         | 
| 8 | 
            +
              gem "sqlite3", :platform => [:ruby, :mswin, :mingw]
         | 
| 9 | 
            +
              gem "activerecord-jdbcsqlite3-adapter", ">= 1.3.0.beta", :platform => :jruby
         | 
| 10 | 
            +
            end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            gemspec :path => "../"
         | 
| @@ -6,7 +6,7 @@ module Wicked::Controller::Concerns::RenderRedirect | |
| 6 6 | 
             
                process_resource!(resource)
         | 
| 7 7 |  | 
| 8 8 | 
             
                if @skip_to
         | 
| 9 | 
            -
                  redirect_to wizard_path(@skip_to), options
         | 
| 9 | 
            +
                  redirect_to wizard_path(@skip_to, @wicked_redirect_params || {}), options
         | 
| 10 10 | 
             
                else
         | 
| 11 11 | 
             
                  render_step wizard_value(step), options
         | 
| 12 12 | 
             
                end
         | 
| @@ -3,12 +3,14 @@ module Wicked::Controller::Concerns::Steps | |
| 3 3 |  | 
| 4 4 | 
             
              extend ActiveSupport::Concern
         | 
| 5 5 |  | 
| 6 | 
            -
              def jump_to(goto_step)
         | 
| 7 | 
            -
                @skip_to | 
| 6 | 
            +
              def jump_to(goto_step, options = {})
         | 
| 7 | 
            +
                @skip_to                = goto_step
         | 
| 8 | 
            +
                @wicked_redirect_params = options
         | 
| 8 9 | 
             
              end
         | 
| 9 10 |  | 
| 10 | 
            -
              def skip_step
         | 
| 11 | 
            -
                @skip_to | 
| 11 | 
            +
              def skip_step(options = {})
         | 
| 12 | 
            +
                @skip_to                = @next_step
         | 
| 13 | 
            +
                @wicked_redirect_params = options
         | 
| 12 14 | 
             
              end
         | 
| 13 15 |  | 
| 14 16 | 
             
              def step
         | 
| @@ -51,7 +53,7 @@ module Wicked::Controller::Concerns::Steps | |
| 51 53 | 
             
                  steps   = args
         | 
| 52 54 | 
             
                  check_protected!(steps)
         | 
| 53 55 | 
             
                  prepend_before_filter(options) do
         | 
| 54 | 
            -
                    self.steps = steps
         | 
| 56 | 
            +
                    self.steps = steps.dup
         | 
| 55 57 | 
             
                  end
         | 
| 56 58 | 
             
                end
         | 
| 57 59 |  | 
    
        data/lib/wicked/wizard.rb
    CHANGED
    
    
| @@ -0,0 +1,18 @@ | |
| 1 | 
            +
            class DynamicDifferentStepsController < ApplicationController
         | 
| 2 | 
            +
              include Wicked::Wizard
         | 
| 3 | 
            +
             | 
| 4 | 
            +
              before_filter :set_steps
         | 
| 5 | 
            +
              before_filter :setup_wizard
         | 
| 6 | 
            +
             | 
| 7 | 
            +
              def show
         | 
| 8 | 
            +
                render_wizard
         | 
| 9 | 
            +
              end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
             | 
| 12 | 
            +
              private
         | 
| 13 | 
            +
              def set_steps
         | 
| 14 | 
            +
                self.steps = if params[:steps]
         | 
| 15 | 
            +
                  params[:steps]
         | 
| 16 | 
            +
                end
         | 
| 17 | 
            +
              end
         | 
| 18 | 
            +
            end
         | 
| @@ -5,8 +5,8 @@ class JumpController < ApplicationController | |
| 5 5 | 
             
              steps :first, :second, :last_step
         | 
| 6 6 |  | 
| 7 7 | 
             
              def show
         | 
| 8 | 
            -
                skip_step if params[:skip_step]
         | 
| 9 | 
            -
                jump_to :last_step if params[:jump_to]
         | 
| 8 | 
            +
                skip_step(params[:skip_step_options]) if params[:skip_step]
         | 
| 9 | 
            +
                jump_to :last_step, params[:skip_step_options] if params[:jump_to]
         | 
| 10 10 | 
             
                if params[:resource]
         | 
| 11 11 | 
             
                  value = params[:resource][:save] == 'true'
         | 
| 12 12 | 
             
                  @bar  = Bar.new(value)
         | 
| @@ -11,7 +11,6 @@ Dummy::Application.configure do | |
| 11 11 |  | 
| 12 12 | 
             
              # Show full error reports and disable caching
         | 
| 13 13 | 
             
              config.consider_all_requests_local       = true
         | 
| 14 | 
            -
              config.action_view.debug_rjs             = true
         | 
| 15 14 | 
             
              config.action_controller.perform_caching = false
         | 
| 16 15 |  | 
| 17 16 | 
             
              # Don't care if the mailer can't send
         | 
    
        data/test/dummy/config/routes.rb
    CHANGED
    
    
| @@ -1,10 +1,17 @@ | |
| 1 1 | 
             
            require 'test_helper'
         | 
| 2 2 |  | 
| 3 3 | 
             
            class DynamicStepsTest < ActiveSupport::IntegrationCase
         | 
| 4 | 
            -
              test 'set dynamic steps from params' do
         | 
| 4 | 
            +
              test 'set dynamic steps from params using prepend' do
         | 
| 5 5 | 
             
                steps = ['first', 'second']
         | 
| 6 6 | 
             
                visit dynamic_steps_path(:steps => steps)
         | 
| 7 7 | 
             
                assert_has_content?(steps.first.inspect)
         | 
| 8 8 | 
             
                assert_has_content?(steps.inspect)
         | 
| 9 9 | 
             
              end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
              test 'set dynamic steps from params without using' do
         | 
| 12 | 
            +
                steps = ['first', 'second']
         | 
| 13 | 
            +
                visit dynamic_different_steps_path(:steps => steps)
         | 
| 14 | 
            +
                assert_has_content?(steps.first.inspect)
         | 
| 15 | 
            +
                assert_has_content?(steps.inspect)
         | 
| 16 | 
            +
              end
         | 
| 10 17 | 
             
            end
         | 
| @@ -13,4 +13,20 @@ class JumpNavigationTest < ActiveSupport::IntegrationCase | |
| 13 13 | 
             
                assert_has_content?('first')
         | 
| 14 14 | 
             
                assert !has_content?('last_step')
         | 
| 15 15 | 
             
              end
         | 
| 16 | 
            +
             | 
| 17 | 
            +
             | 
| 18 | 
            +
              test 'skip_step takes :skip_step_options and passes them' do
         | 
| 19 | 
            +
                step = :first
         | 
| 20 | 
            +
                visit(jump_path(step, :skip_step => true, :skip_step_options => {:foo => :bar}))
         | 
| 21 | 
            +
                assert_has_content?('second')
         | 
| 22 | 
            +
                assert !has_content?('last_step')
         | 
| 23 | 
            +
              end
         | 
| 24 | 
            +
             | 
| 25 | 
            +
              test 'jump_to takes :skip_step_options and passes them' do
         | 
| 26 | 
            +
                step = :first
         | 
| 27 | 
            +
                visit(jump_path(step, :resource => {:save => true}, :jump_to => :last_step, :skip_step_options => {:foo => :bar}))
         | 
| 28 | 
            +
                assert_has_content?("foo")
         | 
| 29 | 
            +
                assert_has_content?("bar")
         | 
| 30 | 
            +
                assert_has_content?('last_step')
         | 
| 31 | 
            +
              end
         | 
| 16 32 | 
             
            end
         | 
    
        data/wicked.gemspec
    CHANGED
    
    | @@ -2,31 +2,37 @@ | |
| 2 2 | 
             
            # DO NOT EDIT THIS FILE DIRECTLY
         | 
| 3 3 | 
             
            # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
         | 
| 4 4 | 
             
            # -*- encoding: utf-8 -*-
         | 
| 5 | 
            -
            # stub: wicked 1.0 | 
| 5 | 
            +
            # stub: wicked 1.1.0 ruby lib
         | 
| 6 6 |  | 
| 7 7 | 
             
            Gem::Specification.new do |s|
         | 
| 8 8 | 
             
              s.name = "wicked"
         | 
| 9 | 
            -
              s.version = "1.0 | 
| 9 | 
            +
              s.version = "1.1.0"
         | 
| 10 10 |  | 
| 11 11 | 
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         | 
| 12 12 | 
             
              s.require_paths = ["lib"]
         | 
| 13 13 | 
             
              s.authors = ["schneems"]
         | 
| 14 | 
            -
              s.date = "2014- | 
| 14 | 
            +
              s.date = "2014-09-15"
         | 
| 15 15 | 
             
              s.description = "Wicked is a Rails engine for producing easy wizard controllers"
         | 
| 16 16 | 
             
              s.email = "richard.schneeman@gmail.com"
         | 
| 17 17 | 
             
              s.extra_rdoc_files = [
         | 
| 18 18 | 
             
                "README.md"
         | 
| 19 19 | 
             
              ]
         | 
| 20 20 | 
             
              s.files = [
         | 
| 21 | 
            -
                ".rvmrc",
         | 
| 22 21 | 
             
                ".travis.yml",
         | 
| 22 | 
            +
                "Appraisals",
         | 
| 23 23 | 
             
                "CHANGELOG.md",
         | 
| 24 | 
            +
                "CONTRIBUTING.md",
         | 
| 24 25 | 
             
                "Gemfile",
         | 
| 25 26 | 
             
                "MIT-LICENSE",
         | 
| 26 27 | 
             
                "README.md",
         | 
| 27 28 | 
             
                "Rakefile",
         | 
| 28 29 | 
             
                "VERSION",
         | 
| 29 30 | 
             
                "app/controllers/wicked/wizard_controller.rb",
         | 
| 31 | 
            +
                "gemfiles/3.0.gemfile",
         | 
| 32 | 
            +
                "gemfiles/3.1.gemfile",
         | 
| 33 | 
            +
                "gemfiles/3.2.gemfile",
         | 
| 34 | 
            +
                "gemfiles/4.0.gemfile",
         | 
| 35 | 
            +
                "gemfiles/4.1.gemfile",
         | 
| 30 36 | 
             
                "lib/wicked.rb",
         | 
| 31 37 | 
             
                "lib/wicked/controller/concerns/path.rb",
         | 
| 32 38 | 
             
                "lib/wicked/controller/concerns/render_redirect.rb",
         | 
| @@ -38,6 +44,7 @@ Gem::Specification.new do |s| | |
| 38 44 | 
             
                "test/dummy/Rakefile",
         | 
| 39 45 | 
             
                "test/dummy/app/controllers/application_controller.rb",
         | 
| 40 46 | 
             
                "test/dummy/app/controllers/bar_controller.rb",
         | 
| 47 | 
            +
                "test/dummy/app/controllers/dynamic_different_steps_controller.rb",
         | 
| 41 48 | 
             
                "test/dummy/app/controllers/dynamic_steps_controller.rb",
         | 
| 42 49 | 
             
                "test/dummy/app/controllers/i18n_controller.rb",
         | 
| 43 50 | 
             
                "test/dummy/app/controllers/jump_controller.rb",
         | 
| @@ -52,6 +59,7 @@ Gem::Specification.new do |s| | |
| 52 59 | 
             
                "test/dummy/app/views/bar/first.html.erb",
         | 
| 53 60 | 
             
                "test/dummy/app/views/bar/last_step.html.erb",
         | 
| 54 61 | 
             
                "test/dummy/app/views/bar/second.html.erb",
         | 
| 62 | 
            +
                "test/dummy/app/views/dynamic_different_steps/first.html.erb",
         | 
| 55 63 | 
             
                "test/dummy/app/views/dynamic_steps/first.html.erb",
         | 
| 56 64 | 
             
                "test/dummy/app/views/i18n/first.html.erb",
         | 
| 57 65 | 
             
                "test/dummy/app/views/i18n/last_step.html.erb",
         | 
| @@ -127,29 +135,20 @@ Gem::Specification.new do |s| | |
| 127 135 |  | 
| 128 136 | 
             
                if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
         | 
| 129 137 | 
             
                  s.add_runtime_dependency(%q<rails>, [">= 3.0.7"])
         | 
| 130 | 
            -
                  s.add_development_dependency(%q<rake>, [">= 0"])
         | 
| 131 | 
            -
                  s.add_development_dependency(%q<jeweler>, [">= 0"])
         | 
| 132 | 
            -
                  s.add_development_dependency(%q<capybara>, ["~> 1.1.2"])
         | 
| 133 | 
            -
                  s.add_development_dependency(%q<launchy>, [">= 0"])
         | 
| 134 138 | 
             
                  s.add_development_dependency(%q<sqlite3>, [">= 0"])
         | 
| 135 139 | 
             
                  s.add_development_dependency(%q<activerecord-jdbcsqlite3-adapter>, [">= 1.3.0.beta"])
         | 
| 140 | 
            +
                  s.add_development_dependency(%q<jeweler>, [">= 0"])
         | 
| 136 141 | 
             
                else
         | 
| 137 142 | 
             
                  s.add_dependency(%q<rails>, [">= 3.0.7"])
         | 
| 138 | 
            -
                  s.add_dependency(%q<rake>, [">= 0"])
         | 
| 139 | 
            -
                  s.add_dependency(%q<jeweler>, [">= 0"])
         | 
| 140 | 
            -
                  s.add_dependency(%q<capybara>, ["~> 1.1.2"])
         | 
| 141 | 
            -
                  s.add_dependency(%q<launchy>, [">= 0"])
         | 
| 142 143 | 
             
                  s.add_dependency(%q<sqlite3>, [">= 0"])
         | 
| 143 144 | 
             
                  s.add_dependency(%q<activerecord-jdbcsqlite3-adapter>, [">= 1.3.0.beta"])
         | 
| 145 | 
            +
                  s.add_dependency(%q<jeweler>, [">= 0"])
         | 
| 144 146 | 
             
                end
         | 
| 145 147 | 
             
              else
         | 
| 146 148 | 
             
                s.add_dependency(%q<rails>, [">= 3.0.7"])
         | 
| 147 | 
            -
                s.add_dependency(%q<rake>, [">= 0"])
         | 
| 148 | 
            -
                s.add_dependency(%q<jeweler>, [">= 0"])
         | 
| 149 | 
            -
                s.add_dependency(%q<capybara>, ["~> 1.1.2"])
         | 
| 150 | 
            -
                s.add_dependency(%q<launchy>, [">= 0"])
         | 
| 151 149 | 
             
                s.add_dependency(%q<sqlite3>, [">= 0"])
         | 
| 152 150 | 
             
                s.add_dependency(%q<activerecord-jdbcsqlite3-adapter>, [">= 1.3.0.beta"])
         | 
| 151 | 
            +
                s.add_dependency(%q<jeweler>, [">= 0"])
         | 
| 153 152 | 
             
              end
         | 
| 154 153 | 
             
            end
         | 
| 155 154 |  | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: wicked
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.0 | 
| 4 | 
            +
              version: 1.1.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - schneems
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2014- | 
| 11 | 
            +
            date: 2014-09-15 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rails
         | 
| @@ -25,21 +25,7 @@ dependencies: | |
| 25 25 | 
             
                  - !ruby/object:Gem::Version
         | 
| 26 26 | 
             
                    version: 3.0.7
         | 
| 27 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 28 | 
            -
              name:  | 
| 29 | 
            -
              requirement: !ruby/object:Gem::Requirement
         | 
| 30 | 
            -
                requirements:
         | 
| 31 | 
            -
                - - ">="
         | 
| 32 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 33 | 
            -
                    version: '0'
         | 
| 34 | 
            -
              type: :development
         | 
| 35 | 
            -
              prerelease: false
         | 
| 36 | 
            -
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 37 | 
            -
                requirements:
         | 
| 38 | 
            -
                - - ">="
         | 
| 39 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 40 | 
            -
                    version: '0'
         | 
| 41 | 
            -
            - !ruby/object:Gem::Dependency
         | 
| 42 | 
            -
              name: jeweler
         | 
| 28 | 
            +
              name: sqlite3
         | 
| 43 29 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 44 30 | 
             
                requirements:
         | 
| 45 31 | 
             
                - - ">="
         | 
| @@ -53,35 +39,21 @@ dependencies: | |
| 53 39 | 
             
                  - !ruby/object:Gem::Version
         | 
| 54 40 | 
             
                    version: '0'
         | 
| 55 41 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 56 | 
            -
              name:  | 
| 57 | 
            -
              requirement: !ruby/object:Gem::Requirement
         | 
| 58 | 
            -
                requirements:
         | 
| 59 | 
            -
                - - "~>"
         | 
| 60 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 61 | 
            -
                    version: 1.1.2
         | 
| 62 | 
            -
              type: :development
         | 
| 63 | 
            -
              prerelease: false
         | 
| 64 | 
            -
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 65 | 
            -
                requirements:
         | 
| 66 | 
            -
                - - "~>"
         | 
| 67 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 68 | 
            -
                    version: 1.1.2
         | 
| 69 | 
            -
            - !ruby/object:Gem::Dependency
         | 
| 70 | 
            -
              name: launchy
         | 
| 42 | 
            +
              name: activerecord-jdbcsqlite3-adapter
         | 
| 71 43 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 72 44 | 
             
                requirements:
         | 
| 73 45 | 
             
                - - ">="
         | 
| 74 46 | 
             
                  - !ruby/object:Gem::Version
         | 
| 75 | 
            -
                    version:  | 
| 47 | 
            +
                    version: 1.3.0.beta
         | 
| 76 48 | 
             
              type: :development
         | 
| 77 49 | 
             
              prerelease: false
         | 
| 78 50 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 79 51 | 
             
                requirements:
         | 
| 80 52 | 
             
                - - ">="
         | 
| 81 53 | 
             
                  - !ruby/object:Gem::Version
         | 
| 82 | 
            -
                    version:  | 
| 54 | 
            +
                    version: 1.3.0.beta
         | 
| 83 55 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 84 | 
            -
              name:  | 
| 56 | 
            +
              name: jeweler
         | 
| 85 57 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 86 58 | 
             
                requirements:
         | 
| 87 59 | 
             
                - - ">="
         | 
| @@ -94,20 +66,6 @@ dependencies: | |
| 94 66 | 
             
                - - ">="
         | 
| 95 67 | 
             
                  - !ruby/object:Gem::Version
         | 
| 96 68 | 
             
                    version: '0'
         | 
| 97 | 
            -
            - !ruby/object:Gem::Dependency
         | 
| 98 | 
            -
              name: activerecord-jdbcsqlite3-adapter
         | 
| 99 | 
            -
              requirement: !ruby/object:Gem::Requirement
         | 
| 100 | 
            -
                requirements:
         | 
| 101 | 
            -
                - - ">="
         | 
| 102 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 103 | 
            -
                    version: 1.3.0.beta
         | 
| 104 | 
            -
              type: :development
         | 
| 105 | 
            -
              prerelease: false
         | 
| 106 | 
            -
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 107 | 
            -
                requirements:
         | 
| 108 | 
            -
                - - ">="
         | 
| 109 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 110 | 
            -
                    version: 1.3.0.beta
         | 
| 111 69 | 
             
            description: Wicked is a Rails engine for producing easy wizard controllers
         | 
| 112 70 | 
             
            email: richard.schneeman@gmail.com
         | 
| 113 71 | 
             
            executables: []
         | 
| @@ -115,15 +73,21 @@ extensions: [] | |
| 115 73 | 
             
            extra_rdoc_files:
         | 
| 116 74 | 
             
            - README.md
         | 
| 117 75 | 
             
            files:
         | 
| 118 | 
            -
            - ".rvmrc"
         | 
| 119 76 | 
             
            - ".travis.yml"
         | 
| 77 | 
            +
            - Appraisals
         | 
| 120 78 | 
             
            - CHANGELOG.md
         | 
| 79 | 
            +
            - CONTRIBUTING.md
         | 
| 121 80 | 
             
            - Gemfile
         | 
| 122 81 | 
             
            - MIT-LICENSE
         | 
| 123 82 | 
             
            - README.md
         | 
| 124 83 | 
             
            - Rakefile
         | 
| 125 84 | 
             
            - VERSION
         | 
| 126 85 | 
             
            - app/controllers/wicked/wizard_controller.rb
         | 
| 86 | 
            +
            - gemfiles/3.0.gemfile
         | 
| 87 | 
            +
            - gemfiles/3.1.gemfile
         | 
| 88 | 
            +
            - gemfiles/3.2.gemfile
         | 
| 89 | 
            +
            - gemfiles/4.0.gemfile
         | 
| 90 | 
            +
            - gemfiles/4.1.gemfile
         | 
| 127 91 | 
             
            - lib/wicked.rb
         | 
| 128 92 | 
             
            - lib/wicked/controller/concerns/path.rb
         | 
| 129 93 | 
             
            - lib/wicked/controller/concerns/render_redirect.rb
         | 
| @@ -135,6 +99,7 @@ files: | |
| 135 99 | 
             
            - test/dummy/Rakefile
         | 
| 136 100 | 
             
            - test/dummy/app/controllers/application_controller.rb
         | 
| 137 101 | 
             
            - test/dummy/app/controllers/bar_controller.rb
         | 
| 102 | 
            +
            - test/dummy/app/controllers/dynamic_different_steps_controller.rb
         | 
| 138 103 | 
             
            - test/dummy/app/controllers/dynamic_steps_controller.rb
         | 
| 139 104 | 
             
            - test/dummy/app/controllers/i18n_controller.rb
         | 
| 140 105 | 
             
            - test/dummy/app/controllers/jump_controller.rb
         | 
| @@ -149,6 +114,7 @@ files: | |
| 149 114 | 
             
            - test/dummy/app/views/bar/first.html.erb
         | 
| 150 115 | 
             
            - test/dummy/app/views/bar/last_step.html.erb
         | 
| 151 116 | 
             
            - test/dummy/app/views/bar/second.html.erb
         | 
| 117 | 
            +
            - test/dummy/app/views/dynamic_different_steps/first.html.erb
         | 
| 152 118 | 
             
            - test/dummy/app/views/dynamic_steps/first.html.erb
         | 
| 153 119 | 
             
            - test/dummy/app/views/i18n/first.html.erb
         | 
| 154 120 | 
             
            - test/dummy/app/views/i18n/last_step.html.erb
         | 
    
        data/.rvmrc
    DELETED
    
    | @@ -1,19 +0,0 @@ | |
| 1 | 
            -
            #!/usr/bin/env bash
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            ruby_string="ruby-1.9.3"
         | 
| 4 | 
            -
            gemset_name="wicked"
         | 
| 5 | 
            -
             | 
| 6 | 
            -
            if rvm list strings | grep -q "${ruby_string}" ; then
         | 
| 7 | 
            -
             | 
| 8 | 
            -
              rvm use "${ruby_string}@${gemset_name}" --create
         | 
| 9 | 
            -
             | 
| 10 | 
            -
              # Complain if bundler isn't installed
         | 
| 11 | 
            -
              if [[ -z "`gem which bundler 2>&1 | grep -v ERROR`" ]]; then
         | 
| 12 | 
            -
                echo "You need bundler:"
         | 
| 13 | 
            -
                echo ""
         | 
| 14 | 
            -
                echo "    gem install bundler"
         | 
| 15 | 
            -
                echo ""
         | 
| 16 | 
            -
              fi
         | 
| 17 | 
            -
            else
         | 
| 18 | 
            -
              echo "${ruby_string} was not found, please run 'rvm install ${ruby_string}' and then cd back into the project directory."
         | 
| 19 | 
            -
            fi
         |