Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-23 01:40:29 +01:00
72 Zeilen
Kein EOL
1,2 KiB
Ruby
72 Zeilen
Kein EOL
1,2 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
class CustomWizard::FieldSerializer < ::WizardFieldSerializer
|
|
|
|
attributes :image,
|
|
:file_types,
|
|
:format,
|
|
:limit,
|
|
:property,
|
|
:content,
|
|
:max_length,
|
|
:char_counter,
|
|
:number
|
|
|
|
def label
|
|
return object.label if object.label.present?
|
|
I18n.t("#{object.key || i18n_key}.label", default: '')
|
|
end
|
|
|
|
def description
|
|
return object.description if object.description.present?
|
|
I18n.t("#{object.key || i18n_key}.description", default: '', base_url: Discourse.base_url)
|
|
end
|
|
|
|
def image
|
|
object.image
|
|
end
|
|
|
|
def include_image?
|
|
object.image.present?
|
|
end
|
|
|
|
def placeholder
|
|
I18n.t("#{object.key || i18n_key}.placeholder", default: '')
|
|
end
|
|
|
|
def file_types
|
|
object.file_types
|
|
end
|
|
|
|
def format
|
|
object.format
|
|
end
|
|
|
|
def limit
|
|
object.limit
|
|
end
|
|
|
|
def property
|
|
object.property
|
|
end
|
|
|
|
def content
|
|
object.content
|
|
end
|
|
|
|
def include_choices?
|
|
object.choices.present?
|
|
end
|
|
|
|
def max_length
|
|
object.max_length
|
|
end
|
|
|
|
def char_counter
|
|
object.char_counter
|
|
end
|
|
|
|
def number
|
|
object.number
|
|
end
|
|
end |