feat(admin): make application Active + Maintenance toggle switches, not text (BUNYIP-420) #416
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/BUNYIP-420-app-toggle-switches"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Closes BUNYIP-420. The applications list rendered Active / Maintenance as a text value ("Active: on") plus a separate "Toggle" button. They are now proper toggle switches: color + knob position show the state, and a single click applies it.
How
toggle_switch(on, label)helper inviews/ui.rs: a form-submit button styled as a switch (primary track + sliding knob when on, muted when off), withrole="switch"+aria-checked+aria-label(state is conveyed by color/position, not text)./admin/applications/{id}/fieldpath - no handler change. Maintenance mode still takes effect.Tests
toggle_switch_reflects_on_and_off_state- on ->bg-primary+ knob-right +aria-checked="true"; off -> muted + knob-left +aria-checked="false"; asserts it is a submit control.just check-containergreen.Verification (screenshot shared in-thread)
maintenance_modein the DB and redirects back (303) through the unchanged/fieldhandler.🤖 Generated with Claude Code
https://claude.ai/code/session_01LerAorB26HGHLfjC9iDUbd
The applications list rendered each Active / Maintenance control as a text value ("Active: on") plus a separate "Toggle" button, so the state was not obvious and changing it was not a single click. Adds a reusable toggle_switch helper in views/ui.rs: a form-submit button styled as a switch (colored track + sliding knob) with role="switch" + aria-checked + aria-label, so state is conveyed by color/position and a single click applies it. The switch is the form's submit control, so it posts the flipped value through the SAME /admin/applications/{id}/field path - no handler change, and maintenance mode still takes effect (verified: toggling flips maintenance_mode in the DB and redirects back). The maintenance message field on the Edit page is unchanged. Tests: toggle_switch_reflects_on_and_off_state (on -> bg-primary + knob-right + aria-checked=true; off -> muted + knob-left + aria-checked=false; is a submit control). just check-container green. Verified rendered on the applications list (on/off states for both Active and Maintenance) at 1440px. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LerAorB26HGHLfjC9iDUbd