Merge pull request #3688 from alphagov/display-data-retention-better

Make custom data retention look a bit nicer
This commit is contained in:
Chris Hill-Scott
2020-10-20 10:34:48 +01:00
committed by GitHub
3 changed files with 15 additions and 5 deletions

View File

@@ -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 %}
<ul>
{% endif %}
<li>{{ channel.notification_type|format_notification_type }} {{ channel.days_of_retention }} days</li>
{% if loop.last %}
</ul>
{% endif %}
{% else %}
<div class="table-field-status-default">Not set</div>
{% endfor %}
{% endcall %}
{{ edit_field('Change', url_for('.data_retention', service_id=current_service.id), suffix='data retention') }}
{% endcall %}

View File

@@ -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 %}

View File

@@ -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(