-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Admin: Eligibility View #2317
Admin: Eligibility View #2317
Conversation
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
1fb5427
to
05249a2
Compare
.checkbox-parent .form-group:last-of-type .col-12 { | ||
display: flex; | ||
flex-direction: row-reverse; | ||
justify-content: start; | ||
column-gap: 0.5rem; | ||
margin-top: 2rem; | ||
} | ||
|
||
.checkbox-parent, | ||
.checkbox-parent .form-group .col-12, | ||
.checkbox-parent .form-group .col-12 #id_flow { | ||
display: flex; | ||
flex-direction: column; | ||
row-gap: 1rem; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As utility classes: d-flex flex-row-reverse justify-content-start gap-0 row-gap-1 mt-4
d-flex flex-column gap-0 row-gap-3
- adds equal spacing between the radio buttons and checkboxes.
But just decided to do it like this for now. Named checkbox-parent
because the main thing this does is flip the checkbox rendering to show the checkbox input first, then label, which is the opposite of the rest of the pages.
benefits/eligibility/forms.py
Outdated
|
||
self.classes = "checkbox-parent" | ||
flow_field = self.fields["flow"] | ||
flow_field.choices = [(f.id, f.label) for f in flows] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sets the form field's label as the label
, which are currently named like this:
(CST) Senior Discount
CalFresh
(CST) Veteran Discount
(CST) Agency Card Discount
It's slightly different from what we want (Older adult, CalFresh card holder, Courtesy Card holder, etc.) - which are specified in these files for the Benefits app: https://github.com/cal-itp/benefits/blob/1e2ff89cfcdbcddc6895701399aaf1702b3b2fc1/benefits/eligibility/templates/eligibility/includes/selection-label--senior.html
But didn't want to bog down this PR with implementing all of that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created separate issue #2336 to cover this
benefits/eligibility/forms.py
Outdated
method = "POST" | ||
|
||
flow = forms.ChoiceField(label="Choose an eligibility type to qualify this rider.", widget=forms.widgets.RadioSelect) | ||
verified = forms.BooleanField(label="I have verified this person’s eligibility for a transit benefit.", required=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding required=True
will add a validation check
Documentation: https://docs.djangoproject.com/en/5.1/ref/forms/fields/#booleanfield
Code: https://github.com/django/django/blob/stable/5.1.x/django/forms/fields.py#L838
7412a21
to
20fc8fc
Compare
Status update: Everything in this PR is finished, commented/documented and tested except I have not yet written specs for the form. The one other "unknown" I haven't yet gotten around to figuring out is why the admin user's name and the sign out link doesn't appear, as noted above. |
@machikoyasuda You can do something similar to e9614fe to get the usertools to show up. The Django base template expects to have |
I think another unknown is why the custom validity messages are not working |
0386826
to
369ca99
Compare
Created separate issue #2337 to cover this |
15ad6d2
to
428d63d
Compare
428d63d
to
40048cb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great @machikoyasuda! I think we can remove an unused fixture, so after that, this is ready to merge
b6043eb
to
19cc65b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
closes #2269
http://localhost:11369/in_person/eligibility/
Light mode
Dark mode
How to test
form.html
- which isn't going to be changed in this PR)What this PR does
Known issues/questions
Form
RadioSelect
andBooleanField
) on top ofform.html
fromcore
forms.html
and just go with defaults. The required*
is black because theforms.html
utility classes make it so, and overriding a style that already has an!important
style declaration is kinda messy. So we're keeping it black for now.Copy
Tests
CSS
"btn btn-lg btn-outline-primary"
(On view and hover)