0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-10 04:12:53 +01:00
discourse-custom-wizard/lib/wizard/field.rb
2019-12-05 19:05:21 +11:00

37 Zeilen
Kein EOL
888 B
Ruby

module CustomWizardFieldExtension
attr_reader :label,
:description,
:image,
:key,
:min_length,
:file_types,
:limit,
:property
attr_accessor :dropdown_none
def initialize(attrs)
@attrs = attrs || {}
@id = attrs[:id]
@type = attrs[:type]
@required = !!attrs[:required]
@description = attrs[:description]
@image = attrs[:image]
@key = attrs[:key]
@min_length = attrs[:min_length]
@value = attrs[:value]
@choices = []
@dropdown_none = attrs[:dropdown_none]
@file_types = attrs[:file_types]
@limit = attrs[:limit]
@property = attrs[:property]
end
def label
@label ||= PrettyText.cook(@attrs[:label])
end
end
class Wizard::Field
prepend CustomWizardFieldExtension if SiteSetting.custom_wizard_enabled
end