Skip to content

Tint scholarship and CE credit cards to match their toggle state#1861

Merged
maebeale merged 1 commit into
mainfrom
maebeale/style-toggle-box-color
Jul 4, 2026
Merged

Tint scholarship and CE credit cards to match their toggle state#1861
maebeale merged 1 commit into
mainfrom
maebeale/style-toggle-box-color

Conversation

@maebeale

Copy link
Copy Markdown
Collaborator

What is the goal of this PR and why is this important?

  • On the event-registration edit screen, the Scholarship and CE credits cards previously colored only the toggle track when "Requested" was on, leaving the rest of the card neutral white.
  • A requested scholarship or CE credit was easy to miss at a glance; the request status should read from across the card, not just the small switch.

How did you approach the change?

  • Moved each card's Stimulus controller (scholarship-requested, ce-credit-requested) up onto the <section> so it can tint the whole box, not just the toggle.
  • refresh() now mirrors the existing three-state logic onto the card itself: theme color when saved-on (fuchsia for scholarship, teal for CE), amber while the choice is pending (changed but unsaved), neutral white when off.
  • Rendered the initial tint server-side so the correct color shows on load with no flash before Stimulus connects.
  • An already-awarded scholarship has no toggle, so the controller guards on hasCheckboxTarget and leaves the static themed tint in place.

Anything else to add?

  • Purely presentational — no model, controller, or behavior changes.
  • border-teal-200 is the one new Tailwind utility; the rest were already in use. It's referenced from the ERB, so production/CI asset builds compile it.
  • On HOLD pending the registration-edit redesign settling / design sign-off — opened as a draft so it's visible but not yet up for review.

Coloring only the toggle track left the surrounding card neutral, so a
requested scholarship or CE credit was easy to miss at a glance. Mounting
each card's Stimulus controller on the <section> lets it tint the whole
box to mirror the toggle: theme color when saved-on, amber while pending,
neutral when off. An already-awarded scholarship keeps a static themed
tint since its toggle is gone.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@@ -13,11 +15,20 @@ export default class extends Controller {
}

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: Controller moved from the <label>/inner div up to the <section> so it can tint the whole card. This hasCheckboxTarget guard matters because an already-awarded scholarship renders no toggle — the controller still mounts, so without the guard refresh() would throw and clobber the server-rendered tint.

@maebeale maebeale marked this pull request as ready for review July 4, 2026 20:43
Copilot AI review requested due to automatic review settings July 4, 2026 20:43
@maebeale maebeale merged commit 315b08a into main Jul 4, 2026
4 checks passed
@maebeale maebeale deleted the maebeale/style-toggle-box-color branch July 4, 2026 20:44
@maebeale maebeale changed the title HOLD: Tint scholarship and CE credit cards to match their toggle state Tint scholarship and CE credit cards to match their toggle state Jul 4, 2026

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.

Pull request overview

Updates the event registration edit UI so Scholarship and CE credits cards visually reflect their “Requested” state across the entire card (not just the toggle track), improving at-a-glance readability.

Changes:

  • Move scholarship-requested and ce-credit-requested Stimulus controllers to the outer <section> so the full card can be tinted.
  • Add server-rendered initial card tint (theme color when requested; neutral when off) to avoid a flash before Stimulus connects.
  • Extend each controller’s refresh() to toggle card border/background classes for saved-on, pending-unsaved (amber), and off states; scholarship controller guards when the checkbox isn’t present (awarded scholarship).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
app/views/event_registrations/_scholarship.html.erb Renders initial scholarship card tint and mounts Stimulus on the section (keeping toggle markup inside).
app/views/event_registrations/_form.html.erb Renders initial CE credits card tint and mounts Stimulus on the section instead of the inner div.
app/frontend/javascript/controllers/scholarship_requested_controller.js Applies pending/on/off tinting to the section; guards when scholarship is already awarded (no checkbox).
app/frontend/javascript/controllers/ce_credit_requested_controller.js Applies pending/on/off tinting to the section while preserving existing CE details behavior.

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