mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-26 17:24:23 -04:00
Merge pull request #631 from alphagov/breaking-change
Warn users when a template change is going to break things
This commit is contained in:
@@ -40,9 +40,7 @@
|
||||
{% call(item, row_number) list_table(
|
||||
example,
|
||||
caption="Fill in the {}".format('field' if template.placeholders|length == 1 else 'fields'),
|
||||
field_headings=[
|
||||
'<span class="placeholder">{}</span>'.format(recipient_column)|safe
|
||||
] + template.placeholders_as_markup|list
|
||||
field_headings=[recipient_column] + template.placeholders|list
|
||||
) %}
|
||||
{% for column in item %}
|
||||
{% call field() %}
|
||||
|
||||
@@ -63,20 +63,19 @@
|
||||
<h2 class="heading-small">
|
||||
Example file
|
||||
</h2>
|
||||
|
||||
{% call(item, row_number) list_table(
|
||||
example,
|
||||
caption="Example",
|
||||
caption_visible=False,
|
||||
field_headings=['1'] + [
|
||||
'<span class="placeholder">{}</span>'.format(recipient_column)|safe
|
||||
] + template.placeholders_as_markup|list
|
||||
) %}
|
||||
{{ index_field(row_number) }}
|
||||
{% for column in item %}
|
||||
{{ text_field(column) }}
|
||||
{% endfor %}
|
||||
{% endcall %}
|
||||
<div class="spreadsheet">
|
||||
{% call(item, row_number) list_table(
|
||||
example,
|
||||
caption="Example",
|
||||
caption_visible=False,
|
||||
field_headings=[''] + column_headings
|
||||
) %}
|
||||
{{ index_field(row_number - 1) }}
|
||||
{% for column in item %}
|
||||
{{ text_field(column) }}
|
||||
{% endfor %}
|
||||
{% endcall %}
|
||||
</div>
|
||||
<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>
|
||||
</p>
|
||||
|
||||
72
app/templates/views/templates/breaking-change.html
Normal file
72
app/templates/views/templates/breaking-change.html
Normal file
@@ -0,0 +1,72 @@
|
||||
{% extends "withnav_template.html" %}
|
||||
{% from "components/banner.html" import banner_wrapper %}
|
||||
{% from "components/page-footer.html" import page_footer %}
|
||||
{% from "components/table.html" import list_table, text_field, index_field, index_field_heading %}
|
||||
|
||||
{% macro list_of_placeholders(placeholders) %}
|
||||
{% for placeholder in placeholders %}
|
||||
{% if loop.last and loop.length > 1 %} and {% endif %}
|
||||
<span class="placeholder">(({{ placeholder }}))</span>
|
||||
{% endfor %}
|
||||
{% endmacro %}
|
||||
|
||||
{% block page_title %}
|
||||
GOV.UK Notify
|
||||
{% endblock %}
|
||||
|
||||
{% block maincolumn_content %}
|
||||
|
||||
<h1 class="heading-large">Confirm changes</h1>
|
||||
|
||||
<div class="bottom-gutter">
|
||||
{% if template_change.placeholders_removed %}
|
||||
<p>
|
||||
You removed
|
||||
{{ list_of_placeholders(template_change.placeholders_removed) }}
|
||||
</p>
|
||||
{% endif %}
|
||||
{% if template_change.placeholders_added %}
|
||||
<p>
|
||||
You added {{ list_of_placeholders(template_change.placeholders_added) }}
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<p>
|
||||
When you send messages using this template you’ll need
|
||||
{{ new_template.placeholders|length + 1 }} columns of data:
|
||||
</p>
|
||||
|
||||
<div class="spreadsheet">
|
||||
{% call(item, row_number) list_table(
|
||||
example_rows,
|
||||
caption="Example",
|
||||
caption_visible=False,
|
||||
field_headings=[''] + column_headings
|
||||
) %}
|
||||
{% if 1 == row_number %}
|
||||
{{ index_field('') }}
|
||||
{% else %}
|
||||
{{ index_field(row_number - 1) }}
|
||||
{% endif %}
|
||||
{% for column in item %}
|
||||
{{ text_field(column) }}
|
||||
{% endfor %}
|
||||
{% endcall %}
|
||||
</div>
|
||||
|
||||
<p>Developers, you’ll need to update your API calls</p>
|
||||
|
||||
<form method="post">
|
||||
<input type="hidden" name="name" value="{{ new_template.name }}" />
|
||||
<input type="hidden" name="subject" value="{{ new_template.subject or '' }}" />
|
||||
<input type="hidden" name="template_content" value="{{ new_template.content }}" />
|
||||
<input type="hidden" name="confirm" value="true" />
|
||||
{{ page_footer(
|
||||
'Save changes to template',
|
||||
back_link=url_for(".edit_service_template", service_id=current_service.id, template_id=new_template.id),
|
||||
back_link_text="Back"
|
||||
) }}
|
||||
</form>
|
||||
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user