From 17d5af1a6e8c6a0827d546a04ebbf4ff6211b72d Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Fri, 9 Sep 2016 15:36:07 +0100 Subject: [PATCH] Show delivery time even for failed notifications MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We reckon it’s probably still useful. --- app/__init__.py | 11 +++++------ app/assets/stylesheets/components/table.scss | 7 +++++++ app/templates/partials/jobs/notifications.html | 10 +++++++--- app/templates/views/notifications.html | 11 ++++++++--- 4 files changed, 27 insertions(+), 12 deletions(-) diff --git a/app/__init__.py b/app/__init__.py index 62ef89f19..08821bb56 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -116,7 +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_with_time) + 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) @@ -282,12 +282,11 @@ def format_notification_status(status, template_type): }.get(template_type).get(status, status) -def format_notification_status_with_time(status, template_type, when): +def format_notification_status_as_time(status, when): return { - 'delivered': 'Delivered {}'.format(when), - 'sending': 'Sending since {}'.format(when), - 'created': 'Sending since {}'.format(when) - }.get(status, format_notification_status(status, template_type)) + 'sending': ' since {}'.format(when), + 'created': ' since {}'.format(when) + }.get(status, when) def format_notification_status_as_field_status(status): diff --git a/app/assets/stylesheets/components/table.scss b/app/assets/stylesheets/components/table.scss index baa5551b5..2fc79ebe0 100644 --- a/app/assets/stylesheets/components/table.scss +++ b/app/assets/stylesheets/components/table.scss @@ -94,6 +94,13 @@ } + .status-hint { + display: block; + font-weight: normal; + color: $red; + margin-top: 5px; + } + } &-yes, diff --git a/app/templates/partials/jobs/notifications.html b/app/templates/partials/jobs/notifications.html index 4cc539c87..2a8f20220 100644 --- a/app/templates/partials/jobs/notifications.html +++ b/app/templates/partials/jobs/notifications.html @@ -57,13 +57,17 @@ {% if item.status|format_notification_status_as_url %} {% endif %} - {{ item.status|format_notification_status_with_time( - item.template.template_type, - (item.updated_at or item.created_at)|format_datetime_short + {{ item.status|format_notification_status( + item.template.template_type ) }} {% if item.status|format_notification_status_as_url %} {% endif %} + + {{ item.status|format_notification_status_as_time( + (item.updated_at or item.created_at)|format_datetime_short + ) }} + {% endcall %} {% endcall %} diff --git a/app/templates/views/notifications.html b/app/templates/views/notifications.html index 082cea952..6d8760a62 100644 --- a/app/templates/views/notifications.html +++ b/app/templates/views/notifications.html @@ -75,13 +75,18 @@ {% if item.status|format_notification_status_as_url %} {% endif %} - {{ item.status|format_notification_status_with_time( - item.template.template_type, - (item.updated_at or item.created_at)|format_datetime_short + {{ item.status|format_notification_status( + item.template.template_type ) }} {% if item.status|format_notification_status_as_url %} +
{% endif %} + + {{ item.status|format_notification_status_as_time( + (item.updated_at or item.created_at)|format_datetime_short + ) }} + {% endcall %} {% endcall %}