Add a message count component

The logic to say ‘1 email sent’ vs ‘12 text messages sent’ is repeated
all over the place. So this commit adds a component to put it in one
place.
This commit is contained in:
Chris Hill-Scott
2016-05-13 09:58:07 +01:00
parent 3dc349c8a7
commit 8a4b0ba88c
4 changed files with 24 additions and 9 deletions

View File

@@ -1,4 +1,4 @@
{% from "components/table.html" import list_table, field, hidden_field_heading, right_aligned_field_heading %}
{% from "components/message-count-label.html" import message_count_label %}
<dl>
{% for item in template_statistics %}
@@ -13,8 +13,7 @@
<dd class="column-half">
<span class="spark-bar">
<span style="width: {{ item.usage_count / most_used_template_count * 100 }}%"></span>
{{ item.usage_count }} {{ 'text messages' if item.template.template_type == 'sms' else 'emails' }} sent
{{ item.usage_count }} {{ message_count_label(item.usage_count, item.template.template_type) }}
</span>
</dd>