diff --git a/app/assets/javascripts/errorBanner.js b/app/assets/javascripts/errorBanner.js index 2efef7d95..c05c821ea 100644 --- a/app/assets/javascripts/errorBanner.js +++ b/app/assets/javascripts/errorBanner.js @@ -12,6 +12,5 @@ hideBanner: () => $('.banner-dangerous').addClass('display-none'), showBanner: () => $('.banner-dangerous') .removeClass('display-none') - .trigger('focus'), }; })(window); diff --git a/app/assets/javascripts/fileUpload.js b/app/assets/javascripts/fileUpload.js index 9ef72d531..ea6c7ac62 100644 --- a/app/assets/javascripts/fileUpload.js +++ b/app/assets/javascripts/fileUpload.js @@ -15,9 +15,9 @@ // The label gets styled like a button and is used to hide the native file upload control. This is so that // users see a button that looks like the others on the site. -// - this.$form.find('label.file-upload-button').addClass('usa-button margin-bottom-1'); + this.$form.find('label.file-upload-button').addClass('usa-button margin-bottom-1').attr( {role: 'button', tabindex: '0'} ); + // Clear the form if the user navigates back to the page $(window).on("pageshow", () => this.$form[0].reset()); diff --git a/app/assets/javascripts/main.js b/app/assets/javascripts/main.js index 144b2ba67..3cc17c20d 100644 --- a/app/assets/javascripts/main.js +++ b/app/assets/javascripts/main.js @@ -16,8 +16,6 @@ $(() => GOVUK.modules.start()); $(() => $('.error-message, .usa-error-message').eq(0).parent('label').next('input').trigger('focus')); -$(() => $('.banner-dangerous').eq(0).trigger('focus')); - $(() => $('.govuk-header__container').on('click', function() { $(this).css('border-color', '#005ea5'); })); diff --git a/app/assets/sass/uswds/_uswds-theme-custom-styles.scss b/app/assets/sass/uswds/_uswds-theme-custom-styles.scss index f99459c5b..9b88d44a7 100644 --- a/app/assets/sass/uswds/_uswds-theme-custom-styles.scss +++ b/app/assets/sass/uswds/_uswds-theme-custom-styles.scss @@ -414,7 +414,6 @@ details form { display: block; box-sizing: border-box; position: relative; - margin: 0; padding: 4px; overflow: hidden; line-height: 1.6; diff --git a/app/templates/components/components/alert/template.njk b/app/templates/components/components/alert/template.njk index 85d40a785..d89405e64 100644 --- a/app/templates/components/components/alert/template.njk +++ b/app/templates/components/components/alert/template.njk @@ -11,7 +11,7 @@
{{params.heading}}

- {{params.text}} + {{params.text | safe }}

diff --git a/app/templates/components/components/inset-text/template.njk b/app/templates/components/components/inset-text/template.njk index ade008fed..9e0e6fcdf 100644 --- a/app/templates/components/components/inset-text/template.njk +++ b/app/templates/components/components/inset-text/template.njk @@ -1,4 +1,4 @@ -
{{ params.html | safe if params.html else params.text }}
diff --git a/app/templates/partials/check/message-too-long.html b/app/templates/partials/check/message-too-long.html index 35facdffe..f44ed84b5 100644 --- a/app/templates/partials/check/message-too-long.html +++ b/app/templates/partials/check/message-too-long.html @@ -1,7 +1,9 @@ -

- Message too long -

-

- Text messages cannot be longer than {{ SMS_CHAR_COUNT_LIMIT }} characters. - Your message is {{ template.content_count }} characters. -

+ diff --git a/app/templates/partials/check/not-allowed-to-send-to.html b/app/templates/partials/check/not-allowed-to-send-to.html index ff566a76a..b438f296f 100644 --- a/app/templates/partials/check/not-allowed-to-send-to.html +++ b/app/templates/partials/check/not-allowed-to-send-to.html @@ -1,12 +1,16 @@ -

- You cannot send to - {{ 'this' if count_of_recipients == 1 else 'these' }} - {{ template_type_label }} - {%- if count_of_recipients != 1 -%} - {{ 'es' if 'email address' == template_type_label else 's' }} - {%- endif %} -

