Skip to content

WAIT: Add "Download all" button to forms and handouts callout pages#1832

Open
maebeale wants to merge 1 commit into
mainfrom
maebeale/download-all-pdfs-button
Open

WAIT: Add "Download all" button to forms and handouts callout pages#1832
maebeale wants to merge 1 commit into
mainfrom
maebeale/download-all-pdfs-button

Conversation

@maebeale

Copy link
Copy Markdown
Collaborator

🤖 PR, suggested 👤 review level: 📖 Read — light-logic: small new endpoint data + a Stimulus controller, view-only chrome

Adds a Download all button in the top-right of the forms and handouts callout cards so a registrant can grab every document in one click instead of opening each one.

  • Handouts — downloads every handout resource PDF that has an attached file.
  • Forms — downloads the W-9 and the letter (when seeded); the invoice has no stored PDF, so it opens its existing print-to-PDF page in a new tab.

Why this shape

  • No HTML→PDF gem exists, and the invoice is an HTML page printed via window.print(), so it can't be bundled as a file — it opens in a new tab instead.
  • Per-file individual downloads (not a zip), staggered so browsers don't suppress the later ones in the burst.

Notes

  • New download-all Stimulus controller fires each { href, newTab } item; file items download via a temporary anchor, new-tab items window.open.
  • Header gains an optional :header_action slot in the shared _callout_page chrome; only forms/handouts populate it.
  • Downloads reuse the same resource_download_path the existing per-card download button uses (same auth context).

Tests

  • New spec/requests/events/callouts_spec.rb covers the button bundling W-9 + invoice, the letter appearing only when attached, handout items, and the button being omitted when no handout has a file.

Registrants previously had to open and download each document one at a
time. A single header-bar button now fires every file in the group: the
handout PDFs, and on the forms page the W-9 and letter (the invoice has
no stored PDF, so it opens its print-to-PDF page in a new tab).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@@ -122,6 +126,16 @@ def build_form_cards
cards
end

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 From Claude: The invoice has no stored PDF (it is rendered HTML printed via window.print()), so it can't be bundled as a file download — newTab: true opens its print-to-PDF page instead. Everything else is a real file.

this.itemsValue.forEach((item, index) => {
setTimeout(() => this.trigger(item), index * this.delayValue)
})
}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 From Claude: Staggered by delay ms — browsers suppress multiple downloads fired synchronously in one tick, so the burst is spread out.

@maebeale maebeale marked this pull request as ready for review June 22, 2026 05:16
@maebeale maebeale changed the title Add "Download all" button to forms and handouts callout pages WAIT: Add "Download all" button to forms and handouts callout pages Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant