2019-05-02 17:17:27 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-08-25 12:14:56 -05:00
|
|
|
class Wizard
|
|
|
|
class Step
|
2016-09-09 15:51:07 -05:00
|
|
|
attr_reader :id, :updater
|
2018-12-05 11:05:37 -06:00
|
|
|
attr_accessor :index, :fields, :next, :previous, :banner, :disabled, :description_vars
|
2016-08-25 12:14:56 -05:00
|
|
|
|
|
|
|
def initialize(id)
|
|
|
|
@id = id
|
|
|
|
@fields = []
|
|
|
|
end
|
|
|
|
|
|
|
|
def add_field(attrs)
|
|
|
|
field = Field.new(attrs)
|
|
|
|
field.step = self
|
|
|
|
@fields << field
|
|
|
|
field
|
|
|
|
end
|
2016-09-09 15:51:07 -05:00
|
|
|
|
2016-09-14 15:36:08 -05:00
|
|
|
def has_fields?
|
|
|
|
@fields.present?
|
|
|
|
end
|
|
|
|
|
2016-09-09 15:51:07 -05:00
|
|
|
def on_update(&block)
|
|
|
|
@updater = block
|
|
|
|
end
|
2016-08-25 12:14:56 -05:00
|
|
|
end
|
|
|
|
end
|