Fix broken tooltips for age/gender restrictions by replacing Bootstrap with Foundation classes
Fixed broken tooltips on disabled "Enroll" buttons when students violate age or gender restrictions during course registration.
Problem
The tooltips that should appear when hovering over disabled "Enroll" buttons were not working. The issue was that the code was using Bootstrap tooltip attributes (data-toggle="popover", data-placement, data-content) while the application uses the Foundation CSS framework.
Solution
Updated the student_register_link template tag in coderdojochi/templatetags/coderdojochi_extras.py to use Foundation tooltip syntax instead of Bootstrap:
Before (Bootstrap - Broken):
button_href = (
'data-trigger="hover" data-placement="top"'
f' data-toggle="popover" title="" data-content="{message}"'
f' data-original-title="{title}"'
)
After (Foundation - Working):
button_href = (
f'data-tooltip data-position="top" title="{message}"'
)
button_modifier = "btn-default has-tip"
Changes Made
- Replaced
data-toggle="popover"withdata-tooltip - Replaced
data-placement="top"withdata-position="top" - Replaced
data-content="{message}"withtitle="{message}" - Added
has-tipclass to enable Foundation tooltip styling - Applied fixes to all three restriction scenarios:
- Age restrictions only
- Gender restrictions only
- Combined age and gender restrictions
Testing
Created a demonstration page that validates the fix works correctly for all tooltip scenarios. The tooltips now properly display restriction messages when hovering over disabled enrollment buttons.
Fixes #859.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.