discourse/lib/wizard/field.rb
Arpit Jalan 10f200a5d3
FEATURE: revamped wizard (#17477)
* FEATURE: revamped wizard

* UX: Wizard redesign (#17381)

* UX: Step 1-2

* swap out images

* UX: Finalize all steps

* UX: mobile

* UX: Fix test

* more test

* DEV: remove unneeded wizard components

* DEV: fix wizard tests

* DEV: update rails tests for new wizard

* Remove empty hbs files that were created because of rebase

* Fixes for rebase

* Fix wizard image link

* More rebase fixes

* Fix rails tests

* FIX: Update preview for new color schemes: (#17481)

* UX: make layout more responsive, update images

* fix typo

* DEV: move discourse logo svg to template only component

* DEV: formatting improvements

* Remove unneeded files

* Add tests for privacy step

* Fix banner image height for step "ready"

Co-authored-by: Jordan Vidrine <30537603+jordanvidrine@users.noreply.github.com>
Co-authored-by: awesomerobot <kris.aubuchon@discourse.org>
2022-07-27 06:53:01 +05:30

44 lines
876 B
Ruby

# frozen_string_literal: true
class Wizard
class Choice
attr_reader :id, :label, :icon, :data, :extra_label
attr_accessor :field
def initialize(id, opts)
@id = id
@data = opts[:data]
@label = opts[:label]
@extra_label = opts[:extra_label]
@icon = opts[:icon]
end
end
class Field
attr_reader :id, :type, :required, :value, :icon, :choices, :show_in_sidebar
attr_accessor :step
def initialize(attrs)
attrs = attrs || {}
@id = attrs[:id]
@type = attrs[:type]
@required = !!attrs[:required]
@value = attrs[:value]
@icon = attrs[:icon]
@choices = []
@show_in_sidebar = attrs[:show_in_sidebar]
end
def add_choice(id, opts = nil)
choice = Choice.new(id, opts || {})
choice.field = self
@choices << choice
choice
end
end
end