Convert radios on add org page

Changes OrganisationCrownStatusForm.crown_status.

This also effects NewOrganisationForm, which
inherits from OrganisationCrownStatusForm.

Because of that this commit also updates the
template used for the edit org crown status page,
which uses NewOrganisationForm for its form.
This commit is contained in:
Tom Byers
2020-06-26 17:47:16 +01:00
parent 0cdbb850aa
commit b1d0d216e0
4 changed files with 8 additions and 12 deletions

View File

@@ -1168,10 +1168,8 @@ class OrganisationOrganisationTypeForm(StripWhitespaceForm):
class OrganisationCrownStatusForm(StripWhitespaceForm): class OrganisationCrownStatusForm(StripWhitespaceForm):
crown_status = RadioField( crown_status = GovukRadiosField(
( 'Is this organisation a crown body?',
'Is this organisation a crown body?'
),
choices=[ choices=[
('crown', 'Yes'), ('crown', 'Yes'),
('non-crown', 'No'), ('non-crown', 'No'),

View File

@@ -1,7 +1,6 @@
{% extends "withoutnav_template.html" %} {% extends "withoutnav_template.html" %}
{% from "components/page-header.html" import page_header %} {% from "components/page-header.html" import page_header %}
{% from "components/page-footer.html" import page_footer %} {% from "components/page-footer.html" import page_footer %}
{% from "components/radios.html" import radios %}
{% from "components/form.html" import form_wrapper %} {% from "components/form.html" import form_wrapper %}
{% block per_page_title %} {% block per_page_title %}
@@ -26,8 +25,8 @@
{{ page_header('New organisation') }} {{ page_header('New organisation') }}
{% call form_wrapper() %} {% call form_wrapper() %}
{{ form.name }} {{ form.name }}
{{ radios(form.organisation_type) }} {{ form.organisation_type }}
{{ radios(form.crown_status) }} {{ form.crown_status }}
{{ page_footer('Save') }} {{ page_footer('Save') }}
{% endcall %} {% endcall %}
{% endblock %} {% endblock %}

View File

@@ -1,4 +1,3 @@
{% from "components/radios.html" import radios %}
{% from "components/page-footer.html" import page_footer %} {% from "components/page-footer.html" import page_footer %}
{% from "components/page-header.html" import page_header %} {% from "components/page-header.html" import page_header %}
{% from "components/form.html" import form_wrapper %} {% from "components/form.html" import form_wrapper %}
@@ -17,7 +16,7 @@
<div class="govuk-grid-row"> <div class="govuk-grid-row">
<div class="govuk-grid-column-five-sixths"> <div class="govuk-grid-column-five-sixths">
{% call form_wrapper() %} {% call form_wrapper() %}
{{ radios(form.crown_status) }} {{ form.crown_status }}
{{ page_footer('Save') }} {{ page_footer('Save') }}
{% endcall %} {% endcall %}
</div> </div>

View File

@@ -155,11 +155,11 @@ def test_create_new_organisation_validates(
) )
assert [ assert [
(error['data-error-label'], normalize_spaces(error.text)) (error['data-error-label'], normalize_spaces(error.text))
for error in page.select('.govuk-error-message, .error-message') for error in page.select('.govuk-error-message')
] == [ ] == [
('name', 'Error: Cannot be empty'), ('name', 'Error: Cannot be empty'),
('organisation_type', 'Select the type of organisation'), ('organisation_type', 'Error: Select the type of organisation'),
('crown_status', 'Select whether this organisation is a crown body'), ('crown_status', 'Error: Select whether this organisation is a crown body'),
] ]
assert mock_create_organisation.called is False assert mock_create_organisation.called is False