mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-05 02:42:26 -05:00
Replace message previews on check page with table
The first 3/last 3 messages didn’t test well, it wasn’t immediately obvious what was going on. This commit replaces it with just a preview of the first message, and a table showing the details of the subsequent messages.
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
.table-heading {
|
||||
text-align: left;
|
||||
margin: 40px 0 5px 0;
|
||||
}
|
||||
|
||||
%table-field,
|
||||
|
||||
@@ -103,6 +103,7 @@ def check_sms(service_id, upload_id):
|
||||
'views/check-sms.html',
|
||||
upload_result=upload_result,
|
||||
message_template=template['content'],
|
||||
original_file_name=original_file_name,
|
||||
template_id=template_id,
|
||||
service_id=service_id
|
||||
)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{% extends "withnav_template.html" %}
|
||||
{% from "components/sms-message.html" import sms_message %}
|
||||
{% from "components/table.html" import table, field %}
|
||||
{% from "components/table.html" import list_table, field %}
|
||||
{% from "components/placeholder.html" import placeholder %}
|
||||
{% from "components/page-footer.html" import page_footer %}
|
||||
|
||||
@@ -21,44 +21,25 @@
|
||||
|
||||
{% else %}
|
||||
|
||||
<h2 class="heading-medium">Check and confirm</h2>
|
||||
{{ sms_message(
|
||||
message_template|replace_placeholders(upload_result.valid[0]),
|
||||
name='Preview'
|
||||
)}}
|
||||
|
||||
<form method="POST" enctype="multipart/form-data">
|
||||
|
||||
{{ page_footer(
|
||||
button_text = "Send {} text messages".format(upload_result.valid|count),
|
||||
back_link = url_for(".send_sms", service_id=service_id, template_id=template_id)
|
||||
)}}
|
||||
|
||||
{% if upload_result.valid | count > 6 %}
|
||||
<h3 class="heading-small">First three message in file</h3>
|
||||
{% for recipient in upload_result.valid[:3] %}
|
||||
{{ sms_message(message_template|replace_placeholders(
|
||||
recipient),
|
||||
'{}'.format(recipient['phone'])
|
||||
)}}
|
||||
{% endfor %}
|
||||
<h3 class="heading-small">Last three messages in file</h3>
|
||||
{% for recipient in upload_result.valid[-3:] %}
|
||||
{{ sms_message(message_template|replace_placeholders(
|
||||
recipient),
|
||||
'{}'.format(recipient['phone'])
|
||||
)}}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<h3 class="heading-small">All messages in file</h3>
|
||||
{% for recipient in upload_result.valid %}
|
||||
{{ sms_message(message_template|replace_placeholders(
|
||||
recipient),
|
||||
'{}'.format(recipient['phone'])
|
||||
)}}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{{ page_footer(
|
||||
button_text = "Send {} text messages".format(upload_result.valid|count),
|
||||
back_link = url_for(".send_sms", service_id=service_id, template_id=template_id)
|
||||
)}}
|
||||
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
|
||||
<input type="submit" class="button" value="{{ "Send {} text message{}".format(upload_result.valid|count, '' if upload_result.valid|count == 1 else 's') }}" />
|
||||
</form>
|
||||
|
||||
{% call(item) list_table(
|
||||
upload_result.valid,
|
||||
caption=original_file_name,
|
||||
field_headings=['Phone number']
|
||||
) %}
|
||||
{% call field() %}
|
||||
{{ item.phone }}
|
||||
{% endcall %}
|
||||
{% endcall %}
|
||||
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user