Sha256: ed43a91a674e0a99e15cf64494786311f1b6d993236203077a25522d81ff70e1
Contents?: true
Size: 1.38 KB
Versions: 2
Compression:
Stored size: 1.38 KB
Contents
module Wicked module Wizard extend ActiveSupport::Concern # Include the modules!! include Wicked::Controller::Concerns::Path include Wicked::Controller::Concerns::RenderRedirect include Wicked::Controller::Concerns::Steps included do # Give our Views helper methods! helper_method :wizard_path, :next_wizard_path, :previous_wizard_path, :step, :wizard_steps, :current_step?, :past_step?, :future_step?, :previous_step?, :next_step? # Set @step and @next_step variables before_filter :setup_wizard end # forward to first step with whatever params are provided def index redirect_to wizard_path(steps.first, clean_params) end private def clean_params params.except(:action, :controller) end def check_redirect_to_first_last!(step) redirect_to wizard_path(steps.first) if step == :wizard_first redirect_to wizard_path(steps.last) if step == :wizard_last end def setup_step_from(the_step) the_step = the_step.try(:to_sym) || steps.first check_redirect_to_first_last!(the_step) return the_step end def setup_wizard @step = setup_step_from(params[:id]) @previous_step = previous_step(@step) @next_step = next_step(@step) end public end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
wicked-0.3.3 | lib/wicked/wizard.rb |
wicked-0.3.2 | lib/wicked/wizard.rb |