diff --git a/app/__init__.py b/app/__init__.py index 4eacdff6b..a73b20125 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -116,6 +116,7 @@ def create_app(): application.add_template_filter(format_date_normal) application.add_template_filter(format_date_short) application.add_template_filter(format_notification_status) + application.add_template_filter(format_notification_status_as_time) application.add_template_filter(format_notification_status_as_field_status) application.add_template_filter(format_notification_status_as_url) @@ -281,6 +282,13 @@ def format_notification_status(status, template_type): }.get(template_type).get(status, status) +def format_notification_status_as_time(status, created, updated): + return { + 'sending': ' since {}'.format(created), + 'created': ' since {}'.format(created) + }.get(status, updated) + + def format_notification_status_as_field_status(status): return { 'failed': 'error', diff --git a/app/assets/stylesheets/components/table.scss b/app/assets/stylesheets/components/table.scss index 1d6c3bbeb..0f4bb7292 100644 --- a/app/assets/stylesheets/components/table.scss +++ b/app/assets/stylesheets/components/table.scss @@ -40,7 +40,8 @@ width: 52.5%; font-weight: normal; - .hint { + .hint, + p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; @@ -93,6 +94,13 @@ } + .status-hint { + display: block; + font-weight: normal; + color: $red; + margin-top: 5px; + } + } &-yes, @@ -114,10 +122,6 @@ width: 15px; } - &-date { - white-space: nowrap; - } - p { margin: 0 0 5px 0; } diff --git a/app/templates/components/table.html b/app/templates/components/table.html index 21a73f185..97783ff93 100644 --- a/app/templates/components/table.html +++ b/app/templates/components/table.html @@ -67,12 +67,6 @@ {%- endmacro %} -{% macro date_field(text) -%} -
{{ item.to }}
{% endcall %} + {{ notification_status_field(item) }} {% endcall %} {% if more_than_one_page %} diff --git a/app/templates/views/notifications.html b/app/templates/views/notifications.html index 50445772e..c8b677127 100644 --- a/app/templates/views/notifications.html +++ b/app/templates/views/notifications.html @@ -1,5 +1,5 @@ {% extends "withnav_template.html" %} -{% from "components/table.html" import list_table, field, text_field, link_field, right_aligned_field_heading, hidden_field_heading, row_heading, date_field %} +{% from "components/table.html" import list_table, field, text_field, link_field, right_aligned_field_heading, hidden_field_heading, row_heading, notification_status_field %} {% from "components/previous-next-navigation.html" import previous_next_navigation %} {% from "components/page-footer.html" import page_footer %} {% from "components/pill.html" import pill %} @@ -50,7 +50,7 @@ caption="Recent activity", caption_visible=False, empty_message='No messages found', - field_headings=['Recipient', 'Started', 'Status'], + field_headings=['Recipient', 'Status'], field_headings_visible=False ) %} @@ -68,19 +68,7 @@ {% endcall %} - {{ date_field( - (item.updated_at or item.created_at)|format_datetime_short - ) }} - - {% call field(status=item.status|format_notification_status_as_field_status, align='right') %} - {% if item.status|format_notification_status_as_url %} - - {% endif %} - {{ item.status|format_notification_status(item.template.template_type) }} - {% if item.status|format_notification_status_as_url %} - - {% endif %} - {% endcall %} + {{ notification_status_field(item) }} {% endcall %} {% if notifications %} diff --git a/tests/app/main/views/test_jobs.py b/tests/app/main/views/test_jobs.py index 4d9f7de52..c17c3f3fc 100644 --- a/tests/app/main/views/test_jobs.py +++ b/tests/app/main/views/test_jobs.py @@ -78,7 +78,7 @@ def test_should_show_page_for_one_job( '{}: Your vehicle tax is about to expire'.format(service_one['name']) ) assert ' '.join(page.find('tbody').find('tr').text.split()) == ( - '07123456789 1 January at 11:10am Delivered' + '07123456789 Delivered 1 January at 11:10am' ) assert page.find('div', {'data-key': 'notifications'})['data-resource'] == url_for( 'main.view_job_updates',