Give more realistic example address data

Posit that examples of where you can put different parts of the address
is more helpful than ‘example, example, example’. Also shows that you
don’t have to fill all of the address columns.

Spot the Easter egg 🎅
This commit is contained in:
Chris Hill-Scott
2016-11-11 09:51:20 +00:00
parent 34e01824fa
commit a108165e47
2 changed files with 15 additions and 4 deletions

View File

@@ -54,13 +54,24 @@ def get_example_csv_rows(template, use_example_as_example=True, submitted_fields
'sms': ['07700 900321'] if use_example_as_example else [validate_and_format_phone_number(
current_user.mobile_number, human_readable=True
)],
'letter': [current_user.name] + [
(submitted_fields or {}).get(key, 'example' if use_example_as_example else key)
for key in first_column_headings['letter'][1:]
'letter': [
(submitted_fields or {}).get(
key, get_example_letter_address(key) if use_example_as_example else key
)
for key in first_column_headings['letter']
]
}[template.template_type] + get_example_csv_fields(template.placeholders, use_example_as_example, submitted_fields)
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, '')
@main.route("/services/<service_id>/send/<template_type>", methods=['GET'])
@login_required
@user_has_permissions('view_activity',

View File

@@ -51,7 +51,7 @@
) %}
{% for column in item %}
{% call field() %}
{% if loop.index > 1 %}
{% if loop.index > 1 or template.template_type == 'letter' %}
<label class="visuallyhidden" for="placeholder-field-{{ loop.index }}">{{ column }}</label>
<input class="form-control form-control-1-1 " data-module="" name="{{ column }}" rows="8" type="text" value="" id="placeholder-field-{{ loop.index }}">
{% else %}