mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-23 11:51:05 -05:00
Merge pull request #1279 from alphagov/placeholders-in-contact-block
Enable placeholders in letter contact block
This commit is contained in:
@@ -502,7 +502,11 @@ class ServiceSmsSender(Form):
|
||||
|
||||
|
||||
class ServiceLetterContactBlock(Form):
|
||||
letter_contact_block = TextAreaField()
|
||||
letter_contact_block = TextAreaField(
|
||||
validators=[
|
||||
NoCommasInPlaceHolders()
|
||||
]
|
||||
)
|
||||
|
||||
def validate_letter_contact_block(form, field):
|
||||
line_count = field.data.strip().count('\n')
|
||||
|
||||
@@ -14,6 +14,8 @@ from flask_login import (
|
||||
login_required,
|
||||
current_user
|
||||
)
|
||||
|
||||
from notifications_utils.field import Field
|
||||
from notifications_python_client.errors import HTTPError
|
||||
|
||||
from app import service_api_client
|
||||
@@ -46,7 +48,8 @@ def service_settings(service_id):
|
||||
organisation=organisation,
|
||||
letter_branding=letter_branding_organisations.get(
|
||||
current_service.get('dvla_organisation', '001')
|
||||
)
|
||||
),
|
||||
letter_contact_block=Field(current_service['letter_contact_block'], html='escape')
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
{% call row() %}
|
||||
{{ text_field('Letter contact details') }}
|
||||
{% call field(status='' if current_service.letter_contact_block else 'default') %}
|
||||
{{ current_service.letter_contact_block | escape | nl2br | safe }}
|
||||
{{ letter_contact_block | string | nl2br | safe if current_service.letter_contact_block else 'None'}}
|
||||
{% endcall %}
|
||||
{{ edit_field('Change', url_for('.service_set_letter_contact_block', service_id=current_service.id)) }}
|
||||
{% endcall %}
|
||||
|
||||
@@ -18,7 +18,8 @@
|
||||
label='How should users contact your service?<br>This applies to all the letters you send.'|safe,
|
||||
hint='10 lines maximum',
|
||||
width='1-1',
|
||||
rows=10
|
||||
rows=10,
|
||||
highlight_tags=True
|
||||
) }}
|
||||
{{ page_footer(
|
||||
'Save',
|
||||
|
||||
@@ -28,4 +28,4 @@ notifications-python-client>=3.1,<3.2
|
||||
awscli>=1.11,<1.12
|
||||
awscli-cwlogs>=1.4,<1.5
|
||||
|
||||
git+https://github.com/alphagov/notifications-utils.git@17.0.1#egg=notifications-utils==17.0.1
|
||||
git+https://github.com/alphagov/notifications-utils.git@17.1.2#egg=notifications-utils==17.1.2
|
||||
|
||||
Reference in New Issue
Block a user