-
Notifications
You must be signed in to change notification settings - Fork 4
Breast cancer history add form #708
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
Conversation
9f29c1e to
a4a2379
Compare
aedeebe to
c0b34a4
Compare
|
The review app at this URL has been deleted: |
| if explicitly_set_html: | ||
| return explicitly_set_html | ||
|
|
||
| if isinstance(self.form, FormWithConditionalFields): |
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.
Looks good to me. Just to check I've understood it correctly, I think this is to avoid us having to add to breast_cancer_history_item_form.jinja lines like:
{% do form.systemic_treatments.add_conditional_html('OTHER', form.systemic_treatments_other_treatment_details.as_field_group()) %}
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.
Yep 👍🏻
swebberuk
left a comment
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.
Looks good to me.👍
Need to resolve conflicts before merging. The year validation could be done separately once the YearField from PR #739 has been merged.
The design system radios and checkboxes components take a "conditional" param when defining the options. This allows you to add arbitrary html that is conditionally shown when the option is selected. Now that we have FormWithConditionalFields, we can declare the relationships between conditionally dependent fields. This commit extends that so that the conditional param is generated based on those declarations, so you don't need to explicitly tell the field what the conditional html is in the template. The old method for setting arbitrary html is still there in case we need it for more complex cases, where we might want to conditionally show more than just a simple field.
There are two new patterns here for arranging checkboxes and radios into a grid. This is because we want to show options relating to the right breast on the left and left breast on the right, to match the perspective of the mammographer facing the participant. In one case, we are treating right breast and left breast as separate fields, and rendering them side by side. Both fields have their own legends and are validated independently. In the other case, we model the question as a single field and we just arrange the options. We implement this by calling the component twice for the same field, but passing in different options.
The design system checkboxes component allows marking options as exclusive, meaning they toggle all the other options off when selected.
c0b34a4 to
3ae8884
Compare
Description
This is the form for adding breast cancer history.
This one has multiple questions that are presented in a 2 column layout.
The year field is not done yet - waiting for #739 to be merged and then I'll rebase.
Jira link
https://nhsd-jira.digital.nhs.uk/browse/DTOSS-11446
Review notes
Review checklist