-

- In trial mode you can only - send to yourself and members of your team -

+ diff --git a/app/templates/partials/check/sent-previously.html b/app/templates/partials/check/sent-previously.html index 0f657e047..49bf82cdf 100644 --- a/app/templates/partials/check/sent-previously.html +++ b/app/templates/partials/check/sent-previously.html @@ -1,6 +1,8 @@ -

- These messages have already been sent today -

-

- If you need to resend them, rename the file and upload it again. -

+ \ No newline at end of file diff --git a/app/templates/partials/check/too-many-messages.html b/app/templates/partials/check/too-many-messages.html index ef2a87f06..932574981 100644 --- a/app/templates/partials/check/too-many-messages.html +++ b/app/templates/partials/check/too-many-messages.html @@ -1,23 +1,30 @@ -

- {% if original_file_name %} - Too many recipients - {% else %} - Daily limit reached - {% endif %} -

-

- You can only send {{ current_service.message_limit|format_thousands }} messages per day - {%- if current_service.trial_mode %} - in trial mode - {%- endif -%} - . -

-{% if original_file_name %} -

- {% if current_service.message_limit != remaining_messages %} +

+ + + diff --git a/app/templates/partials/templates/guidance-character-count.html b/app/templates/partials/templates/guidance-character-count.html index d99cc087a..4cf377621 100644 --- a/app/templates/partials/templates/guidance-character-count.html +++ b/app/templates/partials/templates/guidance-character-count.html @@ -1,8 +1,14 @@ -

Message length

-

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

-

- See pricing for details. -

+

+ +

+
+

+ 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 index 6ed7a2d68..231902d22 100644 --- a/app/templates/partials/templates/guidance-links.html +++ b/app/templates/partials/templates/guidance-links.html @@ -1,9 +1,15 @@ {% from "components/components/inset-text/macro.njk" import usaInsetText %} -

Links and URLs

-

- Always use full URLs, starting with https://. For example: -{{ usaInsetText({ - "text": "Apply now at https://www.usa.gov/example", - "classes": "usa-body"}) -}} +

+ +

+ \ No newline at end of file diff --git a/app/templates/partials/templates/guidance-optional-content.html b/app/templates/partials/templates/guidance-optional-content.html index 8c97be5b3..d3bc0dba5 100644 --- a/app/templates/partials/templates/guidance-optional-content.html +++ b/app/templates/partials/templates/guidance-optional-content.html @@ -1,21 +1,25 @@ {% from "components/components/inset-text/macro.njk" import usaInsetText %} -

- Optional content -

-

- Use double brackets and ‘??’ to define optional content. -

-

- For example if you only want to show something to people who are under - 18: -

