mirror of
https://github.com/discourse/discourse.git
synced 2025-09-05 08:59:27 +08:00
Wizard: Server Side Validation + Finished Step
This commit is contained in:
parent
be1d74d207
commit
9f12b571ef
35 changed files with 260 additions and 62 deletions
|
@ -1,6 +1,6 @@
|
|||
class WizardFieldSerializer < ApplicationSerializer
|
||||
|
||||
attributes :id, :type, :required, :value, :label, :placeholder
|
||||
attributes :id, :type, :required, :value, :label, :placeholder, :description, :options
|
||||
|
||||
def id
|
||||
object.id
|
||||
|
@ -41,4 +41,23 @@ class WizardFieldSerializer < ApplicationSerializer
|
|||
def include_placeholder?
|
||||
placeholder.present?
|
||||
end
|
||||
|
||||
def description
|
||||
I18n.t("#{i18n_key}.description", default: '')
|
||||
end
|
||||
|
||||
def include_description?
|
||||
description.present?
|
||||
end
|
||||
|
||||
def options
|
||||
object.options.map do |o|
|
||||
{id: o, label: I18n.t("#{i18n_key}.options.#{o}")}
|
||||
end
|
||||
end
|
||||
|
||||
def include_options?
|
||||
object.options.present?
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue