mirror of
https://github.com/discourse/discourse.git
synced 2025-06-01 01:55:46 +08:00
Add locale step
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
class WizardFieldSerializer < ApplicationSerializer
|
||||
|
||||
attributes :id, :type, :required, :value, :label, :placeholder, :description, :options
|
||||
attributes :id, :type, :required, :value, :label, :placeholder, :description
|
||||
has_many :choices, serializer: WizardFieldChoiceSerializer, embed: :objects
|
||||
|
||||
def id
|
||||
object.id
|
||||
@ -50,24 +51,4 @@ class WizardFieldSerializer < ApplicationSerializer
|
||||
description.present?
|
||||
end
|
||||
|
||||
def options
|
||||
object.options.map do |o|
|
||||
|
||||
result = {id: o, label: I18n.t("#{i18n_key}.options.#{o}")}
|
||||
|
||||
data = object.option_data[o]
|
||||
if data.present?
|
||||
as_json = data.dup
|
||||
as_json.delete(:id)
|
||||
result[:data] = as_json
|
||||
end
|
||||
|
||||
result
|
||||
end
|
||||
end
|
||||
|
||||
def include_options?
|
||||
object.options.present?
|
||||
end
|
||||
|
||||
end
|
||||
|
Reference in New Issue
Block a user