@@ -26,7 +26,7 @@
<%= button_to button_title(title: t('send_copy_to_email'), disabled_with: t('sending'), icon: svg_icon('mail_forward', class: 'w-6 h-6')), send_submission_email_index_path, params: { template_slug: @template.slug, email: params[:email] }, class: 'base-button w-full' %>
<% end %>
- <% if Templates.filter_undefined_submitters(@template.submitters).size == 1 && %w[api embed mcp].exclude?(@submitter.submission.source) && @submitter.account.account_configs.find_or_initialize_by(key: AccountConfig::ALLOW_TO_RESUBMIT).value != false && @template.shared_link? %>
+ <% if @template.shared_link? && Templates.filter_undefined_submitters(@template.submitters).size == 1 && %w[api embed mcp].exclude?(@submitter.submission.source) && @submitter.account.account_configs.find_or_initialize_by(key: AccountConfig::ALLOW_TO_RESUBMIT).value != false %>
<%= button_to button_title(title: t('resubmit'), disabled_with: t('resubmit'), icon: svg_icon('reload', class: 'w-6 h-6')), start_form_path(@template.slug), params: { submitter: params.permit(:name, :email, :phone).compact_blank, resubmit: true }, method: :put, class: 'white-button w-full' %>
diff --git a/app/views/start_form/email_verification.html.erb b/app/views/start_form/email_verification.html.erb
index 68e54986..e03e0f42 100644
--- a/app/views/start_form/email_verification.html.erb
+++ b/app/views/start_form/email_verification.html.erb
@@ -23,12 +23,12 @@
<%= t('we_sent_a_one_time_verification_code_to_your_email_address_please_enter_the_code_below_to_continue') %>
- <%= form_for '', url: start_form_path(@template.slug), method: :put, html: { class: 'space-y-4', id: 'code_form' } do |f| %>
+ <%= form_for '', url: @resubmit_submitter ? resubmit_form_path : start_form_path(@template.slug), method: :put, html: { class: 'space-y-4', id: 'code_form' } do |f| %>
<%= f.hidden_field 'resubmit', value: params[:resubmit] %>
- <%= f.hidden_field 'submitter[name]', value: params[:name] || @submitter&.name %>
- <%= f.hidden_field 'submitter[email]', value: params[:email] || @submitter&.email %>
- <%= f.hidden_field 'submitter[phone]', value: params[:phone] || @submitter&.phone %>
+ <%= f.hidden_field 'submitter[name]', value: params[:name] || params.dig(:submitter, :name) %>
+ <%= f.hidden_field 'submitter[email]', value: params[:email] || params.dig(:submitter, :email) %>
+ <%= f.hidden_field 'submitter[phone]', value: params[:phone] || params.dig(:submitter, :phone) %>
<%= f.text_field :one_time_code, required: true, inputmode: 'numeric', class: 'base-input text-center', placeholder: 'XXXXXX' %>
@@ -49,6 +49,10 @@
<%= f.button button_title(title: t('submit')), class: 'base-button' %>
<% end %>
- <%= button_to t(:re_send_email), start_form_email_2fa_send_index_path, params: { slug: @template.slug, resend: true, submitter: { name: params[:name] || @submitter&.name, email: params[:email] || @submitter&.email, phone: params[:phone] || @submitter&.phone } }.compact, method: :post, id: 'resend_code', class: 'hidden' %>
+ <% if @resubmit_submitter %>
+ <%= button_to t(:re_send_email), resubmit_form_path, params: { resubmit: @resubmit_submitter.slug }, method: :put, id: 'resend_code', class: 'hidden' %>
+ <% else %>
+ <%= button_to t(:re_send_email), start_form_email_2fa_send_index_path, params: { slug: @template.slug, resend: true, submitter: { name: params[:name] || params.dig(:submitter, :name), email: params[:email] || params.dig(:submitter, :email), phone: params[:phone] || params.dig(:submitter, :phone) } }.compact, method: :post, id: 'resend_code', class: 'hidden' %>
+ <% end %>
diff --git a/app/views/start_form/private.html.erb b/app/views/start_form/private.html.erb
index 083cc67c..53fc86f9 100644
--- a/app/views/start_form/private.html.erb
+++ b/app/views/start_form/private.html.erb
@@ -4,7 +4,7 @@
<% end %>
- <%= render 'banner' %>
+ <%= render 'start_form/banner' %>
<%= t('share_link_is_currently_disabled') %>
diff --git a/app/views/start_form/show.html.erb b/app/views/start_form/show.html.erb
index a54019bf..dbfc65ca 100644
--- a/app/views/start_form/show.html.erb
+++ b/app/views/start_form/show.html.erb
@@ -6,7 +6,7 @@
- <%= render 'banner' %>
+ <%= render 'start_form/banner' %>
<% unless @template.archived_at? %>
<%= t('you_have_been_invited_to_submit_a_form') %>
<% end %>
@@ -28,7 +28,8 @@
<% if !@template.archived_at? && !@template.account.archived_at? %>
- <%= form_for @submitter, url: start_form_path(@template.slug), data: { turbo_frame: :_top }, method: :put, html: { class: 'space-y-4' } do |f| %>
+ <%= form_for @submitter, url: @resubmit_submitter ? resubmit_form_path : start_form_path(@template.slug), data: { turbo_frame: :_top }, method: :put, html: { class: 'space-y-4' } do |f| %>
+ <%= hidden_field_tag :resubmit, @resubmit_submitter.slug if @resubmit_submitter %>
<% if @error_message %>
<%= svg_icon('info_circle', class: 'stroke-current shrink-0 h-6 w-6 mt-1') %>
diff --git a/app/views/submit_form/completed.html.erb b/app/views/submit_form/completed.html.erb
index d006187e..217c97c8 100644
--- a/app/views/submit_form/completed.html.erb
+++ b/app/views/submit_form/completed.html.erb
@@ -44,7 +44,7 @@
<% end %>
<% undefined_submitters = Templates.filter_undefined_submitters(@submitter.submission.template_submitters) %>
- <% if undefined_submitters.size == 1 && undefined_submitters.first['uuid'] == @submitter.uuid && @submitter.completed_at? && @submitter.completed_at > 14.days.ago && %w[api embed mcp].exclude?(@submitter.submission.source) && @submitter.account.account_configs.find_or_initialize_by(key: AccountConfig::ALLOW_TO_RESUBMIT).value != false && @submitter.template && !@submitter.template.archived_at? %>
+ <% if undefined_submitters.size == 1 && undefined_submitters.first['uuid'] == @submitter.uuid && Submitters::StartForm.can_resubmit?(@submitter) && @submitter.template && !@submitter.template.archived_at? %>
<%= t('or') %>
<%= button_to button_title(title: t('resubmit'), disabled_with: t('resubmit'), icon: svg_icon('reload', class: 'w-6 h-6')), resubmit_form_path, params: { resubmit: @submitter.slug }, method: :put, class: 'white-button w-full' %>
diff --git a/app/views/templates/show.html.erb b/app/views/templates/show.html.erb
index d41ba3eb..30bbcc72 100644
--- a/app/views/templates/show.html.erb
+++ b/app/views/templates/show.html.erb
@@ -99,7 +99,7 @@
<% end %>
<% if Templates.filter_undefined_submitters(@template.submitters).size == 1 && @template.variables_schema.blank? %>
- <%= button_to start_form_path(@template.slug), params: { selfsign: true }, method: :put, class: 'white-button w-full', form: { style: 'display: inline', target: '_blank', data: { turbo: false } } do %>
+ <%= button_to start_form_self_path(@template), method: :put, class: 'white-button w-full', form: { style: 'display: inline', target: '_blank', data: { turbo: false } } do %>
<%= svg_icon('writing', class: 'w-6 h-6') %>
<%= t('sign_it_yourself') %>
<% end %>
diff --git a/app/views/templates_preferences/_submitter_completed_email_form.html.erb b/app/views/templates_preferences/_submitter_completed_email_form.html.erb
index 6cf0a691..dbd9f0f0 100644
--- a/app/views/templates_preferences/_submitter_completed_email_form.html.erb
+++ b/app/views/templates_preferences/_submitter_completed_email_form.html.erb
@@ -10,7 +10,12 @@
<%= f.fields_for :preferences, Struct.new(:completed_notification_email_subject, :completed_notification_email_body).new(@template.preferences['completed_notification_email_subject'].presence || configs['subject'], @template.preferences['completed_notification_email_body'].presence || configs['body']) do |ff| %>