Files
notifications-admin/app/templates/views/notifications.html
Chris Hill-Scott e6490e18d1 Use a different module for doing nice timestamps
There is a bug in Babel[1] which means that it throws an exception if
it can’t find the locale it wants to use.

This is not a problem when developing locally, because OS X comes with
lots of locales. The AWS machines, however, only have one locale, which
is not the one that Babel is looking for. Hence the ‘Activity’ page
doesn’t work.

This commit changes to using Humanize[2] instead, which is much less
vast and hopefully less hungry in its requirements.

That’s a morning we won’t get back…

1. https://github.com/python-babel/babel/issues/137
2. https://pypi.python.org/pypi/humanize
2016-04-14 11:39:43 +01:00

106 lines
2.9 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{% extends "withnav_template.html" %}
{% from "components/table.html" import list_table, field, text_field, link_field, right_aligned_field_heading, hidden_field_heading %}
{% from "components/previous-next-navigation.html" import previous_next_navigation %}
{% from "components/page-footer.html" import page_footer %}
{% from "components/pill.html" import pill %}
{% block page_title %}
Activity GOV.UK Notify
{% endblock %}
{% block maincolumn_content %}
<h1 class="heading-large">
{%- if (request_args.get('template_type', '') == '') and (request_args.get('status', 'delivered,failed') == 'delivered,failed') -%}
Activity
{%- else -%}
{% if request_args.get('status') != 'delivered,failed' %}
{% for label, option, _ in status_filters %}
{% if request_args.get('status') == option %}
{{ label }}
{% endif %}
{% endfor %}
{% endif %}
{% if request_args.get('template_type') == '' %}
emails and text messages
{% else %}
{% for template_label, template_option, _ in type_filters %}
{% if request_args.get('template_type') == template_option %}
{% if request_args.get('status', 'delivered,failed') == 'delivered,failed' %}
{{ template_label }}
{% else %}
{{ template_label | lower }}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
{%- endif -%}
</h1>
<div class='grid-row bottom-gutter'>
<div class='column-half'>
{{ pill(
'Type',
type_filters,
request_args.get('template_type', '')
) }}
</div>
<div class='column-half'>
{{ pill(
'Status',
status_filters,
request_args.get('status', '')
) }}
</div>
</div>
{% if notifications %}
<p class="heading-small bottom-gutter">
<a href="{{ request.url }}&amp;download=csv" download>Download as a CSV file</a>
</p>
{% endif %}
{% call(item, row_number) list_table(
notifications,
caption="Recent activity",
caption_visible=False,
empty_message='No messages found',
field_headings=['Recipient', 'Status', 'Started'],
field_headings_visible=False
) %}
{% call field() %}
<p>
{{ item.to }}
</p>
<p class="hint">
<a href="{{ url_for('.view_template', service_id=current_service.id, template_id=item.template.id) }}">{{ item.template.name }}</a>
sent from
{% if item.job %}
<a href="{{ url_for(".view_job", service_id=current_service.id, job_id=item.job.id) }}">{{ item.job.original_file_name }}</a>
{% else %}
an API call
{% endif %}
</p>
{% endcall %}
{{ text_field(item.status|capitalize) }}
{% call field(align='right') %}
{{ item.created_at|format_delta|capitalize }}
{% endcall %}
{% endcall %}
{{ previous_next_navigation(prev_page, next_page) }}
{% endblock %}