Show template stats even if there’s only 1 row

If you’re only ever sending one template it’s really useful to be able
to jump straight to that template from the dashboard. So this commit:
- shows the template stats even if there’s only one row
- hides the bar chart if there’s only one row (because it will always be
  100%, and won’t be obvious what it is without its siblings)
This commit is contained in:
Chris Hill-Scott
2016-05-13 10:11:56 +01:00
parent 8a4b0ba88c
commit c3d78f5652
2 changed files with 6 additions and 2 deletions

View File

@@ -11,10 +11,14 @@
</dt>
<dd class="column-half">
{% if template_statistics|length > 1 %}
<span class="spark-bar">
<span style="width: {{ item.usage_count / most_used_template_count * 100 }}%"></span>
<span style="width: {{ item.usage_count / most_used_template_count * 100 }}%"></span>
{{ item.usage_count }} {{ message_count_label(item.usage_count, item.template.template_type) }}
</span>
{% else %}
{{ item.usage_count }} {{ message_count_label(item.usage_count, item.template.template_type) }}
{% endif %}
</dd>
</div>

View File

@@ -40,7 +40,7 @@
</div>
</div>
{% if template_statistics|length > 1 %}
{% if template_statistics|length %}
{% include 'views/dashboard/template-statistics.html' %}
{{ show_more(
url_for('.template_history', service_id=current_service.id),