mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-10 01:55:41 -04: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):
|
class ServiceLetterContactBlock(Form):
|
||||||
letter_contact_block = TextAreaField()
|
letter_contact_block = TextAreaField(
|
||||||
|
validators=[
|
||||||
|
NoCommasInPlaceHolders()
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
def validate_letter_contact_block(form, field):
|
def validate_letter_contact_block(form, field):
|
||||||
line_count = field.data.strip().count('\n')
|
line_count = field.data.strip().count('\n')
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ from flask_login import (
|
|||||||
login_required,
|
login_required,
|
||||||
current_user
|
current_user
|
||||||
)
|
)
|
||||||
|
|
||||||
|
from notifications_utils.field import Field
|
||||||
from notifications_python_client.errors import HTTPError
|
from notifications_python_client.errors import HTTPError
|
||||||
|
|
||||||
from app import service_api_client
|
from app import service_api_client
|
||||||
@@ -46,7 +48,8 @@ def service_settings(service_id):
|
|||||||
organisation=organisation,
|
organisation=organisation,
|
||||||
letter_branding=letter_branding_organisations.get(
|
letter_branding=letter_branding_organisations.get(
|
||||||
current_service.get('dvla_organisation', '001')
|
current_service.get('dvla_organisation', '001')
|
||||||
)
|
),
|
||||||
|
letter_contact_block=Field(current_service['letter_contact_block'], html='escape')
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@
|
|||||||
{% call row() %}
|
{% call row() %}
|
||||||
{{ text_field('Letter contact details') }}
|
{{ text_field('Letter contact details') }}
|
||||||
{% call field(status='' if current_service.letter_contact_block else 'default') %}
|
{% 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 %}
|
{% endcall %}
|
||||||
{{ edit_field('Change', url_for('.service_set_letter_contact_block', service_id=current_service.id)) }}
|
{{ edit_field('Change', url_for('.service_set_letter_contact_block', service_id=current_service.id)) }}
|
||||||
{% endcall %}
|
{% endcall %}
|
||||||
|
|||||||
@@ -18,7 +18,8 @@
|
|||||||
label='How should users contact your service?<br>This applies to all the letters you send.'|safe,
|
label='How should users contact your service?<br>This applies to all the letters you send.'|safe,
|
||||||
hint='10 lines maximum',
|
hint='10 lines maximum',
|
||||||
width='1-1',
|
width='1-1',
|
||||||
rows=10
|
rows=10,
|
||||||
|
highlight_tags=True
|
||||||
) }}
|
) }}
|
||||||
{{ page_footer(
|
{{ page_footer(
|
||||||
'Save',
|
'Save',
|
||||||
|
|||||||
@@ -28,4 +28,4 @@ notifications-python-client>=3.1,<3.2
|
|||||||
awscli>=1.11,<1.12
|
awscli>=1.11,<1.12
|
||||||
awscli-cwlogs>=1.4,<1.5
|
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