Skip to content

Commit bf48144

Browse files
Merge pull request #72 from CareerPlug/CP-14106
CP-14119 - Keep submit form expanded when ATS requests expand=true
2 parents 03c65fc + 04ed722 commit bf48144

3 files changed

Lines changed: 32 additions & 1 deletion

File tree

app/controllers/submit_form_controller.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ def show
3939
# Fetch prefill values if available
4040
@prefill_values = fetch_prefill_values_if_available
4141

42+
# When the URL contains expand=true, keep the form panel expanded on desktop
43+
# instead of auto-minimizing when the current field is signature/initials/file/image.
44+
@expand = params[:expand] == 'true'
45+
4246
@attachments_index = build_attachments_index(submission)
4347

4448
return unless @form_configs[:prefill_signature]

app/views/submit_form/show.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
<div class="fixed bottom-0 w-full z-20 md:h-0">
6969
<div class="mx-auto" style="max-width: 1000px">
7070
<div class="relative md:mx-32">
71-
<%= render 'submit_form/submission_form', attachments_index: @attachments_index, submitter: @submitter, signature_attachment: @signature_attachment, configs: @form_configs, dry_run: local_assigns[:dry_run], expand: local_assigns[:expand], scroll_padding: local_assigns.fetch(:scroll_padding, '-110px'), schema:, values: values %>
71+
<%= render 'submit_form/submission_form', attachments_index: @attachments_index, submitter: @submitter, signature_attachment: @signature_attachment, configs: @form_configs, dry_run: local_assigns[:dry_run], expand: @expand || local_assigns[:expand], scroll_padding: local_assigns.fetch(:scroll_padding, '-110px'), schema:, values: values %>
7272
</div>
7373
</div>
7474
</div>

spec/system/signing_form_spec.rb

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,33 @@
342342
end
343343
end
344344

345+
context 'when the signature step is opened with expand=true' do
346+
let(:template) { create(:template, account:, author:, only_field_types: %w[signature]) }
347+
let(:submission) { create(:submission, template:) }
348+
let(:submitter) do
349+
create(:submitter, submission:, uuid: template.submitters.first['uuid'], account:)
350+
end
351+
352+
it 'keeps the form panel expanded without needing to click Sign Now' do
353+
visit submit_form_path(slug: submitter.slug, expand: 'true')
354+
355+
# The expand (Sign Now) button is absent because the panel is already open
356+
expect(page).not_to have_selector('#expand_form_button')
357+
expect(page).to have_selector('#form_container')
358+
359+
# The signature canvas is directly accessible
360+
draw_canvas
361+
click_button 'Sign and Complete'
362+
363+
expect(page).to have_content('Document has been signed!')
364+
365+
submitter.reload
366+
367+
expect(submitter.completed_at).to be_present
368+
expect(field_value(submitter, 'Signature')).to be_present
369+
end
370+
end
371+
345372
context 'when the multiple choice step' do
346373
let(:template) { create(:template, account:, author:, only_field_types: %w[multiple]) }
347374
let(:submission) { create(:submission, template:) }

0 commit comments

Comments
 (0)