mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-05 19:03:30 -05:00
Revert "Add character count as you type"
This reverts commit fbc4abf85d.
This commit is contained in:
@@ -1,39 +0,0 @@
|
||||
(function(Modules) {
|
||||
"use strict";
|
||||
|
||||
Modules.CharacterCount = function() {
|
||||
|
||||
this.start = function(component) {
|
||||
|
||||
var getCharacterCount = () =>
|
||||
($textarea.val()).length;
|
||||
|
||||
var getLengthOfOneMessage = () =>
|
||||
160 - (serviceName + ': ').length;
|
||||
|
||||
var $component = $(component);
|
||||
|
||||
var serviceName = $component.data('service-name');
|
||||
|
||||
var $textarea = $('textarea', $component)
|
||||
.eq(0)
|
||||
.on('change keyup paste', () => $counter.html(`
|
||||
${getCharacterCount()} of ${getLengthOfOneMessage()} characters
|
||||
`));
|
||||
|
||||
$component
|
||||
.append($counter = $(`
|
||||
<p class="textbox-character-count"
|
||||
role="status" aria-live="polite" aria-relevant="text"
|
||||
id="word-count-${$textarea.prop('name')}"
|
||||
/>
|
||||
`));
|
||||
|
||||
$textarea
|
||||
.trigger('change');
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
})(window.GOVUK.Modules);
|
||||
@@ -54,9 +54,3 @@
|
||||
.textbox-right-aligned {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.textbox-character-count {
|
||||
@include core-19($tabular-numbers: true);
|
||||
margin: 10px 0 0 0;
|
||||
color: $secondary-text-colour;
|
||||
}
|
||||
|
||||
@@ -9,16 +9,9 @@
|
||||
width='2-3',
|
||||
suffix=None,
|
||||
safe_error_message=False,
|
||||
rows=8,
|
||||
character_count=False,
|
||||
service_name=None
|
||||
rows=8
|
||||
) %}
|
||||
<div
|
||||
class="form-group{% if field.errors %} error{% endif %}"
|
||||
{% if autofocus %}data-module="autofocus"{% endif %}
|
||||
{% if character_count %}data-module="character-count"{% endif %}
|
||||
{% if service_name %}data-service-name="{{ service_name }}"{% endif %}
|
||||
>
|
||||
<div class="form-group{% if field.errors %} error{% endif %}" {% if autofocus %}data-module="autofocus"{% endif %}>
|
||||
<label class="form-label" for="{{ field.name }}">
|
||||
{% if label %}
|
||||
{{ label }}
|
||||
|
||||
@@ -18,14 +18,7 @@
|
||||
{{ textbox(form.name, width='1-1', hint='Your recipients won’t see this') }}
|
||||
</div>
|
||||
<div class="column-two-thirds">
|
||||
{{ textbox(
|
||||
form.template_content,
|
||||
highlight_tags=True,
|
||||
character_count=True,
|
||||
width='1-1',
|
||||
service_name=current_service.name,
|
||||
rows=5
|
||||
) }}
|
||||
{{ textbox(form.template_content, highlight_tags=True, width='1-1', rows=5) }}
|
||||
{{ page_footer(
|
||||
'Save',
|
||||
delete_link=url_for('.delete_service_template', service_id=current_service.id, template_id=template_id) if template_id or None,
|
||||
|
||||
@@ -20,15 +20,12 @@
|
||||
|
||||
<ul class="list list-bullet">
|
||||
<li>Free allowance: 250,000 text messages per service, per financial year</li>
|
||||
<li>
|
||||
If your messages are long, they will count as 2 or 3 text messages, depending on length:
|
||||
<ul class="list list-bullet">
|
||||
<li>Up to 160 characters = 1 text message</li>
|
||||
<li>Up to 306 characters = 2 text messages</li>
|
||||
<li>Up to 459 characters = 3 text messages</li>
|
||||
<li>Your service name counts towards the length of your message</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>If your messages are long, they will count as 2 or 3 text messages, depending on length:
|
||||
<ul class="list list-bullet">
|
||||
<li>Up to 160 characters = 1 text message</li>
|
||||
<li>Up to 306 characters = 2 text messages</li>
|
||||
<li>Up to 459 characters = 3 text messages</li>
|
||||
</ul></li>
|
||||
<li>Standard text message rate: 1.8p + VAT</li>
|
||||
</ul>
|
||||
|
||||
|
||||
@@ -60,7 +60,6 @@ gulp.task('javascripts', () => gulp
|
||||
paths.src + 'javascripts/fileUpload.js',
|
||||
paths.src + 'javascripts/updateContent.js',
|
||||
paths.src + 'javascripts/expandCollapse.js',
|
||||
paths.src + 'javascripts/characterCount.js',
|
||||
paths.src + 'javascripts/main.js'
|
||||
])
|
||||
.pipe(plugins.babel({
|
||||
|
||||
@@ -29,14 +29,10 @@ def test_should_show_page_for_one_templates(app_,
|
||||
template_id=template_id))
|
||||
|
||||
assert response.status_code == 200
|
||||
content = response.get_data(as_text=True)
|
||||
assert "Two week reminder" in content
|
||||
assert "Your vehicle tax is about to expire" in content
|
||||
assert 'data-module="character-count"' in content
|
||||
assert 'data-service-name="Test Service"' in content
|
||||
assert "Two week reminder" in response.get_data(as_text=True)
|
||||
assert "Your vehicle tax is about to expire" in response.get_data(as_text=True)
|
||||
mock_get_service_template.assert_called_with(
|
||||
service_id, template_id
|
||||
)
|
||||
service_id, template_id)
|
||||
|
||||
|
||||
def test_should_redirect_when_saving_a_template(app_,
|
||||
|
||||
Reference in New Issue
Block a user