Show contact lists on the uploads page

Uploads page is where all the stuff you’ve uploaded lives. Now you can
upload contact lists they should live here too.

They always come first because they’re the most-removed from stuff
you’ve sent.
This commit is contained in:
Chris Hill-Scott
2020-03-16 10:55:58 +00:00
parent 8ba75cf6ba
commit 050f98fea6
5 changed files with 84 additions and 2 deletions

View File

@@ -66,7 +66,11 @@ def uploads(service_id):
next_page = generate_next_dict('main.uploads', service_id, uploads.current_page)
if uploads.current_page == 1:
listed_uploads = current_service.scheduled_jobs + uploads
listed_uploads = (
current_service.contact_lists +
current_service.scheduled_jobs +
uploads
)
else:
listed_uploads = uploads

View File

@@ -27,6 +27,8 @@ class ContactList(JSONModel):
'template_type',
}
upload_type = 'contact_list'
@classmethod
def from_id(cls, contact_list_id, *, service_id):
# This is temporary until we have a get single list endpoint

View File

@@ -1,6 +1,6 @@
{% from "components/table.html" import list_table, field, right_aligned_field_heading, row_heading %}
{% from "components/big-number.html" import big_number -%}
{% from "components/message-count-label.html" import message_count_label -%}
{% from "components/message-count-label.html" import message_count_label, recipient_count_label -%}
<div class='dashboard-table ajax-block-container'>
{% call(item, row_number) list_table(
@@ -20,6 +20,8 @@
<div class="file-list">
{% if item.upload_type == 'letter' %}
<a class="file-list-filename-large govuk-link govuk-link--no-visited-state" href="{{ url_for('.view_notification', service_id=current_service.id, notification_id=item.id) }}">{{ item.original_file_name }}</a>
{% elif item.upload_type == 'contact_list' %}
<a class="file-list-filename-large govuk-link govuk-link--no-visited-state" href="{{ url_for('.contact_list', service_id=current_service.id, contact_list_id=item.id) }}">{{ item.original_file_name }}</a>
{% else %}
<a class="file-list-filename-large govuk-link govuk-link--no-visited-state" href="{{ url_for('.view_job', service_id=current_service.id, job_id=item.id) }}">{{ item.original_file_name }}</a>
{% endif %}
@@ -29,6 +31,12 @@
item.scheduled_for|format_datetime_relative
}}
</span>
{% elif item.upload_type == 'contact_list' %}
<span class="file-list-hint">
Uploaded {{
item.created_at|format_datetime_relative
}}
</span>
{% else %}
<span class="file-list-hint">
Sent {{
@@ -60,6 +68,15 @@
suffix=''
)
) }}
{% elif item.upload_type == 'contact_list' %}
{{ big_number(
item.row_count,
smallest=True,
label="saved {}".format(recipient_count_label(
item.row_count,
item.template_type
))
) }}
{% elif item.pdf_letter %}
<p class="govuk-body govuk-!-margin-bottom-1">
{% for line in item.recipient.splitlines() %}