From e090d979977beb45b443dec31af48303bc4d7c64 Mon Sep 17 00:00:00 2001 From: Pea Tyczynska Date: Thu, 4 Feb 2021 18:00:41 +0000 Subject: [PATCH] View edit organisation notes page Also fix page title for edit service notes page. --- app/models/organisation.py | 2 +- app/navigation.py | 4 +++ .../settings/edit-organisation-notes.html | 29 +++++++++++++++++++ .../service-settings/edit-service-notes.html | 2 +- .../views/organisations/test_organisations.py | 12 ++++++++ 5 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 app/templates/views/organisations/organisation/settings/edit-organisation-notes.html diff --git a/app/models/organisation.py b/app/models/organisation.py index 6a658d792..a84d9cad5 100644 --- a/app/models/organisation.py +++ b/app/models/organisation.py @@ -50,7 +50,7 @@ class Organisation(JSONModel): 'billing_contact_names', 'billing_reference', 'purchase_order_number', - 'notes' + 'notes', } @classmethod diff --git a/app/navigation.py b/app/navigation.py index e7b866e37..a84636366 100644 --- a/app/navigation.py +++ b/app/navigation.py @@ -188,6 +188,7 @@ class HeaderNavigation(Navigation): 'edit_organisation_letter_branding', 'edit_organisation_go_live_notes', 'edit_organisation_name', + 'edit_organisation_notes', 'edit_organisation_type', 'edit_provider', 'edit_service_billing_details', @@ -582,6 +583,7 @@ class MainNavigation(Navigation): 'edit_organisation_go_live_notes', 'edit_organisation_letter_branding', 'edit_organisation_name', + 'edit_organisation_notes', 'edit_organisation_type', 'edit_provider', 'edit_service_billing_details', @@ -810,6 +812,7 @@ class CaseworkNavigation(Navigation): 'edit_organisation_email_branding', 'edit_organisation_go_live_notes', 'edit_organisation_letter_branding', + 'edit_organisation_notes', 'confirm_edit_organisation_name', 'confirm_edit_user_email', 'confirm_edit_user_mobile_number', @@ -1084,6 +1087,7 @@ class OrgNavigation(Navigation): 'edit_organisation_domains', 'edit_organisation_go_live_notes', 'edit_organisation_name', + 'edit_organisation_notes', 'edit_organisation_type', 'organisation_preview_email_branding', 'organisation_preview_letter_branding', diff --git a/app/templates/views/organisations/organisation/settings/edit-organisation-notes.html b/app/templates/views/organisations/organisation/settings/edit-organisation-notes.html new file mode 100644 index 000000000..f26c7718d --- /dev/null +++ b/app/templates/views/organisations/organisation/settings/edit-organisation-notes.html @@ -0,0 +1,29 @@ +{% 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/textbox.html" import textbox %} + +{% extends "org_template.html" %} + +{% block org_page_title %} + Edit organisation notes +{% endblock %} + +{% block maincolumn_content %} + + {{ page_header( + 'Edit organisation notes', + back_link=url_for('.organisation_settings', org_id=current_org.id) + ) }} + {% call form_wrapper() %} + {{ textbox( + form.notes, + rows=4, + width='1-1', + autofocus=True, + autosize=True, + ) }} + {{ page_footer('Save') }} + {% endcall %} + +{% endblock %} diff --git a/app/templates/views/service-settings/edit-service-notes.html b/app/templates/views/service-settings/edit-service-notes.html index a00e073a7..883bd51a0 100644 --- a/app/templates/views/service-settings/edit-service-notes.html +++ b/app/templates/views/service-settings/edit-service-notes.html @@ -5,7 +5,7 @@ {% from "components/textbox.html" import textbox %} {% block service_page_title %} - Data retention + Edit service notes {% endblock %} {% block maincolumn_content %} diff --git a/tests/app/main/views/organisations/test_organisations.py b/tests/app/main/views/organisations/test_organisations.py index d879d9e9b..a8a3ba6d2 100644 --- a/tests/app/main/views/organisations/test_organisations.py +++ b/tests/app/main/views/organisations/test_organisations.py @@ -1277,3 +1277,15 @@ def test_organisation_settings_links_to_edit_organisation_notes_page( assert len(page.find_all( 'a', attrs={'href': '/organisations/{}/settings/notes'.format(organisation_one['id'])} )) == 1 + + +def test_view_edit_organisation_notes( + platform_admin_client, + organisation_one, + mock_get_organisation, +): + response = platform_admin_client.get(url_for('main.edit_organisation_notes', org_id=organisation_one['id'])) + page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser') + assert page.select_one('h1').text == "Edit organisation notes" + assert page.find('label', class_="form-label").text.strip() == "Notes" + assert page.find('textarea').attrs["name"] == "notes"