Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/controllers/submit_form_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ def show
# Fetch prefill values if available
@prefill_values = fetch_prefill_values_if_available

# When the URL contains expand=true, keep the form panel expanded on desktop
# instead of auto-minimizing when the current field is signature/initials/file/image.
@expand = params[:expand] == 'true'

@attachments_index = build_attachments_index(submission)

return unless @form_configs[:prefill_signature]
Expand Down
2 changes: 1 addition & 1 deletion app/views/submit_form/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
<div class="fixed bottom-0 w-full z-20 md:h-0">
<div class="mx-auto" style="max-width: 1000px">
<div class="relative md:mx-32">
<%= 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 %>
<%= 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 %>
</div>
</div>
</div>
Expand Down
27 changes: 27 additions & 0 deletions spec/system/signing_form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,33 @@
end
end

context 'when the signature step is opened with expand=true' do
let(:template) { create(:template, account:, author:, only_field_types: %w[signature]) }
let(:submission) { create(:submission, template:) }
let(:submitter) do
create(:submitter, submission:, uuid: template.submitters.first['uuid'], account:)
end

it 'keeps the form panel expanded without needing to click Sign Now' do
visit submit_form_path(slug: submitter.slug, expand: 'true')

# The expand (Sign Now) button is absent because the panel is already open
expect(page).not_to have_selector('#expand_form_button')
expect(page).to have_selector('#form_container')

# The signature canvas is directly accessible
draw_canvas
click_button 'Sign and Complete'

expect(page).to have_content('Document has been signed!')

submitter.reload

expect(submitter.completed_at).to be_present
expect(field_value(submitter, 'Signature')).to be_present
end
end

context 'when the multiple choice step' do
let(:template) { create(:template, account:, author:, only_field_types: %w[multiple]) }
let(:submission) { create(:submission, template:) }
Expand Down
Loading