From d2b4dd5007396d72a720d796238dbe9e976c9b85 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Mon, 20 Jun 2016 16:00:42 +0100 Subject: [PATCH] Revert "Add character count as you type" This reverts commit fbc4abf85d8c094adcb71bdd05c3a76b33c318b4. --- app/assets/javascripts/characterCount.js | 39 ------------------- .../stylesheets/components/textbox.scss | 6 --- app/templates/components/textbox.html | 11 +----- app/templates/views/edit-sms-template.html | 9 +---- app/templates/views/pricing.html | 15 +++---- gulpfile.babel.js | 1 - tests/app/main/views/test_templates.py | 10 ++--- 7 files changed, 12 insertions(+), 79 deletions(-) delete mode 100644 app/assets/javascripts/characterCount.js diff --git a/app/assets/javascripts/characterCount.js b/app/assets/javascripts/characterCount.js deleted file mode 100644 index 97232c615..000000000 --- a/app/assets/javascripts/characterCount.js +++ /dev/null @@ -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 = $(` -

- `)); - - $textarea - .trigger('change'); - - }; - - }; - -})(window.GOVUK.Modules); diff --git a/app/assets/stylesheets/components/textbox.scss b/app/assets/stylesheets/components/textbox.scss index d49b0c6c6..27ee0d1f8 100644 --- a/app/assets/stylesheets/components/textbox.scss +++ b/app/assets/stylesheets/components/textbox.scss @@ -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; -} diff --git a/app/templates/components/textbox.html b/app/templates/components/textbox.html index cfd6f15d2..40d141072 100644 --- a/app/templates/components/textbox.html +++ b/app/templates/components/textbox.html @@ -9,16 +9,9 @@ width='2-3', suffix=None, safe_error_message=False, - rows=8, - character_count=False, - service_name=None + rows=8 ) %} -

+
- {{ 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, diff --git a/app/templates/views/pricing.html b/app/templates/views/pricing.html index d92cd0d68..34f47e3f5 100644 --- a/app/templates/views/pricing.html +++ b/app/templates/views/pricing.html @@ -20,15 +20,12 @@
  • Free allowance: 250,000 text messages per service, per financial year
  • -
  • - If your messages are long, they will count as 2 or 3 text messages, depending on length: -
      -
    • Up to 160 characters = 1 text message
    • -
    • Up to 306 characters = 2 text messages
    • -
    • Up to 459 characters = 3 text messages
    • -
    • Your service name counts towards the length of your message
    • -
    -
  • +
  • If your messages are long, they will count as 2 or 3 text messages, depending on length: +
      +
    • Up to 160 characters = 1 text message
    • +
    • Up to 306 characters = 2 text messages
    • +
    • Up to 459 characters = 3 text messages
    • +
  • Standard text message rate: 1.8p + VAT
diff --git a/gulpfile.babel.js b/gulpfile.babel.js index d66b45257..c97144b44 100644 --- a/gulpfile.babel.js +++ b/gulpfile.babel.js @@ -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({ diff --git a/tests/app/main/views/test_templates.py b/tests/app/main/views/test_templates.py index c9ae21957..952ed1d49 100644 --- a/tests/app/main/views/test_templates.py +++ b/tests/app/main/views/test_templates.py @@ -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_,