mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-08 20:53:11 -04:00
Let users upload a contact list to use later
We increasingly have teams wanting to do business-continuity type
messaging. They might be without access to their normal systems, which
is where they would otherwise go to get the list of email addresses or
phone numbers.
So we want to give them a place in Notify where they can store their
spreadsheets and use them at a later date.
For the initial pass we’re going to scope this to only allowing
spreadsheets with one column, ie just phone numbers/email addresses.
This is because:
- it minimises the amount of personal info we’re storing
- it reduces the chance of getting a placeholder error when you go to
send the message, which is probably a high-stress situation where you
might not be able to re-generate the file
The code for this is mostly copied from the existing upload CSV journey.
It’s quite duplicative, but that’s what I needed to do to get this out
quickly. There are opportunities for refactoring later.
Similarly, I would have liked to split this up into better commit
messages, but it really was a case of just bashing code out until it
worked 😳
This commit does not:
- implement the ‘view a contact list page’ (it just has a placeholder
because the API isn’t ready at the moment)
- link to this page (because it’s not ready to use yet)
This commit is contained in:
84
app/templates/views/uploads/contact-list/upload.html
Normal file
84
app/templates/views/uploads/contact-list/upload.html
Normal file
@@ -0,0 +1,84 @@
|
||||
{% extends "withnav_template.html" %}
|
||||
{% from "components/banner.html" import banner_wrapper %}
|
||||
{% from "components/file-upload.html" import file_upload %}
|
||||
{% from "components/page-header.html" import page_header %}
|
||||
{% from "components/table.html" import list_table, text_field, index_field, index_field_heading %}
|
||||
|
||||
{% block service_page_title %}
|
||||
Upload an emergency contact list
|
||||
{% endblock %}
|
||||
|
||||
{% block maincolumn_content %}
|
||||
{% if error %}
|
||||
{% call banner_wrapper(type='dangerous') %}
|
||||
<h1 class="banner-title">{{ error.title }}</h1>
|
||||
{% if error.detail %}
|
||||
<p>{{ error.detail | safe }}</p>
|
||||
{% endif %}
|
||||
{% endcall %}
|
||||
{% else %}
|
||||
{{ page_header(
|
||||
'Upload an emergency contact list',
|
||||
back_link=url_for('main.uploads', service_id=current_service.id)
|
||||
) }}
|
||||
<p>Upload a list of phone numbers or email addresses.</p>
|
||||
<p>Don’t put members of the public in here.</p>
|
||||
{% endif %}
|
||||
|
||||
<div class="bottom-gutter">
|
||||
{{ file_upload(
|
||||
form.file,
|
||||
button_text='Upload your file again' if error else 'Choose file',
|
||||
show_errors=False
|
||||
)}}
|
||||
</div>
|
||||
|
||||
<h2 class="heading-medium">Your file needs to look like one of these examples</h2>
|
||||
|
||||
<p class="hint">
|
||||
Save your file as a
|
||||
<acronym title="Comma Separated Values">CSV</acronym>,
|
||||
<acronym title="Tab Separated Values">TSV</acronym>,
|
||||
<acronym title="Open Document Spreadsheet">ODS</acronym>,
|
||||
or Microsoft Excel spreadsheet
|
||||
</p>
|
||||
|
||||
<div class="govuk-grid-row">
|
||||
<div class="govuk-grid-column-one-half">
|
||||
<div class="spreadsheet">
|
||||
{% call(item, row_number) list_table(
|
||||
[
|
||||
['email address'],
|
||||
['test@example.gov.uk'],
|
||||
],
|
||||
caption="Example",
|
||||
caption_visible=False,
|
||||
field_headings=['', 'A']
|
||||
) %}
|
||||
{{ index_field(row_number - 1) }}
|
||||
{% for column in item %}
|
||||
{{ text_field(column) }}
|
||||
{% endfor %}
|
||||
{% endcall %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="govuk-grid-column-one-half">
|
||||
<div class="spreadsheet">
|
||||
{% call(item, row_number) list_table(
|
||||
[
|
||||
['phone number'],
|
||||
['07700 900123'],
|
||||
],
|
||||
caption="Example",
|
||||
caption_visible=False,
|
||||
field_headings=['', 'A']
|
||||
) %}
|
||||
{{ index_field(row_number - 1) }}
|
||||
{% for column in item %}
|
||||
{{ text_field(column) }}
|
||||
{% endfor %}
|
||||
{% endcall %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user