Module: Wicked::Controller::Concerns::Steps
- Extended by:
- ActiveSupport::Concern
- Included in:
- Wizard
- Defined in:
- lib/wicked/controller/concerns/steps.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#current_step?(step_name) ⇒ Boolean
will return true if step passed in is the currently rendered step.
-
#future_step?(step_name) ⇒ Boolean
will return true if the step passed in has not been executed by the wizard.
- #jump_to(goto_step) ⇒ Object
- #next_step(current_step = nil) ⇒ Object
-
#next_step?(step_name) ⇒ Boolean
will return true if the next step is the step passed in.
-
#past_step?(step_name) ⇒ Boolean
will return true if the step passed in has already been executed by the wizard.
- #previous_step(current_step = nil) ⇒ Object
-
#previous_step?(step_name) ⇒ Boolean
will return true if the last step is the step passed in.
- #skip_step ⇒ Object
- #step ⇒ Object
- #steps ⇒ Object (also: #wizard_steps, #steps_list)
- #steps=(wizard_steps) ⇒ Object
Instance Method Details
#current_step?(step_name) ⇒ Boolean
will return true if step passed in is the currently rendered step
17 18 19 20 |
# File 'lib/wicked/controller/concerns/steps.rb', line 17 def current_step?(step_name) return false unless current_and_given_step_exists?(step_name) step == step_name end |
#future_step?(step_name) ⇒ Boolean
will return true if the step passed in has not been executed by the wizard
29 30 31 32 |
# File 'lib/wicked/controller/concerns/steps.rb', line 29 def future_step?(step_name) return false unless current_and_given_step_exists?(step_name) current_step_index < step_index_for(step_name) end |
#jump_to(goto_step) ⇒ Object
4 5 6 |
# File 'lib/wicked/controller/concerns/steps.rb', line 4 def jump_to(goto_step) @skip_to = goto_step end |
#next_step(current_step = nil) ⇒ Object
75 76 77 78 79 80 81 |
# File 'lib/wicked/controller/concerns/steps.rb', line 75 def next_step(current_step = nil) return @next_step if current_step.nil? index = steps.index(current_step) step = steps.at(index + 1) if index.present? step ||= :finish step end |
#next_step?(step_name) ⇒ Boolean
will return true if the next step is the step passed in
41 42 43 44 |
# File 'lib/wicked/controller/concerns/steps.rb', line 41 def next_step?(step_name) return false unless current_and_given_step_exists?(step_name) (current_step_index + 1) == step_index_for(step_name) end |
#past_step?(step_name) ⇒ Boolean
will return true if the step passed in has already been executed by the wizard
23 24 25 26 |
# File 'lib/wicked/controller/concerns/steps.rb', line 23 def past_step?(step_name) return false unless current_and_given_step_exists?(step_name) current_step_index > step_index_for(step_name) end |
#previous_step(current_step = nil) ⇒ Object
66 67 68 69 70 71 72 |
# File 'lib/wicked/controller/concerns/steps.rb', line 66 def previous_step(current_step = nil) return @previous_step if current_step.nil? index = steps.index(current_step) step = steps.at(index - 1) if index.present? && index != 0 step ||= steps.first step end |
#previous_step?(step_name) ⇒ Boolean
will return true if the last step is the step passed in
35 36 37 38 |
# File 'lib/wicked/controller/concerns/steps.rb', line 35 def previous_step?(step_name) return false unless current_and_given_step_exists?(step_name) (current_step_index - 1) == step_index_for(step_name) end |
#skip_step ⇒ Object
8 9 10 |
# File 'lib/wicked/controller/concerns/steps.rb', line 8 def skip_step @skip_to = @next_step end |
#step ⇒ Object
12 13 14 |
# File 'lib/wicked/controller/concerns/steps.rb', line 12 def step @step end |
#steps ⇒ Object Also known as: wizard_steps, steps_list
60 61 62 |
# File 'lib/wicked/controller/concerns/steps.rb', line 60 def steps @wizard_steps end |
#steps=(wizard_steps) ⇒ Object
56 57 58 |
# File 'lib/wicked/controller/concerns/steps.rb', line 56 def steps=(wizard_steps) @wizard_steps = wizard_steps end |