mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-05 10:06:55 +08:00
Consolidates all three wizard screens into one. Cleans up some leftover, unused wizard elements (checkbox, image, canvas inputs). Internal ticket: t/164852 <img width="2880" height="2376" alt="CleanShot 2025-11-25 at 10 35 43@2x" src="https://github.com/user-attachments/assets/f824a172-38b0-4fda-922a-3732335b93b2" /> --------- Co-authored-by: Jordan Vidrine <jordan@jordanvidrine.com>
38 lines
740 B
Ruby
38 lines
740 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Wizard
|
|
class Choice
|
|
attr_reader :id, :label, :data, :extra_label
|
|
attr_accessor :field
|
|
|
|
def initialize(id, opts)
|
|
@id = id
|
|
@data = opts[:data]
|
|
@label = opts[:label]
|
|
@extra_label = opts[:extra_label]
|
|
end
|
|
end
|
|
|
|
class Field
|
|
attr_reader :id, :type, :required, :value, :choices
|
|
attr_accessor :step
|
|
|
|
def initialize(attrs)
|
|
attrs = attrs || {}
|
|
|
|
@id = attrs[:id]
|
|
@type = attrs[:type]
|
|
@required = !!attrs[:required]
|
|
@value = attrs[:value]
|
|
@choices = []
|
|
end
|
|
|
|
def add_choice(id, opts = nil)
|
|
choice = Choice.new(id, opts || {})
|
|
choice.field = self
|
|
|
|
@choices << choice
|
|
choice
|
|
end
|
|
end
|
|
end
|