0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-29 20:20:29 +01:00
discourse-custom-wizard/serializers/wizard_step_serializer.rb

29 Zeilen
721 B
Ruby

2019-12-05 09:05:21 +01:00
module CustomWizardWizardStepSerializerExtension
2019-12-06 10:05:19 +01:00
extend ActiveSupport::Concern
included do
attributes :permitted, :permitted_message
end
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
def permitted_message
object.permitted_message
end
end
class WizardStepSerializer
prepend CustomWizardWizardStepSerializerExtension if SiteSetting.custom_wizard_enabled
end