discourse/lib/wizard/step.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

30 lines
521 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2016-08-25 13:14:56 -04:00
class Wizard
class Step
attr_reader :id, :updater
attr_accessor :index, :fields, :next, :previous, :disabled, :description_vars, :emoji
2016-08-25 13:14:56 -04:00
def initialize(id)
@id = id
@fields = []
end
def add_field(attrs)
field = Field.new(attrs)
field.step = self
@fields << field
yield field if block_given?
2016-08-25 13:14:56 -04:00
field
end
def has_fields?
@fields.present?
end
def on_update(&block)
@updater = block
end
2016-08-25 13:14:56 -04:00
end
end