Skip to content

HOLD: Hide scholarship/CE registration boxes when they don't apply#1867

Draft
maebeale wants to merge 1 commit into
mainfrom
maebeale/conditional-event-boxes
Draft

HOLD: Hide scholarship/CE registration boxes when they don't apply#1867
maebeale wants to merge 1 commit into
mainfrom
maebeale/conditional-event-boxes

Conversation

@maebeale

Copy link
Copy Markdown
Collaborator

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

  • The registration edit form's Organizations / Scholarship / CE credits row showed the Scholarship and CE boxes unconditionally.
  • Scholarship is only meaningful when there's a fee to subsidize, so it shouldn't appear on free events.
  • Continuing-education credits aren't offered for every event, so admins need a way to flag eligibility — and the CE box should hide when an event doesn't grant credits.

How did you approach the change?

  • Added ce_credits_eligible to Event (boolean, default true, not null) via migration; permitted it in EventPolicy and surfaced a checkbox under Event Cost on the event form.
  • On the registration form (event_registrations/_form):
    • Hide the Scholarship box when the event is free (cost_cents == 0).
    • Hide the CE credits box when event.ce_credits_eligible? is false.
    • The Organizations box absorbs the freed columns in the 4-col grid:
      • paid + CE-eligible → orgs at sm:col-span-2 (both boxes show)
      • one box hidden → orgs at sm:col-span-3
      • free + not CE-eligible → orgs at sm:col-span-4 (full width)

UI Testing Checklist

  • Event form shows "Eligible for continuing education credits" (checked by default)
  • Paid + CE-eligible registration: Organizations (half), Scholarship, CE credits all show
  • Free event: Scholarship box hidden, Organizations widens
  • Event with CE eligibility unchecked: CE box hidden, Organizations widens
  • Free + not CE-eligible: only Organizations, full width

Anything else to add?

  • 🚧 HOLD — opening as a draft for review of the approach before marking ready.
  • Open question: the request mentioned the ticket and registrations index displays too. Those currently render no Scholarship/CE/Organizations boxes (ticket shows cost/payment only; index is a plain table), so there was nothing to gate there. Happy to add CE/scholarship surfacing to those if that's the intent — let me know the desired design.
  • Tests: model default, 4 system specs covering each visibility/width combination, plus existing edit-form specs (use the default paid + CE-eligible event) still pass.

🤖 Generated with Claude Code

The registration edit form always showed the Scholarship and CE credits
boxes, even for free events (where there's no fee to subsidize) and events
that don't grant continuing education credits. That implied actions that
don't apply and crowded the row.

- Add ce_credits_eligible to Event (default true) so organizers can flag
  whether an event grants CE credits; surface the checkbox on the event form.
- On the registration form, hide the scholarship box for free events and the
  CE box when the event isn't CE-eligible.
- Let the organizations box absorb the freed columns: half width with both
  boxes, three-quarters with one, full width with none.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
<% show_scholarship = paid_event %>
<% show_ce = f.object.event.ce_credits_eligible? %>
<% org_span = 2 + (show_scholarship ? 0 : 1) + (show_ce ? 0 : 1) %>
<% org_span_class = { 2 => "sm:col-span-2", 3 => "sm:col-span-3", 4 => "sm:col-span-4" }.fetch(org_span) %>

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 span is mapped to literal class strings (sm:col-span-2/3/4) rather than interpolated (sm:col-span-#{org_span}) so Tailwind's content scanner actually compiles them — interpolated class names wouldn't be generated.

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