-{{ usaInsetText({ +

+ +

+
+

+ Use double brackets and ‘??’ to define optional content. +

+

+ For example if you only want to show something to people who are under + 18: +

+ {{ usaInsetText({ "text": "((under18??Please get your application signed by a parent or guardian.))", "classes": "usa-body"}) -}} -

- For each person you send this message to, specify ‘yes’ or ‘no’ to - show or hide this content. -

+ }} +

+ For each person you send this message to, specify ‘yes’ or ‘no’ to + show or hide this content. +

+
diff --git a/app/templates/partials/templates/guidance-personalisation.html b/app/templates/partials/templates/guidance-personalisation.html deleted file mode 100644 index c995e5e5e..000000000 --- a/app/templates/partials/templates/guidance-personalisation.html +++ /dev/null @@ -1,12 +0,0 @@ -{% from "components/components/inset-text/macro.njk" import usaInsetText %} - -

- Personalization -

-

- Use double brackets to personalize your message: -

-{{ usaInsetText({ - "text": "Hello ((first name)), your reference is ((ref number))", - "classes": ""}) -}} diff --git a/app/templates/partials/templates/guidance-personalization.html b/app/templates/partials/templates/guidance-personalization.html new file mode 100644 index 000000000..bc6a358a5 --- /dev/null +++ b/app/templates/partials/templates/guidance-personalization.html @@ -0,0 +1,17 @@ +{% from "components/components/inset-text/macro.njk" import usaInsetText %} + +

+ +

+
+

+ Use double brackets to personalize your message: +

+ {{ usaInsetText({ + "text": "Hello ((first name)), your reference is ((ref number))", + "classes": ""}) + }} +
+ diff --git a/app/templates/views/check/column-errors.html b/app/templates/views/check/column-errors.html index d63a1258c..404302ffe 100644 --- a/app/templates/views/check/column-errors.html +++ b/app/templates/views/check/column-errors.html @@ -6,193 +6,208 @@ {% from "components/components/back-link/macro.njk" import usaBackLink %} {% block service_page_title %} - Error +Error {% endblock %} {% block backLink %} - {{ usaBackLink({ "href": back_link }) }} +{{ usaBackLink({ "href": back_link }) }} {% endblock %} {% block maincolumn_content %} -
- {% call banner_wrapper(type='dangerous') %} +
+ {% call banner_wrapper(type='dangerous') %} - {% if recipients.too_many_rows %} + {% if recipients.too_many_rows %} -

- Your file has too many rows -

-

+

+ {% elif not count_of_recipients %} -
-
- {% if not request.args.from_test %} - {{ file_upload( - form.file, - allowed_file_extensions=allowed_file_extensions, - action=url_for('.send_messages', service_id=current_service.id, template_id=template.id), - button_text='Upload your file again' - ) }} + - {% if not request.args.from_test %} + {% elif not recipients.has_recipient_columns %} - {% set column_headers = recipients._raw_column_headers if recipients.duplicate_recipient_column_headers else recipients.column_headers %} + -

{{ original_file_name }}

+ {% elif recipients.duplicate_recipient_column_headers %} -
- {% call(item, row_number) list_table( - recipients.displayed_rows, - caption=original_file_name, - caption_visible=False, - field_headings=[ - 'Row in file'|safe - ] + column_headers - ) %} - {% call index_field() %} - - {% set displayed_index = item.index + 2 %} - {{ displayed_index }} - - {% endcall %} - {% for column in column_headers %} - {% if item[column].error and not recipients.missing_column_headers %} - {% call field() %} - - {{ item[column].error }} - {{ item[column].data if item[column].data != None }} - - {% endcall %} - {% elif item[column].ignore %} - {{ text_field(item[column].data or '', status='default') }} - {% else %} - {{ text_field(item[column].data or '') }} - {% endif %} - {% endfor %} - {% if item[None].data %} - {% for column in item[None].data %} - {{ text_field(column, status='default') }} - {% endfor %} - {% endif %} - {% endcall %} + + + {% elif recipients.missing_column_headers %} + + + + {% elif sent_previously %} + + {% include "partials/check/sent-previously.html" %} + + {% elif not recipients.allowed_to_send_to %} + + {% with + count_of_recipients=count_of_recipients, + template_type_label=recipients.recipient_column_headers[0] + %} + {% include "partials/check/not-allowed-to-send-to.html" %} + {% endwith %} + + {% elif recipients.more_rows_than_can_send %} + + {% include "partials/check/too-many-messages.html" %} + + {% endif %} + + {% endcall %} +
+ + +
+
+ {% if not request.args.from_test %} + {{ file_upload( + form.file, + allowed_file_extensions=allowed_file_extensions, + action=url_for('.send_messages', service_id=current_service.id, template_id=template.id), + button_text='Upload your file again' + ) }} {% endif %}
+ Back to top +
- {% if recipients.too_many_rows %} - - {% elif count_of_displayed_recipients < count_of_recipients %} - +{% if not request.args.from_test %} + +{% set column_headers = recipients._raw_column_headers if recipients.duplicate_recipient_column_headers else +recipients.column_headers %} + +

{{ original_file_name }}

+ +
+ {% call(item, row_number) list_table( + recipients.displayed_rows, + caption=original_file_name, + caption_visible=False, + field_headings=[ + 'Row in file'|safe + ] + column_headers + ) %} + {% call index_field() %} + + {% set displayed_index = item.index + 2 %} + {{ displayed_index }} + + {% endcall %} + {% for column in column_headers %} + {% if item[column].error and not recipients.missing_column_headers %} + {% call field() %} + + {{ item[column].error }} + {{ item[column].data if item[column].data != None }} + + {% endcall %} + {% elif item[column].ignore %} + {{ text_field(item[column].data or '', status='default') }} + {% else %} + {{ text_field(item[column].data or '') }} + {% endif %} + {% endfor %} + {% if item[None].data %} + {% for column in item[None].data %} + {{ text_field(column, status='default') }} + {% endfor %} + {% endif %} + {% endcall %} + {% endif %} +
+ +{% if recipients.too_many_rows %} + +{% elif count_of_displayed_recipients < count_of_recipients %} {% elif row_errors and not recipients.missing_column_headers %} - + {% endif %}

Preview of {{ template.name }}

{{ template|string }} -{% endblock %} + {% endblock %} \ No newline at end of file diff --git a/app/templates/views/edit-email-template.html b/app/templates/views/edit-email-template.html index b61c9098c..d658bb6de 100644 --- a/app/templates/views/edit-email-template.html +++ b/app/templates/views/edit-email-template.html @@ -37,7 +37,7 @@
{% include "partials/templates/guidance-formatting.html" %} - {% include "partials/templates/guidance-personalisation.html" %} + {% include "partials/templates/guidance-personalization.html" %} {% include "partials/templates/guidance-optional-content.html" %} {% include "partials/templates/guidance-links.html" %} {% include "partials/templates/guidance-send-a-document.html" %} diff --git a/app/templates/views/edit-sms-template.html b/app/templates/views/edit-sms-template.html index 0c22a8bc5..b3f1da603 100644 --- a/app/templates/views/edit-sms-template.html +++ b/app/templates/views/edit-sms-template.html @@ -20,11 +20,9 @@ {{ page_header('{} text message template'.format(heading_action)) }} - {{ usaAlert({ - "type": "info", - "text": "Don't worry, saving the template will not send", - "classes": "margin-top-2 usa-button--secondary" - }) }} + + How to customize your message + {% if current_service.prefix_sms %} {% set content_hint = 'Your service name will be added to the start of your message. You can turn this off in Settings.' %} @@ -32,7 +30,7 @@ {% call form_wrapper() %}
-
+
{{ form.name(param_extensions={ "extra_form_group_classes": "margin-bottom-2", "hint": {"text": "Your recipients will not see this"} @@ -50,22 +48,36 @@ {{ form.process_type }} {% endif %}
-
-
-
-   +
+
+
+
+   +
- {{ page_footer('Save') }} -

- After saving, you'll have the option to send 🚀 -

-
- {% include "partials/templates/guidance-personalisation.html" %} - {% include "partials/templates/guidance-optional-content.html" %} - {% include "partials/templates/guidance-links.html" %} - {% include "partials/templates/guidance-character-count.html" %} +
+
+ {{ page_footer('Save') }} +
+
+

+ After saving, you'll have the option to send. +

+
+
+ +
+

How to customize your message

+
+ {% include "partials/templates/guidance-personalization.html" %} + {% include "partials/templates/guidance-optional-content.html" %} + {% include "partials/templates/guidance-links.html" %} + {% include "partials/templates/guidance-character-count.html" %} +
{% endcall %} diff --git a/app/templates/views/service-settings.html b/app/templates/views/service-settings.html index 5751a6c8c..9364880fc 100644 --- a/app/templates/views/service-settings.html +++ b/app/templates/views/service-settings.html @@ -94,17 +94,19 @@ }} {% endcall %} - {% call settings_row(if_has_permission='sms') %} - {{ text_field('Send international text messages') }} - {{ boolean_field('international_sms' in current_service.permissions) }} - {{ edit_field( - 'Change', - url_for('.service_set_international_sms', service_id=current_service.id), - permissions=['manage_service'], - suffix='your settings for sending international text messages', - ) - }} - {% endcall %} + {% if current_user.platform_admin %} + {% call settings_row(if_has_permission='sms') %} + {{ text_field('Send international text messages') }} + {{ boolean_field('international_sms' in current_service.permissions) }} + {{ edit_field( + 'Change', + url_for('.service_set_international_sms', service_id=current_service.id), + permissions=['manage_service'], + suffix='your settings for sending international text messages', + ) + }} + {% endcall %} + {% endif %}