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
@@ -0,0 +1,28 @@
<div class="collapse collapse-plus bg-base-200">
<input type="checkbox">
<div class="collapse-title text-xl font-medium">
<div>
Completed Form Message
</div>
</div>
<div class="collapse-content">
<%= form_for AccountConfigs.find_or_initialize_for_key(current_account, AccountConfig::FORM_COMPLETED_MESSAGE_KEY), url: settings_personalization_path, method: :post, html: { autocomplete: 'off', class: 'space-y-4' } do |f| %>
<%= f.hidden_field :key %>
<%= f.fields_for :value, Struct.new(:title, :body).new(*(f.object.value || {}).values_at('title', 'body')) do |ff| %>
<div class="form-control">
<%= ff.label :title, 'Title', class: 'label' %>
<%= ff.text_field :title, class: 'base-input', dir: 'auto' %>
</div>
<div class="form-control">
<%= ff.label :body, 'Body', class: 'label' %>
<autoresize-textarea>
<%= ff.text_area :body, class: 'base-input w-full py-2', dir: 'auto' %>
</autoresize-textarea>
</div>
<% end %>
<div class="form-control pt-2">
<%= f.button button_title(title: 'Save', disabled_with: 'Saving'), class: 'base-button' %>
</div>
<% end %>
</div>
</div>
@@ -10,7 +10,10 @@
<p class="text-4xl font-bold mb-4 mt-8">Company Logo</p>
<%= render 'logo_form' %>
<p class="text-4xl font-bold mb-4 mt-8">Submission Form</p>
<%= render 'form_completed_button_form' %>
<div class="space-y-4">
<%= render 'form_completed_message_form' %>
<%= render 'form_completed_button_form' %>
</div>
<%= render 'form_customization_settings' %>
</div>
<div class="w-0 md:w-52"></div>