From 9b7357025c043b2d6bb8e219dc01b695e3d83c75 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Mon, 19 Oct 2020 16:47:55 +0100 Subject: [PATCH] Make custom data retention look a bit nicer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This should make it easier to see what’s set without having to click into the table. --- app/templates/views/service-settings.html | 14 ++++++++++++-- .../views/service-settings/data-retention.html | 2 +- tests/app/main/views/test_service_settings.py | 4 ++-- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/app/templates/views/service-settings.html b/app/templates/views/service-settings.html index 5f43353ed..6901efac6 100644 --- a/app/templates/views/service-settings.html +++ b/app/templates/views/service-settings.html @@ -370,9 +370,19 @@ {{ edit_field('Change', url_for('.service_set_letter_branding', service_id=current_service.id), suffix='letter branding (admin view)') }} {% endcall %} {% call row() %} - {{ text_field('Data retention')}} + {{ text_field('Custom data retention')}} {% call field() %} - {{ current_service.data_retention | join(', ', attribute='notification_type') }} + {% for channel in current_service.data_retention %} + {% if loop.first %} + + {% endif %} + {% else %} +
Not set
+ {% endfor %} {% endcall %} {{ edit_field('Change', url_for('.data_retention', service_id=current_service.id), suffix='data retention') }} {% endcall %} diff --git a/app/templates/views/service-settings/data-retention.html b/app/templates/views/service-settings/data-retention.html index ebd48ea76..469ef08f2 100644 --- a/app/templates/views/service-settings/data-retention.html +++ b/app/templates/views/service-settings/data-retention.html @@ -45,7 +45,7 @@ {% for item in current_service.data_retention %} {% call row() %} {{ text_field(item.notification_type | format_notification_type)}} - {{ text_field(item.days_of_retention) }} + {{ text_field(item.days_of_retention|string + ' days') }} {{ edit_field('Change', url_for('.edit_data_retention', service_id=current_service.id, data_retention_id=item.id)) }} {% endcall %} diff --git a/tests/app/main/views/test_service_settings.py b/tests/app/main/views/test_service_settings.py index 6f25abbb7..23df2cf47 100644 --- a/tests/app/main/views/test_service_settings.py +++ b/tests/app/main/views/test_service_settings.py @@ -104,7 +104,7 @@ def mock_get_service_settings_page_common( 'Free text message allowance 250,000 Change free text message allowance', 'Email branding GOV.UK Change email branding (admin view)', 'Letter branding Not set Change letter branding (admin view)', - 'Data retention email Change data retention', + 'Custom data retention Email – 7 days Change data retention', 'Receive inbound SMS Off Change your settings for Receive inbound SMS', 'Email authentication Off Change your settings for Email authentication', 'Send cell broadcasts Off Change your settings for Send cell broadcasts', @@ -5029,7 +5029,7 @@ def test_show_service_data_retention( page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser') rows = page.select('tbody tr') assert len(rows) == 1 - assert normalize_spaces(rows[0].text) == 'Email 5 Change' + assert normalize_spaces(rows[0].text) == 'Email 5 days Change' def test_view_add_service_data_retention(