2019-12-05 09:05:21 +01:00
|
|
|
module CustomWizardFieldExtension
|
|
|
|
attr_reader :label,
|
|
|
|
:description,
|
|
|
|
:image,
|
|
|
|
:key,
|
|
|
|
:min_length,
|
|
|
|
:file_types,
|
|
|
|
:limit,
|
2020-03-24 10:35:46 +01:00
|
|
|
:property,
|
2020-03-30 08:16:03 +02:00
|
|
|
:content
|
2019-12-05 09:05:21 +01:00
|
|
|
|
|
|
|
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]
|
|
|
|
@file_types = attrs[:file_types]
|
|
|
|
@limit = attrs[:limit]
|
|
|
|
@property = attrs[:property]
|
2020-03-30 08:16:03 +02:00
|
|
|
@content = attrs[:content]
|
2019-12-05 09:05:21 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def label
|
|
|
|
@label ||= PrettyText.cook(@attrs[:label])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class Wizard::Field
|
|
|
|
prepend CustomWizardFieldExtension if SiteSetting.custom_wizard_enabled
|
|
|
|
end
|