2019-05-03 06:17:27 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-08-26 01:14:56 +08:00
|
|
|
class Wizard
|
|
|
|
class Step
|
2016-09-10 04:51:07 +08:00
|
|
|
attr_reader :id, :updater
|
2022-12-20 08:24:09 +08:00
|
|
|
attr_accessor :index, :fields, :next, :previous, :banner, :disabled, :description_vars, :emoji
|
2016-08-26 01:14:56 +08: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-10 04:51:07 +08:00
|
|
|
|
2016-09-15 04:36:08 +08:00
|
|
|
def has_fields?
|
|
|
|
@fields.present?
|
|
|
|
end
|
|
|
|
|
2016-09-10 04:51:07 +08:00
|
|
|
def on_update(&block)
|
|
|
|
@updater = block
|
|
|
|
end
|
2016-08-26 01:14:56 +08:00
|
|
|
end
|
|
|
|
end
|