Callout cleanup#1969
Merged
Merged
Conversation
Foundation for turning the code-defined "magic" ticket callouts into editable per-event rows so admins can edit, hide, restore, and reorder them. - Add magic_key (hidden built-in identifier), hidden (draft/opt-out), and display_from (drip date) to registration_ticket_callouts. - Replace the single resource_id belongs_to with an ordered join table so a callout can link many resources (Handouts, custom callouts); migrate existing links and update the editor/detail consumers. - DefaultTicketCallouts seeds the content cards (Handouts, FAQ) with their current copy/resources, deriving default visibility from the same rules as Event#show_*_callout?; idempotent so it never clobbers admin edits. Not yet wired to create/edit or the renderer — MagicTicketCallouts still drives the ticket, and will skip any card an event has materialized to avoid double-rendering. Follow-ups add the seeder hook, the row-backed renderer, and the editor UI. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Makes the materialized magic callouts actually work end-to-end for Handouts and FAQ: - Seed on event create and lazily on edit (idempotent, no backfill), so existing events heal on first save. - Ticket renders visible, non-dripped rows; MagicTicketCallouts skips any card the event has materialized (no double-render) and stays the fallback for unseeded events. The public callout page redirects when hidden/dripping. - Editor: materialized cards render as editable rows (title, subtitle, page text, multi-resource) with a hide toggle and "Restore default", interleaved with custom callouts in the one sortable/position-ordered list; custom callouts gain a hidden (draft) checkbox. editor_cards drops any card the event has materialized so it isn't also previewed. - DefaultTicketCallouts.reset restores a magic callout to its template, keeping position; new restore route/action drives it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Extends materialization to app-controlled ("behavioral") cards, whose live
status stays code-driven while the row governs visibility, drip date, and order.
- MagicTicketCallouts#card_for(magic_key) builds one card's live state on demand;
#cards now dispatches through the same key→builder map and skips materialized
keys. The ticket renders a behavioral magic row via card_for (nil when it
shouldn't show for the registration), so opting out / reordering works while
the app supplies the dynamic badge and destination.
- Seed Certificate (opt-in: hidden by default except on facilitator trainings)
and Videoconference (only once the event has a link; display_from = a week
before start, replacing the hard-coded "one week prior" rule with stored data).
- Editor: behavioral magic rows render a control-only partial (hide toggle,
drag handle, Restore default — no content fields); reject_if now guards only
new callouts so a control row's hidden toggle persists without a title.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…CE, Forms) Completes the built-in set: DefaultTicketCallouts now seeds all nine callouts in canonical ticket order, each gated by the event's config (payment when it has a cost, scholarship when it has a scholarship form, CE when hours are offered, event details when present, forms on trainings/paid events). The ticket renders each behavioral row through MagicTicketCallouts#card_for, so the whole set is one admin-ordered, hideable list. CE hours and Event details are behavioral but keep their text on event columns (edited via the built-in preview card in the callouts section), so they render via card_for but get no duplicate editor control row — placement stays fixed. Their colours (teal/fuchsia) come from the live card, not a stored swatch. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The W-9 was hard-coded onto every forms page. Seed it instead as a linked resource on the Forms callout, editable/removable per event from the callouts section; the forms page now renders the callout's resources (falling back to the W-9 for events not yet materialized) alongside the still-dynamic invoice/receipt. - DefaultTicketCallouts links the W-9 resource to the seeded Forms row. - The Forms control row gains a linked-documents picker (RESOURCE_EDITABLE_MAGIC_KEYS). - build_form_cards reads the Forms row's resources. The W-9 resource is already hidden_from_search in the dev seeds. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A tax form applies to paid engagements, so default the W-9 resource onto the Forms callout only when the event has a cost. Free events (e.g. free trainings) still get a Forms card but without the W-9; admins add it back if needed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Materialized built-ins now render in the same editable callout-fields row as custom callouts — pre-filled title, subtitle, callout page text, colour, icon, and (where they apply) linked resources — instead of a separate greyed control strip. The app overlays only the live badge, per-registration visibility, and destination link, so admin edits to presentation take effect on the ticket. - MagicTicketCallouts#card_for takes the row and overlays the dynamic parts onto the row's editable presentation. - Seed built-ins with their default colours (teal/fuchsia added to SWATCH_COLORS, already in the Tailwind safelist). - "Restore default" shows only when DefaultTicketCallouts.customized? — computed server-side on page load, no JS. - Behavioral callout pages render the row's callout page text as an intro. - CE hours / Event details keep their event-column preview card (text is shared with the CE/details pages); removed the now-unused control/magic partials. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the clunky multi-select of all resources with the same add/remove pattern used for Sectors on Person edit: one document dropdown per linked resource, plus an "Add resource" link (cocoon nested attributes on the ordered join). Applies to custom callouts and the built-ins that link resources (Handouts, FAQ, Forms). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Move the "Accepts basic HTML…" note to a small hint under the textarea (shared callout row + the CE/event-details built-in card). - Callout page text help now reads "The callout card only opens a page if this is filled out." - Remove the example placeholder text from the callout editor fields. - Linked resources collapse behind a chevron toggle, opened on load only when the callout already has saved resources. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The linked-resources picker now shows on all built-ins (not just Handouts/FAQ/ Forms). Resources linked to a behavioral built-in render below its content on the page (via resource_body), alongside the existing editable intro. Forms keeps its own document list (W-9 + invoice/receipt). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
CE hours and art supplies (event details) now edit inline in the same reorderable row as every other callout, so they can be positioned and can link resources like the rest. Their text still lives on the event (shared with the standalone CE / details pages), edited via the passed-in event form builder, so those registrant pages are unchanged; the callout row owns their order, hidden flag, and linked resources. - Shared partial branches on content_on_event? — CE/event-details render the event-column label/text (+ CE hours/cost) via event_f; all others use the row. - card_for keeps their app-supplied, event-driven title (fixes a case where renaming them no longer reflected on the ticket). - Both always seed so the editor row is available; built-ins also materialize lazily on edit so the editor shows the full set. Removed the separate built-in preview card partial. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the built-in/custom 'Hidden' checkbox with a 'Published' checkbox (the inverse of the stored hidden flag) via a virtual attribute, and move it to the right of the row footer. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
CE hours and event details are no longer special-cased: their title and text seed from the event's columns once (migrating existing content) and then live on the callout row, edited in the same shared row as every other built-in. They're now reorderable, link resources, and get Restore default. CE hours-offered/cost stays event config, edited inline in the CE row (ce_config?). The registrant CE and details pages read the row (falling back to the event columns before seed). Also: the built-in footer shows a static "Matches default" when a card is unedited and the clickable "Restore default" once it's customized — so every built-in (now including CE and event details) surfaces its restore state. Removed content_on_event?/restorable? and the event-column editor path. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
"Restore default" is now a per-row checkbox (reset_to_default) applied during the normal event save via an after_save that resets the flagged callout to its template — so it's part of the full form submit. Removed the standalone restore route/action. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Payment (APP_COLORED_MAGIC_KEYS) keeps its dynamic card colour — orange while a balance is due, blue once paid — overriding the selected colour; the editor notes this under the colour picker. Other cards honour the row's colour, and the amber "action needed" badges (scholarship, CE, payment) were always retained. - Add a note in the callouts section telling admins to save a new event first and return to edit its built-in callouts (they're materialized on save). Refresh the now-stale section intro. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Scholarship (award tasks outstanding) and CE hours (hours/license needed) now flip their card colour to amber — the app-controlled action colour — like Payment turns orange while a balance is due. Added both to APP_COLORED_MAGIC_KEYS so the app colour overrides the selected one, and generalized the colour-picker hint. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes [link an issue or remove this line]
What is the goal of this PR and why is this important?
How did you approach the change?
UI Testing Checklist
Anything else to add?