diff --git a/app/assets/stylesheets/components/radios.scss b/app/assets/stylesheets/components/radios.scss index c3c1ada6c..9afa37b97 100644 --- a/app/assets/stylesheets/components/radios.scss +++ b/app/assets/stylesheets/components/radios.scss @@ -129,9 +129,8 @@ display: none; } - .multiple-choice { + .govuk-radios__item { - display: inline-block; margin-right: 0; padding: 0; width: 38px; diff --git a/app/main/forms.py b/app/main/forms.py index 00f0706d7..5d2709d77 100644 --- a/app/main/forms.py +++ b/app/main/forms.py @@ -981,7 +981,7 @@ class BasePermissionsForm(StripWhitespaceForm): 'Folders this team member can see', field_label='folder') - login_authentication = RadioField( + login_authentication = GovukRadiosField( 'Sign in using', choices=[ ('sms_auth', 'Text message code'), @@ -1157,7 +1157,7 @@ class AddNHSLocalOrganisationForm(StripWhitespaceForm): super().__init__(*args, **kwargs) self.organisations.choices = organisation_choices - organisations = RadioField( + organisations = GovukRadiosField( 'Which NHS Trust or Clinical Commissioning Group do you work for?', thing='an NHS Trust or Clinical Commissioning Group' ) @@ -1182,16 +1182,21 @@ class OrganisationCrownStatusForm(StripWhitespaceForm): class OrganisationAgreementSignedForm(StripWhitespaceForm): - agreement_signed = RadioField( - ( - 'Has this organisation signed the agreement?' - ), + agreement_signed = GovukRadiosField( + 'Has this organisation signed the agreement?', choices=[ ('yes', 'Yes'), ('no', 'No'), ('unknown', 'No (but we have some service-specific agreements in place)'), ], thing='whether this organisation has signed the agreement', + param_extensions={ + 'items': [ + {'hint': {'html': 'Users will be told their organisation has already signed the agreement'}}, + {'hint': {'html': 'Users will be prompted to sign the agreement before they can go live'}}, + {'hint': {'html': 'Users will not be prompted to sign the agreement'}} + ] + } ) @@ -1384,7 +1389,7 @@ class LetterTemplateForm(EmailTemplateForm): class LetterTemplatePostageForm(StripWhitespaceForm): - postage = RadioField( + postage = GovukRadiosField( 'Choose the postage for this letter template', choices=[ ('first', 'First class'), @@ -1409,7 +1414,7 @@ class LetterUploadPostageForm(StripWhitespaceForm): def show_postage(self): return len(self.postage.choices) > 1 - postage = RadioField( + postage = GovukRadiosField( 'Choose the postage for this letter', choices=[ ('first', 'First class post'), @@ -1511,7 +1516,7 @@ class CreateKeyForm(StripWhitespaceForm): class SupportType(StripWhitespaceForm): - support_type = RadioField( + support_type = GovukRadiosField( 'How can we help you?', choices=[ (PROBLEM_TICKET_TYPE, 'Report a problem'), @@ -1521,12 +1526,15 @@ class SupportType(StripWhitespaceForm): class SupportRedirect(StripWhitespaceForm): - who = RadioField( + who = GovukRadiosField( 'What do you need help with?', choices=[ ('public-sector', 'I work in the public sector and need to send emails, text messages or letters'), ('public', 'I’m a member of the public with a question for the government'), ], + param_extensions={ + "fieldset": {"legend": {"classes": "govuk-visually-hidden"}} + } ) @@ -1537,7 +1545,7 @@ class FeedbackOrProblem(StripWhitespaceForm): class Triage(StripWhitespaceForm): - severe = RadioField( + severe = GovukRadiosField( 'Is it an emergency?', choices=[ ('yes', 'Yes'), @@ -1564,13 +1572,16 @@ class EstimateUsageForm(StripWhitespaceForm): things='letters', format_error_suffix='you expect to send', ) - consent_to_research = RadioField( + consent_to_research = GovukRadiosField( 'Can we contact you when we’re doing user research?', choices=[ ('yes', 'Yes'), ('no', 'No'), ], thing='yes or no', + param_extensions={ + 'hint': {'text': 'You do not have to take part and you can unsubscribe at any time'} + } ) at_least_one_volume_filled = True @@ -1592,10 +1603,18 @@ class ProviderForm(StripWhitespaceForm): class ProviderRatioForm(StripWhitespaceForm): - ratio = RadioField(choices=[ - (str(value), '{}% / {}%'.format(value, 100 - value)) - for value in range(100, -10, -10) - ]) + ratio = GovukRadiosField(choices=[ + (str(value), '{}% / {}%'.format(value, 100 - value)) + for value in range(100, -10, -10) + ], + param_extensions={ + "classes": "govuk-radios--inline", + "fieldset": { + "legend": { + "classes": "govuk-visually-hidden" + } + } + }) @property def percentage_left(self): @@ -1753,7 +1772,7 @@ class ServiceUpdateEmailBranding(StripWhitespaceForm): } ) file = FileField_wtf('Upload a PNG logo', validators=[FileAllowed(['png'], 'PNG Images only!')]) - brand_type = RadioField( + brand_type = GovukRadiosField( "Brand type", choices=[ ('both', 'GOV.UK and branding'), @@ -1900,7 +1919,7 @@ class ServiceInboundNumberForm(StripWhitespaceForm): super().__init__(*args, **kwargs) self.inbound_number.choices = kwargs['inbound_number_choices'] - inbound_number = RadioField( + inbound_number = GovukRadiosField( "Select your inbound number", thing='an inbound number', ) @@ -1990,7 +2009,7 @@ class LinkOrganisationsForm(StripWhitespaceForm): super().__init__(*args, **kwargs) self.organisations.choices = kwargs['choices'] - organisations = RadioField( + organisations = GovukRadiosField( 'Select an organisation', validators=[ DataRequired() @@ -2084,14 +2103,14 @@ class BrandingOptions(StripWhitespaceForm): class ServiceDataRetentionForm(StripWhitespaceForm): - notification_type = RadioField( + notification_type = GovukRadiosField( 'What notification type?', choices=[ ('email', 'Email'), ('sms', 'SMS'), ('letter', 'Letter'), ], - validators=[DataRequired()], + thing='notification type', ) days_of_retention = GovukIntegerField( label="Days of retention", @@ -2259,7 +2278,7 @@ class TemplateAndFoldersSelectionForm(Form): class ClearCacheForm(StripWhitespaceForm): - model_type = RadioField( + model_type = GovukRadiosField( 'What do you want to clear today', ) diff --git a/app/templates/views/email-branding/manage-branding.html b/app/templates/views/email-branding/manage-branding.html index f356139ad..ca19c8f53 100644 --- a/app/templates/views/email-branding/manage-branding.html +++ b/app/templates/views/email-branding/manage-branding.html @@ -2,7 +2,6 @@ {% from "components/file-upload.html" import file_upload %} {% from "components/page-header.html" import page_header %} {% from "components/page-footer.html" import page_footer %} -{% from "components/radios.html" import radios %} {% from "components/form.html" import form_wrapper %} {% block service_page_title %} @@ -31,7 +30,7 @@
{{form.name}}
{{form.text}}
{{ form.colour }} - {{ radios(form.brand_type) }} + {{ form.brand_type }} {{ page_footer( 'Save', button_name='operation', diff --git a/app/templates/views/organisations/add-nhs-local-organisation.html b/app/templates/views/organisations/add-nhs-local-organisation.html index 17f12a6e4..f07d8fbc5 100644 --- a/app/templates/views/organisations/add-nhs-local-organisation.html +++ b/app/templates/views/organisations/add-nhs-local-organisation.html @@ -1,7 +1,6 @@ {% extends "withnav_template.html" %} {% from "components/page-header.html" import page_header %} {% from "components/page-footer.html" import sticky_page_footer %} -{% from "components/radios.html" import radios %} {% from "components/live-search.html" import live_search %} {% from "components/form.html" import form_wrapper %} @@ -21,13 +20,13 @@ {{ form.organisations.label.text }}

{{ live_search( - target_selector='.multiple-choice', + target_selector='.govuk-radios__item', show=True, form=search_form, label='Search by name', autofocus=True) }} - {{ radios(form.organisations, hide_legend=True) }} + {{ form.organisations }} {{ sticky_page_footer('Continue') }} {% endcall %} {% endblock %} diff --git a/app/templates/views/organisations/organisation/settings/edit-agreement.html b/app/templates/views/organisations/organisation/settings/edit-agreement.html index f4672bfef..f4c44d99c 100644 --- a/app/templates/views/organisations/organisation/settings/edit-agreement.html +++ b/app/templates/views/organisations/organisation/settings/edit-agreement.html @@ -17,14 +17,7 @@
{% call form_wrapper() %} - {{ radios( - form.agreement_signed, - option_hints={ - 'yes': 'Users will be told their organisation has already signed the agreement', - 'no': 'Users will be prompted to sign the agreement before they can go live', - 'unknown': 'Users will not be prompted to sign the agreement' - } - ) }} + {{ form.agreement_signed }} {{ page_footer('Save') }} {% endcall %}
diff --git a/app/templates/views/platform-admin/clear-cache.html b/app/templates/views/platform-admin/clear-cache.html index b601dff30..52e7666ce 100644 --- a/app/templates/views/platform-admin/clear-cache.html +++ b/app/templates/views/platform-admin/clear-cache.html @@ -1,6 +1,5 @@ {% extends "views/platform-admin/_base_template.html" %} {% from "components/form.html" import form_wrapper %} -{% from "components/radios.html" import radios %} {% from "components/page-footer.html" import page_footer %} {% block per_page_title %} @@ -14,7 +13,7 @@ {% call form_wrapper() %} - {{ radios(form.model_type) }} + {{ form.model_type }} {{ page_footer('Clear') }} {% endcall %} diff --git a/app/templates/views/providers/edit-sms-provider-ratio.html b/app/templates/views/providers/edit-sms-provider-ratio.html index 8e831d57d..35b4c6208 100644 --- a/app/templates/views/providers/edit-sms-provider-ratio.html +++ b/app/templates/views/providers/edit-sms-provider-ratio.html @@ -2,7 +2,6 @@ {% from "components/page-header.html" import page_header %} {% from "components/page-footer.html" import page_footer %} {% from "components/form.html" import form_wrapper %} -{% from "components/radios.html" import radios %} {% block per_page_title %} Text message providers @@ -30,7 +29,7 @@
{% call form_wrapper() %}
- {{ radios(form.ratio, inline=True, hide_legend=True) }} + {{ form.ratio }}
diff --git a/app/templates/views/service-settings/data-retention/add.html b/app/templates/views/service-settings/data-retention/add.html index d78a434cb..bc33f79ec 100644 --- a/app/templates/views/service-settings/data-retention/add.html +++ b/app/templates/views/service-settings/data-retention/add.html @@ -2,7 +2,6 @@ {% from "components/page-header.html" import page_header %} {% from "components/page-footer.html" import page_footer %} {% from "components/form.html" import form_wrapper %} -{% from "components/radios.html" import radios %} {% block service_page_title %} Data retention @@ -16,7 +15,7 @@ ) }} {% call form_wrapper() %} - {{ radios(form.notification_type) }} + {{ form.notification_type }} {{ form.days_of_retention }} {{ page_footer('Add') }} {% endcall %} diff --git a/app/templates/views/service-settings/estimate-usage.html b/app/templates/views/service-settings/estimate-usage.html index 0f26640ae..6fdbb2383 100644 --- a/app/templates/views/service-settings/estimate-usage.html +++ b/app/templates/views/service-settings/estimate-usage.html @@ -3,7 +3,6 @@ {% from "components/form.html" import form_wrapper %} {% from "components/page-header.html" import page_header %} {% from "components/page-footer.html" import page_footer %} -{% from "components/radios.html" import radios %} {% block service_page_title %} Tell us how many messages you expect to send @@ -39,7 +38,7 @@ "hint": {"text": "For example, 50,000"}, }) }}
- {{ radios(form.consent_to_research, hint='You do not have to take part and you can unsubscribe at any time') }} + {{ form.consent_to_research }} {{ page_footer('Continue') }} {% endcall %} diff --git a/app/templates/views/service-settings/link-service-to-organisation.html b/app/templates/views/service-settings/link-service-to-organisation.html index 2b50edee5..20c3010bc 100644 --- a/app/templates/views/service-settings/link-service-to-organisation.html +++ b/app/templates/views/service-settings/link-service-to-organisation.html @@ -1,5 +1,4 @@ {% extends "withnav_template.html" %} -{% from "components/radios.html" import radios %} {% from "components/page-header.html" import page_header %} {% from "components/page-footer.html" import sticky_page_footer %} {% from "components/live-search.html" import live_search %} @@ -18,14 +17,14 @@ back_link=url_for('.service_settings', service_id=current_service.id) ) }} {{ live_search( - target_selector='.multiple-choice', + target_selector='.govuk-radios__item', show=True, form=search_form, label='Search by name', autofocus=True ) }} {% call form_wrapper() %} {% if has_organisations %} - {{ radios(form.organisations) }} + {{ form.organisations }} {{ sticky_page_footer('Save') }} {% else %}

No organisations

diff --git a/app/templates/views/service-settings/set-inbound-number.html b/app/templates/views/service-settings/set-inbound-number.html index 0cad34afc..4024c073f 100644 --- a/app/templates/views/service-settings/set-inbound-number.html +++ b/app/templates/views/service-settings/set-inbound-number.html @@ -1,7 +1,6 @@ {% extends "withnav_template.html" %} {% from "components/page-header.html" import page_header %} {% from "components/page-footer.html" import sticky_page_footer %} -{% from "components/radios.html" import radios%} {% from "components/form.html" import form_wrapper %} {% block service_page_title %} @@ -19,9 +18,9 @@

No available inbound numbers

{% else %} {% call form_wrapper() %} - {{ radios(form.inbound_number) }} - {{ sticky_page_footer('Save') }} - {% endcall %} + {{ form.inbound_number }} + {{ sticky_page_footer('Save') }} + {% endcall %} {% endif %} {% endblock %} diff --git a/app/templates/views/support/index.html b/app/templates/views/support/index.html index 25400bc52..8e6ac7371 100644 --- a/app/templates/views/support/index.html +++ b/app/templates/views/support/index.html @@ -1,5 +1,4 @@ {% extends "withoutnav_template.html" %} -{% from "components/radios.html" import radios %} {% from "components/page-footer.html" import page_footer %} {% from "components/form.html" import form_wrapper %} @@ -14,12 +13,12 @@ {% call form_wrapper() %} {% if current_user.is_authenticated %} - {{ radios(form.support_type) }} + {{ form.support_type }} {% else %}

What do you need help with?

- {{ radios(form.who, hide_legend=True) }} + {{ form.who }} {% endif %} {{ page_footer('Continue') }} {% endcall %} diff --git a/app/templates/views/support/triage.html b/app/templates/views/support/triage.html index 9b32dd13c..b9546b637 100644 --- a/app/templates/views/support/triage.html +++ b/app/templates/views/support/triage.html @@ -1,5 +1,4 @@ {% extends "withoutnav_template.html" %} -{% from "components/radios.html" import radios %} {% from "components/page-footer.html" import page_footer %} {% from "components/page-header.html" import page_header %} {% from "components/form.html" import form_wrapper %} @@ -17,7 +16,7 @@ back_link=url_for('.support') ) }} {% call form_wrapper() %} - {{ radios(form.severe) }} + {{ form.severe }} {{ page_footer('Continue') }} {% endcall %}

diff --git a/app/templates/views/templates/edit-template-postage.html b/app/templates/views/templates/edit-template-postage.html index 22ca4aa74..b7bffeb8a 100644 --- a/app/templates/views/templates/edit-template-postage.html +++ b/app/templates/views/templates/edit-template-postage.html @@ -1,7 +1,6 @@ {% extends "withnav_template.html" %} {% from "components/page-header.html" import page_header %} {% from "components/page-footer.html" import page_footer %} -{% from "components/radios.html" import radios %} {% from "components/form.html" import form_wrapper %} {% block service_page_title %} @@ -17,7 +16,7 @@ {% call form_wrapper() %}
- {{ radios(form.postage) }} + {{ form.postage }} {{ page_footer('Save') }}