mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -04:00
Make example on send look more like a spreadsheet
Now that the example on the breaking changes page looks more like a spreadsheet, we should do the same thing for the downloadable example on the send page.
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
import json
|
import json
|
||||||
import itertools
|
import itertools
|
||||||
|
from string import ascii_uppercase
|
||||||
|
|
||||||
from contextlib import suppress
|
from contextlib import suppress
|
||||||
from zipfile import BadZipFile
|
from zipfile import BadZipFile
|
||||||
from xlrd.biffh import XLRDError
|
from xlrd.biffh import XLRDError
|
||||||
@@ -127,8 +129,11 @@ def send_messages(service_id, template_id):
|
|||||||
return render_template(
|
return render_template(
|
||||||
'views/send.html',
|
'views/send.html',
|
||||||
template=template,
|
template=template,
|
||||||
recipient_column=first_column_heading[template.template_type],
|
column_headings=list(ascii_uppercase[:len(template.placeholders) + 1]),
|
||||||
example=[get_example_csv_rows(template)],
|
example=[
|
||||||
|
[first_column_heading[template.template_type]] + list(template.placeholders),
|
||||||
|
get_example_csv_rows(template)
|
||||||
|
],
|
||||||
form=form
|
form=form
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import string
|
from string import ascii_uppercase
|
||||||
|
|
||||||
from flask import request, render_template, redirect, url_for, flash, abort, session
|
from flask import request, render_template, redirect, url_for, flash, abort, session
|
||||||
from flask_login import login_required
|
from flask_login import login_required
|
||||||
@@ -127,7 +127,7 @@ def edit_service_template(service_id, template_id):
|
|||||||
'views/templates/breaking-change.html',
|
'views/templates/breaking-change.html',
|
||||||
template_change=template_change,
|
template_change=template_change,
|
||||||
new_template=new_template,
|
new_template=new_template,
|
||||||
column_headings=list(string.ascii_uppercase[:len(new_template.placeholders) + 1]),
|
column_headings=list(ascii_uppercase[:len(new_template.placeholders) + 1]),
|
||||||
example_rows=[
|
example_rows=[
|
||||||
[first_column_heading[new_template.template_type]] + list(new_template.placeholders),
|
[first_column_heading[new_template.template_type]] + list(new_template.placeholders),
|
||||||
get_example_csv_rows(new_template),
|
get_example_csv_rows(new_template),
|
||||||
|
|||||||
@@ -63,20 +63,19 @@
|
|||||||
<h2 class="heading-small">
|
<h2 class="heading-small">
|
||||||
Example file
|
Example file
|
||||||
</h2>
|
</h2>
|
||||||
|
<div class="spreadsheet">
|
||||||
{% call(item, row_number) list_table(
|
{% call(item, row_number) list_table(
|
||||||
example,
|
example,
|
||||||
caption="Example",
|
caption="Example",
|
||||||
caption_visible=False,
|
caption_visible=False,
|
||||||
field_headings=['1'] + [
|
field_headings=[''] + column_headings
|
||||||
'<span class="placeholder">{}</span>'.format(recipient_column)|safe
|
) %}
|
||||||
] + template.placeholders_as_markup|list
|
{{ index_field(row_number - 1) }}
|
||||||
) %}
|
{% for column in item %}
|
||||||
{{ index_field(row_number) }}
|
{{ text_field(column) }}
|
||||||
{% for column in item %}
|
{% endfor %}
|
||||||
{{ text_field(column) }}
|
{% endcall %}
|
||||||
{% endfor %}
|
</div>
|
||||||
{% endcall %}
|
|
||||||
<p class="table-show-more-link">
|
<p class="table-show-more-link">
|
||||||
<a href="{{ url_for('.get_example_csv', service_id=current_service.id, template_id=template.id) }}">Download this example</a>
|
<a href="{{ url_for('.get_example_csv', service_id=current_service.id, template_id=template.id) }}">Download this example</a>
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
Reference in New Issue
Block a user