allow to add custom form completed message

This commit is contained in:
Pete Matsyburka
2024-04-05 16:16:30 +03:00
parent f16405ca70
commit 753cbd4d27
9 changed files with 65 additions and 8 deletions
+3 -1
View File
@@ -3,6 +3,7 @@
module Submitters
module FormConfigs
DEFAULT_KEYS = [AccountConfig::FORM_COMPLETED_BUTTON_KEY,
AccountConfig::FORM_COMPLETED_MESSAGE_KEY,
AccountConfig::FORM_WITH_CONFETTI_KEY,
AccountConfig::ALLOW_TYPED_SIGNATURE].freeze
@@ -13,10 +14,11 @@ module Submitters
.where(key: DEFAULT_KEYS + keys)
completed_button = configs.find { |e| e.key == AccountConfig::FORM_COMPLETED_BUTTON_KEY }&.value || {}
completed_message = configs.find { |e| e.key == AccountConfig::FORM_COMPLETED_MESSAGE_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
attrs = { completed_button:, with_typed_signature:, with_confetti: }
attrs = { completed_button:, with_typed_signature:, with_confetti:, completed_message: }
keys.each do |key|
attrs[key.to_sym] = configs.find { |e| e.key == key.to_s }&.value