2019-12-12 05:43:11 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-04-13 14:17:22 +02:00
|
|
|
class CustomWizard::StepSerializer < ::WizardStepSerializer
|
2021-02-24 08:50:42 +01:00
|
|
|
|
2019-12-12 05:43:11 +01:00
|
|
|
attributes :permitted, :permitted_message
|
2020-04-13 14:17:22 +02:00
|
|
|
has_many :fields, serializer: ::CustomWizard::FieldSerializer, embed: :objects
|
2019-12-05 09:05:21 +01:00
|
|
|
|
|
|
|
def title
|
|
|
|
return PrettyText.cook(object.title) if object.title
|
|
|
|
PrettyText.cook(I18n.t("#{object.key || i18n_key}.title", default: ''))
|
|
|
|
end
|
|
|
|
|
|
|
|
def description
|
|
|
|
return object.description if object.description
|
|
|
|
PrettyText.cook(I18n.t("#{object.key || i18n_key}.description", default: '', base_url: Discourse.base_url))
|
|
|
|
end
|
|
|
|
|
|
|
|
def permitted
|
|
|
|
object.permitted
|
|
|
|
end
|
2021-02-24 08:50:42 +01:00
|
|
|
|
2019-12-05 09:05:21 +01:00
|
|
|
def permitted_message
|
|
|
|
object.permitted_message
|
|
|
|
end
|
2021-02-24 08:50:42 +01:00
|
|
|
end
|