From d4a03a40c8923b6211f63d91e16c587c3af61729 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Thu, 17 Dec 2015 14:58:37 +0000 Subject: [PATCH] Add message history --- .../stylesheets/components/sms-message.scss | 32 +++++++++++++++++++ app/main/views/jobs.py | 16 +++++++--- app/templates/components/sms-message.html | 10 ++++++ app/templates/views/job.html | 2 +- app/templates/views/notification.html | 13 ++++++-- 5 files changed, 64 insertions(+), 9 deletions(-) diff --git a/app/assets/stylesheets/components/sms-message.scss b/app/assets/stylesheets/components/sms-message.scss index bf59c33b5..22d83cf6e 100644 --- a/app/assets/stylesheets/components/sms-message.scss +++ b/app/assets/stylesheets/components/sms-message.scss @@ -45,4 +45,36 @@ margin: 0; } + &-history { + + background: $turquoise; + color: $white; + padding: $gutter-half; + @include core-16; + margin-bottom: $gutter; + @extend %contain-floats; + + &-heading { + @include bold-16; + margin-bottom: 10px; + } + + &-status { + float: left; + margin: 0 0 10px 0; + padding: 0; + width: 66%; + } + + &-time { + float: left; + clear: left; + padding: 0; + width: 33%; + min-width: 3.2em; + max-width: 4.8em; + } + + } + } diff --git a/app/main/views/jobs.py b/app/main/views/jobs.py index 9e31dfa1e..0d7e5b528 100644 --- a/app/main/views/jobs.py +++ b/app/main/views/jobs.py @@ -6,28 +6,28 @@ from app.main import main messages = [ { 'phone': '+44 7700 900 579', - 'message': 'Vehicle tax: Your vehicle tax for LV75 TDG expires…', + 'message': 'Vehicle tax: Your vehicle tax for LV75 TDG expires on 18 January 2016. Renew at www.gov.uk/vehicletax', # noqa 'status': 'Delivered', 'time': '13:42', 'id': '0' }, { 'phone': '+44 7700 900 306', - 'message': 'Vehicle tax: Your vehicle tax for PL53 GBD expires…', + 'message': 'Vehicle tax: Your vehicle tax for PL53 GBD expires on 18 January 2016. Renew at www.gov.uk/vehicletax', # noqa 'status': 'Delivered', 'time': '13:42', 'id': '1' }, { 'phone': '+44 7700 900 454', - 'message': 'Vehicle tax: Your vehicle tax for LV75 TDG expires…', + 'message': 'Vehicle tax: Your vehicle tax for LV75 TDG expires on 18 January 2016. Renew at www.gov.uk/vehicletax', # noqa 'status': 'Delivered', 'time': '13:42', 'id': '2' }, { 'phone': '+44 7700 900 522', - 'message': 'Vehicle tax: Your vehicle tax for RE67 PLM expires…', + 'message': 'Vehicle tax: Your vehicle tax for RE67 PLM expires on 18 January 2016. Renew at www.gov.uk/vehicletax', # noqa 'status': 'Failed', 'time': '13:42', 'id': '3' @@ -67,5 +67,11 @@ def shownotification(notification_id): 'views/notification.html', message=[ message for message in messages if message['id'] == notification_id - ][0] + ][0], + history=[ + {'time': '13:42', 'status': 'Delivered'}, + {'time': '13:42', 'status': 'Received by handset'}, + {'time': '13:42', 'status': 'Accepted by network'}, + {'time': '13:41', 'status': 'Sent'}, + ] ) diff --git a/app/templates/components/sms-message.html b/app/templates/components/sms-message.html index 5d5f11d12..d5f63909d 100644 --- a/app/templates/components/sms-message.html +++ b/app/templates/components/sms-message.html @@ -10,3 +10,13 @@ {% endmacro %} + +{% macro message_history(title, log, heading_level=2) %} +
+ {{ title }} + {% for update in log %} +
{{ update.time }}
+
{{ update.status }}
+ {% endfor %} +
+{% endmacro %} diff --git a/app/templates/views/job.html b/app/templates/views/job.html index c45772d16..534ac0d23 100644 --- a/app/templates/views/job.html +++ b/app/templates/views/job.html @@ -53,7 +53,7 @@ GOV.UK Notify | Notifications activity {{item.phone}} {% endcall %} {% call field() %} - {{item.message}} + {{item.message[:50]}}… {% endcall %} {% call field( align='right', diff --git a/app/templates/views/notification.html b/app/templates/views/notification.html index cb17512a8..c22cae954 100644 --- a/app/templates/views/notification.html +++ b/app/templates/views/notification.html @@ -1,5 +1,5 @@ {% extends "withnav_template.html" %} -{% from "components/sms-message.html" import sms_message %} +{% from "components/sms-message.html" import sms_message, message_history %} {% block page_title %} GOV.UK Notify | Notifications activity @@ -9,10 +9,17 @@ GOV.UK Notify | Notifications activity

- Text message to {{ message.phone }} + Text message

- {{ sms_message(message.message) }} +
+
+ {{ sms_message(message.message, message.phone) }} +
+
+ {{ message_history("Message history", history) }} +
+

View other notifications in this job