Tint scholarship and CE credit cards to match their toggle state#1861
Merged
Conversation
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>
maebeale
commented
Jun 22, 2026
| @@ -13,11 +15,20 @@ export default class extends Controller { | |||
| } | |||
|
|
|||
Collaborator
Author
There was a problem hiding this comment.
🤖 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.
Contributor
There was a problem hiding this comment.
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-requestedandce-credit-requestedStimulus 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. |
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.
What is the goal of this PR and why is this important?
How did you approach the change?
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.hasCheckboxTargetand leaves the static themed tint in place.Anything else to add?
border-teal-200is the one new Tailwind utility; the rest were already in use. It's referenced from the ERB, so production/CI asset builds compile it.