mirror of
https://github.com/docusealco/docuseal
synced 2026-11-05 14:42:33 -05:00
allow to disable confetti
This commit is contained in:
1 parent
2d0f323854
commit
633e5ac5e4
6 files changed
+39
-9
No files matched your search
@@ -2,20 +2,27 @@
|
||||
|
||||
module Submitters
|
||||
module FormConfigs
|
||||
DEFAULT_KEYS = [AccountConfig::FORM_COMPLETED_BUTTON_KEY,
|
||||
AccountConfig::FORM_WITH_CONFETTI_KEY,
|
||||
AccountConfig::ALLOW_TYPED_SIGNATURE].freeze
|
||||
|
||||
module_function
|
||||
|
||||
def call(submitter)
|
||||
def call(submitter, keys = [])
|
||||
configs = submitter.submission.template.account.account_configs
|
||||
.where(key: [AccountConfig::FORM_COMPLETED_BUTTON_KEY,
|
||||
AccountConfig::FORM_WITH_CONFETTI_KEY,
|
||||
AccountConfig::ALLOW_TYPED_SIGNATURE])
|
||||
.where(key: DEFAULT_KEYS + keys)
|
||||
|
||||
completed_button = configs.find { |e| e.key == AccountConfig::FORM_COMPLETED_BUTTON_KEY }&.value || {}
|
||||
|
||||
with_typed_signature = configs.find { |e| e.key == AccountConfig::ALLOW_TYPED_SIGNATURE }&.value != false
|
||||
with_confetti = configs.find { |e| e.key == AccountConfig::FORM_WITH_CONFETTI_KEY }&.value != false
|
||||
|
||||
{ completed_button:, with_typed_signature:, with_confetti: }
|
||||
attrs = { completed_button:, with_typed_signature:, with_confetti: }
|
||||
|
||||
keys.each do |key|
|
||||
attrs[key.to_sym] = configs.find { |e| e.key == key.to_s }&.value
|
||||
end
|
||||
|
||||
attrs
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user