2017-10-09 07:52:09 +02:00
|
|
|
class CustomWizard::Field
|
|
|
|
def self.types
|
2020-04-16 04:04:27 +02:00
|
|
|
@types ||= {
|
|
|
|
text: {
|
2020-07-16 09:50:09 +02:00
|
|
|
min_length: nil,
|
2020-12-08 08:49:31 +01:00
|
|
|
max_length: nil,
|
2021-01-12 11:46:24 +01:00
|
|
|
prefill: nil,
|
|
|
|
char_counter: nil
|
2020-04-16 04:04:27 +02:00
|
|
|
},
|
|
|
|
textarea: {
|
2020-07-16 09:50:09 +02:00
|
|
|
min_length: nil,
|
2020-12-08 08:49:31 +01:00
|
|
|
max_length: nil,
|
2021-01-12 11:46:24 +01:00
|
|
|
prefill: nil,
|
|
|
|
char_counter: nil
|
2020-04-16 04:04:27 +02:00
|
|
|
},
|
|
|
|
composer: {
|
2020-12-08 08:14:37 +01:00
|
|
|
min_length: nil,
|
2020-12-08 08:49:31 +01:00
|
|
|
max_length: nil,
|
2021-01-12 11:46:24 +01:00
|
|
|
char_counter: nil
|
2020-04-16 04:04:27 +02:00
|
|
|
},
|
|
|
|
text_only: {},
|
2020-07-16 05:26:56 +02:00
|
|
|
date: {
|
|
|
|
format: "YYYY-MM-DD"
|
|
|
|
},
|
|
|
|
time: {
|
|
|
|
format: "HH:mm"
|
|
|
|
},
|
|
|
|
date_time: {
|
|
|
|
format: ""
|
|
|
|
},
|
2020-04-16 04:04:27 +02:00
|
|
|
number: {},
|
|
|
|
checkbox: {},
|
|
|
|
url: {
|
|
|
|
min_length: nil
|
|
|
|
},
|
|
|
|
upload: {
|
|
|
|
file_types: '.jpg,.png'
|
|
|
|
},
|
|
|
|
dropdown: {
|
|
|
|
prefill: nil,
|
|
|
|
content: nil
|
|
|
|
},
|
|
|
|
tag: {
|
|
|
|
limit: nil,
|
|
|
|
prefill: nil,
|
|
|
|
content: nil
|
|
|
|
},
|
|
|
|
category: {
|
|
|
|
limit: 1,
|
|
|
|
property: 'id',
|
|
|
|
prefill: nil,
|
|
|
|
content: nil
|
|
|
|
},
|
|
|
|
group: {
|
|
|
|
prefill: nil,
|
|
|
|
content: nil
|
|
|
|
},
|
|
|
|
user_selector: {}
|
|
|
|
}
|
2017-10-09 07:52:09 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def self.require_assets
|
|
|
|
@require_assets ||= {}
|
|
|
|
end
|
|
|
|
|
2020-11-03 01:24:20 +01:00
|
|
|
def self.register(type, plugin = nil, asset_paths = [], opts={})
|
2017-10-09 07:52:09 +02:00
|
|
|
if type
|
2020-11-03 01:24:20 +01:00
|
|
|
types[type.to_sym] ||= {}
|
|
|
|
types[type.to_sym] = opts[:type_opts] if opts[:type_opts].present?
|
2017-10-09 07:52:09 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
if plugin && asset_paths
|
|
|
|
require_assets[plugin] = asset_paths
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|