Skip to content

Always link callout resources to their own page (never inline)#1976

Merged
maebeale merged 3 commits into
mainfrom
maebeale/resources-clickable-own-page
Jul 14, 2026
Merged

Always link callout resources to their own page (never inline)#1976
maebeale merged 3 commits into
mainfrom
maebeale/resources-clickable-own-page

Conversation

@maebeale

@maebeale maebeale commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

🤖 suggested review level: 3 Read 📖 contained rendering swap on callout pages + eyebrow return_to plumbing + a scoped CSP override

Why

Some associated resources on a registrant's callout pages showed a full inline PDF/preview, while others (handouts, forms, W-9, invoice, receipt) were clickable link cards to the resource's own page. That inconsistency is what a registrant sees. This makes them all consistent: resources always render as link cards; the document itself is only ever shown on its own page.

What

  • Built-in callouts (payment/scholarship/certificate/videoconference): @builtin_resources inline preview → link cards to the registrant resource page.
  • Custom callouts (RegistrationTicketCalloutsController#show): inline resource preview → link cards (in-ticket registrant page when a reg slug is present, else the resource's own page).
  • Registrant resource page eyebrow now returns to whichever callout the registrant came from (four built-ins + custom callouts), not just handouts/forms.
  • The inline preview + download now live only on the resource's own page; its request-spec coverage moved there.

PDF preview & CSP

This PR makes the resource page the canonical way to open any callout resource, so its PDF <object> preview (from #1893) is now front-and-center — and it tripped the global object_src 'none' (report-only). Rather than loosen CSP globally or switch to an iframe:

  • Scoped override: relax object-src to :self only on the two PDF-preview actions (ResourcesController#show, Events::CalloutsController#resource) via per-controller content_security_policy — the strict global object_src :none (blocks legacy <object>/<embed> injection) stays everywhere else.
  • Proxy mode: serve the blob via rails_storage_proxy_path so the bytes stream same-origin instead of 302-redirecting to the storage host — keeping :self sufficient in production (DigitalOcean Spaces), not just dev.

(The unrelated footer/SVG inline-script CSP cleanup was split out into #1986.)

Copilot AI review requested due to automatic review settings July 14, 2026 11:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Resources attached to built-in callouts (payment/scholarship/certificate/
videoconference) and to custom callouts previously rendered a full inline
PDF/preview at the bottom of the callout page, while handouts/forms/W-9
already rendered clickable link cards. That inconsistency is what a
registrant sees. Render every callout's resources as link cards to the
resource's own page (PDF preview + download), so the document is only ever
shown on its own page — matching the handouts/forms/invoice/receipt cards.

The registrant resource page's eyebrow now returns to whichever callout the
registrant came from (the four built-ins and custom callouts), so the back
link is always accurate.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@maebeale maebeale force-pushed the maebeale/resources-clickable-own-page branch from c75c2a1 to f61352f Compare July 14, 2026 14:01
Copilot AI review requested due to automatic review settings July 14, 2026 14:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@maebeale maebeale marked this pull request as ready for review July 14, 2026 14:04
Copilot AI review requested due to automatic review settings July 14, 2026 14:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@maebeale maebeale force-pushed the maebeale/resources-clickable-own-page branch from 63203f1 to aaab37c Compare July 14, 2026 14:24
Copilot AI review requested due to automatic review settings July 14, 2026 14:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings July 14, 2026 15:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings July 14, 2026 20:29
@maebeale maebeale force-pushed the maebeale/resources-clickable-own-page branch from 282f022 to 2a79649 Compare July 14, 2026 20:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings July 14, 2026 22:16
@maebeale maebeale force-pushed the maebeale/resources-clickable-own-page branch from 2a79649 to f61352f Compare July 14, 2026 22:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

The resource show page and the registrant single-resource page preview a PDF in
an <object>, which the global object_src :none (kept strict to block legacy
<object>/<embed> injection app-wide) flags on every view. Rather than loosen the
policy globally, relax object-src to :self only on those two actions via a
per-controller override — the idiomatic Rails mechanism for scoping a CSP
relaxation to where a legitimate embed lives.

Serve the blob through ActiveStorage proxy mode (rails_storage_proxy_path) so the
bytes stream same-origin instead of 302-redirecting to the storage host; that
keeps :self sufficient in production (DigitalOcean Spaces), not just dev/Disk.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 14, 2026 22:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

The browser's built-in PDF viewer only renders its page-thumbnail sidebar (the
single-vs-multipage indicator) when the embed is wide enough; at max-w-3xl (768px)
it collapses. Make the callout_page card width a local (defaulting to max-w-3xl so
every other callout page is unchanged) and have the single-resource page opt into
max-w-5xl, and widen the shared PDF <object> wrapper to match. The regular callout
cards stay narrow; only the resource preview gets the extra room.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 14, 2026 22:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@maebeale maebeale merged commit 3c7f484 into main Jul 14, 2026
3 checks passed
@maebeale maebeale deleted the maebeale/resources-clickable-own-page branch July 14, 2026 23:01
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.

2 participants