module Wicked::Controller::Concerns::Steps

Constants

PROTECTED_STEPS

Public Instance Methods

current_step?(step_name) click to toggle source

will return true if step passed in is the currently rendered step

# File lib/wicked/controller/concerns/steps.rb, line 21
def current_step?(step_name)
  return false unless current_and_given_step_exists?(step_name)
  step == step_name
end
future_step?(step_name) click to toggle source

will return true if the step passed in has not been executed by the wizard

# File lib/wicked/controller/concerns/steps.rb, line 33
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, options = {}) click to toggle source
# File lib/wicked/controller/concerns/steps.rb, line 6
def jump_to(goto_step, options = {})
  @skip_to                = goto_step
  @wicked_redirect_params = options
end
next_step(current_step = nil) click to toggle source
# File lib/wicked/controller/concerns/steps.rb, line 88
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  ||= Wicked::FINISH_STEP
  step
end
next_step?(step_name) click to toggle source

will return true if the next step is the step passed in

# File lib/wicked/controller/concerns/steps.rb, line 45
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) click to toggle source

will return true if the step passed in has already been executed by the wizard

# File lib/wicked/controller/concerns/steps.rb, line 27
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) click to toggle source
# File lib/wicked/controller/concerns/steps.rb, line 79
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) click to toggle source

will return true if the last step is the step passed in

# File lib/wicked/controller/concerns/steps.rb, line 39
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(options = {}) click to toggle source
# File lib/wicked/controller/concerns/steps.rb, line 11
def skip_step(options = {})
  @skip_to                = @next_step
  @wicked_redirect_params = options
end
step() click to toggle source
# File lib/wicked/controller/concerns/steps.rb, line 16
def step
  @step
end
steps() click to toggle source
# File lib/wicked/controller/concerns/steps.rb, line 73
def steps
  @wizard_steps
end
Also aliased as: wizard_steps, steps_list
steps=(wizard_steps) click to toggle source
# File lib/wicked/controller/concerns/steps.rb, line 69
def steps=(wizard_steps)
  @wizard_steps = wizard_steps
end
steps_list()
Alias for: steps
wizard_steps()
Alias for: steps

Private Instance Methods

current_and_given_step_exists?(step_name) click to toggle source
# File lib/wicked/controller/concerns/steps.rb, line 106
def current_and_given_step_exists?(step_name)
  return false if current_step_index.nil? || steps.index(step_name).nil?
  return true
end
current_step_index() click to toggle source
# File lib/wicked/controller/concerns/steps.rb, line 102
def current_step_index
  step_index_for(step)
end
step_index_for(step_name) click to toggle source
# File lib/wicked/controller/concerns/steps.rb, line 98
def step_index_for(step_name)
  steps.index(step_name)
end