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 @@ +
+ Message length +
+

+ If your message is long then it will + cost more. +

+

+ See pricing for details. +

+
+
diff --git a/app/templates/partials/templates/guidance-links.html b/app/templates/partials/templates/guidance-links.html new file mode 100644 index 000000000..2d7aab039 --- /dev/null +++ b/app/templates/partials/templates/guidance-links.html @@ -0,0 +1,8 @@ +
+ Links and URLs +
+

+ Always use full URLs, starting with https:// +

+
+
diff --git a/app/templates/partials/templates/guidance-personalisation.html b/app/templates/partials/templates/guidance-personalisation.html new file mode 100644 index 000000000..3cae73723 --- /dev/null +++ b/app/templates/partials/templates/guidance-personalisation.html @@ -0,0 +1,14 @@ +
+ Personalisation +
+

+ Use double brackets to add personalisation. +

+

+ Correct: ((name)) +

+

+ Incorrect: ((Helen)) +

+
+
diff --git a/app/templates/views/edit-email-template.html b/app/templates/views/edit-email-template.html index ab0492963..1e3db961c 100644 --- a/app/templates/views/edit-email-template.html +++ b/app/templates/views/edit-email-template.html @@ -16,9 +16,9 @@
{{ textbox(form.name, width='1-1', hint='Your recipients won’t see this', rows=10) }} + {{ textbox(form.subject, width='1-1', highlight_tags=True, rows=2) }}
- {{ textbox(form.subject, width='1-1', highlight_tags=True, rows=2) }} {{ textbox(form.template_content, highlight_tags=True, width='1-1', rows=8) }} {{ page_footer( 'Save', @@ -26,13 +26,11 @@ delete_link_text='Delete this template' ) }}
-
- -
+
diff --git a/app/templates/views/edit-sms-template.html b/app/templates/views/edit-sms-template.html index ee4778fa9..45d6d7fe4 100644 --- a/app/templates/views/edit-sms-template.html +++ b/app/templates/views/edit-sms-template.html @@ -18,20 +18,19 @@ {{ textbox(form.name, width='1-1', hint='Your recipients won’t see this') }}
- {{ textbox(form.template_content, highlight_tags=True, width='1-1') }} + {{ 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, delete_link_text='Delete this template' ) }}
-
- -
+ diff --git a/gulpfile.babel.js b/gulpfile.babel.js index 1f8ee9e50..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/placeholderHint.js', paths.src + 'javascripts/main.js' ]) .pipe(plugins.babel({