Merge pull request #3763 from alphagov/count-chars-sms-broadcast-templates

Add fragment or character counting when editing text message or broadcast templates
This commit is contained in:
Chris Hill-Scott
2021-01-08 16:38:03 +00:00
committed by GitHub
15 changed files with 621 additions and 22 deletions

View File

@@ -11,10 +11,11 @@
width='2-3',
suffix=None,
safe_error_message=False,
rows=8
rows=8,
extra_form_group_classes=''
) %}
<div
class="form-group{% if field.errors %} form-group-error{% endif %}"
class="form-group{% if field.errors %} form-group-error{% endif %} {{ extra_form_group_classes }}"
data-module="{% if autofocus %}autofocus{% elif colour_preview %}colour-preview{% endif %}"
>
<label class="form-label" for="{{ field.name }}">

View File

@@ -0,0 +1,3 @@
<span {% if error %}class="govuk-error-message"{% endif %}>
{{ message }}
</span>

View File

@@ -1,7 +1,7 @@
{% extends "withnav_template.html" %}
{% from "components/textbox.html" import textbox %}
{% from "components/page-header.html" import page_header %}
{% from "components/page-footer.html" import sticky_page_footer %}
{% from "components/page-footer.html" import page_footer %}
{% from "components/form.html" import form_wrapper %}
{% block service_page_title %}
@@ -22,10 +22,22 @@
"classes": "govuk-!-width-full",
"hint": {"text": "Your recipients will not see this"},
}) }}
{{ textbox(
form.template_content,
highlight_placeholders=False,
autosize=True,
width='1-1',
rows=5,
extra_form_group_classes='govuk-!-margin-bottom-2'
) }}
</div>
<div class="govuk-grid-column-two-thirds">
{{ textbox(form.template_content, highlight_placeholders=False, autosize=True, width='1-1', rows=5) }}
{{ sticky_page_footer('Save') }}
<div class="govuk-grid-column-full">
<div class="template-content-count">
<div data-module="update-status" data-target="template_content" data-updates-url="{{ url_for('.count_content_length', service_id=current_service.id, template_type='broadcast') }}" aria-live="polite">
&nbsp;
</div>
</div>
{{ page_footer('Save') }}
</div>
</div>
{% endcall %}

View File

@@ -1,7 +1,7 @@
{% extends "withnav_template.html" %}
{% from "components/textbox.html" import textbox %}
{% from "components/page-header.html" import page_header %}
{% from "components/page-footer.html" import sticky_page_footer %}
{% from "components/page-footer.html" import page_footer %}
{% from "components/form.html" import form_wrapper %}
{% block service_page_title %}
@@ -22,15 +22,24 @@
"classes": "govuk-!-width-full",
"hint": {"text": "Your recipients will not see this"}
}) }}
</div>
<div class="govuk-grid-column-two-thirds">
{{ textbox(form.template_content, highlight_placeholders=True, width='1-1', rows=5) }}
{{ textbox(
form.template_content,
highlight_placeholders=True,
width='1-1',
rows=5,
extra_form_group_classes='govuk-!-margin-bottom-2'
) }}
{% if current_user.platform_admin %}
{{ form.process_type }}
{% endif %}
{{ sticky_page_footer(
'Save'
) }}
</div>
<div class="govuk-grid-column-full">
<div class="template-content-count">
<div data-module="update-status" data-target="template_content" data-updates-url="{{ url_for('.count_content_length', service_id=current_service.id, template_type='sms') }}" aria-live="polite">
&nbsp;
</div>
</div>
{{ page_footer('Save') }}
</div>
<aside class="govuk-grid-column-full">
{% include "partials/templates/guidance-personalisation.html" %}