discourse/lib/wizard/step.rb

27 lines
427 B
Ruby
Raw Normal View History

2016-08-26 01:14:56 +08:00
class Wizard
class Step
attr_reader :id, :updater
attr_accessor :index, :fields, :next, :previous, :banner
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
def has_fields?
@fields.present?
end
def on_update(&block)
@updater = block
end
2016-08-26 01:14:56 +08:00
end
end