Add message history

This commit is contained in:
Chris Hill-Scott
2015-12-17 14:58:37 +00:00
parent 034c70bc97
commit d4a03a40c8
5 changed files with 64 additions and 9 deletions

View File

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

View File

@@ -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'},
]
)

View File

@@ -10,3 +10,13 @@
</div>
</div>
{% endmacro %}
{% macro message_history(title, log, heading_level=2) %}
<dl class="sms-message-history">
<h{{heading_level}} class="sms-message-history-heading">{{ title }}</h{{heading_level}}>
{% for update in log %}
<dt class="sms-message-history-time">{{ update.time }}</dt>
<dd class="sms-message-history-status">{{ update.status }}</dd>
{% endfor %}
</dl>
{% endmacro %}

View File

@@ -53,7 +53,7 @@ GOV.UK Notify | Notifications activity
<a href="{{ url_for('.shownotification', notification_id=item.id) }}">{{item.phone}}</a>
{% endcall %}
{% call field() %}
<a href="{{ url_for('.shownotification', notification_id=item.id) }}">{{item.message}}</a>
<a href="{{ url_for('.shownotification', notification_id=item.id) }}">{{item.message[:50]}}</a>
{% endcall %}
{% call field(
align='right',

View File

@@ -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
<h1 class="heading-large">
Text message to {{ message.phone }}
Text message
</h1>
{{ sms_message(message.message) }}
<div class="grid-row">
<div class="column-two-thirds">
{{ sms_message(message.message, message.phone) }}
</div>
<div class="column-one-third">
{{ message_history("Message history", history) }}
</div>
</div>
<p>
<a href="{{ url_for('.showjob') }}">View other notifications in this job</a>