Merge pull request #1215 from alphagov/fix-address-column-handling

Fix address column handling
This commit is contained in:
Chris Hill-Scott
2017-04-06 16:25:18 +01:00
committed by GitHub
6 changed files with 49 additions and 30 deletions

View File

@@ -77,7 +77,6 @@ def get_example_letter_address(key):
return {
'address line 1': 'A. Name',
'address line 2': '123 Example Street',
'address line 3': 'Example town',
'postcode': 'XM4 5HQ'
}.get(key, '')

View File

@@ -287,13 +287,17 @@ def edit_service_template(service_id, template_id):
}, current_service)
template_change = get_template(template, current_service).compare_to(new_template)
if template_change.has_different_placeholders and not request.form.get('confirm'):
example_column_headings = (
first_column_headings[new_template.template_type] +
list(new_template.placeholders)
)
return render_template(
'views/templates/breaking-change.html',
template_change=template_change,
new_template=new_template,
column_headings=list(ascii_uppercase[:len(new_template.placeholders) + 1]),
column_headings=list(ascii_uppercase[:len(example_column_headings)]),
example_rows=[
first_column_headings[new_template.template_type] + list(new_template.placeholders),
example_column_headings,
get_example_csv_rows(new_template),
get_example_csv_rows(new_template)
],

View File

@@ -41,8 +41,8 @@
<p>
When you send messages using this template youll need
{{ new_template.placeholders|length + 1 }}
column{{ 's' if new_template.placeholders|length > 0 else '' }} of data:
{{ column_headings|length }}
column{{ 's' if column_headings|length > 1 else '' }} of data:
</p>
<div class="spreadsheet">