lib/wicked/controller/concerns/steps.rb in wicked-focused-0.2.1 vs lib/wicked/controller/concerns/steps.rb in wicked-focused-0.2.2
- old
+ new
@@ -42,11 +42,11 @@
return false if steps.index(step).nil? || steps.index(step_name).nil?
steps.index(step) + 1 == steps.index(step_name)
end
module ClassMethods
- attr_reader :wizard_steps, :skip_steps
+ attr_reader :wizard_steps, :skip_steps, :command_steps
def steps(*args)
options = args.last.is_a?(Hash) ? callbacks.pop : {}
steps = args
@wizard_steps = args
@@ -57,10 +57,15 @@
def allow_skip_for(*args)
@skip_steps = args
end
alias :optional_steps :allow_skip_for
+
+ def command_steps(*args)
+ return @command_steps if args.empty?
+ @command_steps = args
+ end
end
def steps=(wizard_steps)
@wizard_steps = wizard_steps
end
@@ -71,12 +76,15 @@
alias :wizard_steps :steps
alias :steps_list :steps
def skip_step?
return false unless params[:skip_step]
- skip_steps = self.class.superclass.skip_steps
return true if skip_steps.blank?
skip_steps.include? step.to_sym
+ end
+
+ def skip_steps
+ @skip_steps ||= self.class.superclass.skip_steps
end
def previous_step(current_step = nil)
return previous_step if current_step == nil
index = steps.index(current_step)