0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2025-02-02 19:37:01 +01:00
discourse-custom-wizard/lib/custom_wizard/template.rb

44 Zeilen
1,2 KiB
Ruby

2017-10-15 11:58:22 +08:00
class CustomWizard::Template
2017-11-01 12:21:14 +08:00
attr_reader :id,
:name,
:steps,
:background,
:save_submissions,
:multiple_submissions,
2017-11-22 17:34:21 +08:00
:prompt_completion,
2019-11-15 10:00:02 +11:00
:restart_on_revisit,
2017-11-29 17:48:49 +08:00
:min_trust,
2017-11-01 12:21:14 +08:00
:after_signup,
:after_time,
:after_time_scheduled,
2017-12-17 12:04:31 +08:00
:required,
2018-07-16 14:28:24 +10:00
:theme_id
2017-10-15 11:58:22 +08:00
def initialize(data)
data = data.is_a?(String) ? ::JSON.parse(data) : data
return nil if data.blank?
2017-10-15 11:58:22 +08:00
@id = data['id']
@name = data['name']
@steps = data['steps']
2017-11-01 12:21:14 +08:00
@background = data['background']
@save_submissions = data['save_submissions'] || false
@multiple_submissions = data['multiple_submissions'] || false
2017-11-22 17:34:21 +08:00
@prompt_completion = data['prompt_completion'] || false
2019-11-15 09:47:20 +11:00
@restart_on_revisit = data['restart_on_revisit'] || false
2017-11-29 17:48:49 +08:00
@min_trust = data['min_trust'] || 0
2017-11-01 12:21:14 +08:00
@after_signup = data['after_signup']
@after_time = data['after_time']
@after_time_scheduled = data['after_time_scheduled']
2017-11-22 17:34:21 +08:00
@required = data['required'] || false
2018-07-16 14:28:24 +10:00
@theme_id = data['theme_id']
if data['theme']
theme = Theme.find_by(name: data['theme'])
2018-07-16 14:28:24 +10:00
@theme_id = theme.id if theme
end
2017-10-15 11:58:22 +08:00
end
end