diff --git a/app/assets/javascripts/placeholderHint.js b/app/assets/javascripts/placeholderHint.js deleted file mode 100644 index bf73cd805..000000000 --- a/app/assets/javascripts/placeholderHint.js +++ /dev/null @@ -1,75 +0,0 @@ -(function(Modules) { - "use strict"; - - if ( - !('oninput' in document.createElement('input')) - ) return; - - const tagPattern = /\(\([^\)\(]+\)\)/g; - - Modules.PlaceholderHint = function() { - - this.start = function(component) { - - this.$component = $(component); - this.originalHTML = this.$component.html(); - this.$allTextboxes = $(this.$component.data('textboxes-selector')); - this.$targetTextbox = $(this.$component.data('target-textbox-selector')); - - this.$component - .on('click', '.placeholder-hint-action', this.demo); - - this.$allTextboxes - .on('input', this.hint) - .trigger('input'); - - }; - - this.getPlaceholderHint = function() { - - let placeholders = this.listPlaceholdersWithoutBrackets(); - - if (0 === placeholders.length) { - return ` - ${this.originalHTML} - Show me how - `; - } - if (1 === placeholders.length) { - return ` - ${this.originalHTML} -
You’ll populate the ‘${placeholders[0]}’ field when you send messages using this template
- `; - } - return ` - ${this.originalHTML} -You’ll populate your fields when you send some messages
- `; - - }; - - this.escapedMessages = () => $('').text( - this.$allTextboxes.map(function() { - return $(this).val(); - }).get() - ).html(); - - this.listPlaceholders = () => this.escapedMessages().match(tagPattern) || []; - - this.listPlaceholdersWithoutBrackets = () => this.listPlaceholders().map( - placeholder => placeholder.substring(2, placeholder.length - 2) - ); - - this.renderDemo = () => this.$targetTextbox.val((i, current) => `Dear ((name)), ${current}`); - - this.hint = () => this.$component.html( - this.getPlaceholderHint() - ); - - this.demo = () => ( - this.renderDemo() && this.$targetTextbox.trigger('input') && this.hint() - ); - - }; - -})(window.GOVUK.Modules); diff --git a/app/assets/stylesheets/components/secondary-button.scss b/app/assets/stylesheets/components/secondary-button.scss index 6e7a0ff7c..2aef3ffb4 100644 --- a/app/assets/stylesheets/components/secondary-button.scss +++ b/app/assets/stylesheets/components/secondary-button.scss @@ -6,3 +6,12 @@ padding-right: 0; text-align: center; } + +.tertiary-button { + @include button($grey-3); + padding: 0.3em 0.1em 0.2em 0.1em; + width: 100%; + padding-left: 0; + padding-right: 0; + text-align: left; +} diff --git a/app/main/forms.py b/app/main/forms.py index aa99a450e..e4927ea06 100644 --- a/app/main/forms.py +++ b/app/main/forms.py @@ -198,7 +198,7 @@ class SMSTemplateForm(Form): validators=[DataRequired(message="Can’t be empty")]) template_content = TextAreaField( - u'Message content', + u'Message', validators=[ DataRequired(message="Can’t be empty"), NoCommasInPlaceHolders() diff --git a/app/templates/partials/templates/guidance-character-count.html b/app/templates/partials/templates/guidance-character-count.html new file mode 100644 index 000000000..b11dae62e --- /dev/null +++ b/app/templates/partials/templates/guidance-character-count.html @@ -0,0 +1,12 @@ ++ If your message is long then it will + cost more. +
++ See pricing for details. +
++ Always use full URLs, starting with https:// +
++ Use double brackets to add personalisation. +
++ Correct: ((name)) +
++ Incorrect: ((Helen)) +
+