From 5a9f817e52c8ec24a358003713b198203d479283 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Thu, 20 Jul 2017 09:02:08 +0100 Subject: [PATCH] Remove anything error-related from the OK view MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If you’ve uploaded a file and everything is OK, the page that you see doesn’t need to look at any errors (because there won’t be any). --- app/templates/views/check/ok.html | 160 ++---------------------------- 1 file changed, 8 insertions(+), 152 deletions(-) diff --git a/app/templates/views/check/ok.html b/app/templates/views/check/ok.html index ebb207edd..c09b73756 100644 --- a/app/templates/views/check/ok.html +++ b/app/templates/views/check/ok.html @@ -14,141 +14,19 @@ {% endmacro %} {% block service_page_title %} - {{ "Error" if errors else "Preview of {}".format(template.name) }} + {{ "Preview of {}".format(template.name) }} {% endblock %} {% block maincolumn_content %} - {% if recipients.too_many_rows %} +

+ Preview of {{ template.name }} +

+ {{ skip_to_file_contents() }} -
- {% call banner_wrapper(type='dangerous') %} -

- Your file has too many rows -

-

- Notify can process up to - {{ "{:,}".format(recipients.max_rows) }} rows at once. Your - file has {{ "{:,}".format(recipients|length) }} rows. -

- {{ skip_to_file_contents() }} - {% endcall %} -
- - {% elif not count_of_recipients %} - -
- {% call banner_wrapper(type='dangerous') %} -

- Your file is missing some rows -

-

- It needs at least one row of data, and {{ recipients.missing_column_headers | sort() | formatted_list( - prefix='a column called', - prefix_plural='columns called' - ) }}. -

- {{ skip_to_file_contents() }} - {% endcall %} -
- - {% elif not recipients.has_recipient_columns %} - -
- {% call banner_wrapper(type='dangerous') %} -

- Your file needs {{ recipients.recipient_column_headers | formatted_list( - prefix='a column called', - prefix_plural='columns called' - ) }} -

-

- Right now it has {{ recipients.column_headers | formatted_list( - prefix='one column, called ', - prefix_plural='columns called ' - ) }}. -

- {{ skip_to_file_contents() }} - {% endcall %} -
- - {% elif recipients.missing_column_headers %} - -
- {% call banner_wrapper(type='dangerous') %} -

- The columns in your file need to match the double brackets in - your template -

-

- Your file is missing {{ recipients.missing_column_headers | formatted_list( - conjunction='and', - prefix='a column called ', - prefix_plural='columns called ' - ) }}. -

- {{ skip_to_file_contents() }} - {% endcall %} -
- - {% elif row_errors %} - -
- {% call banner_wrapper(type='dangerous') %} - {% if row_errors|length == 1 %} -

- There is a problem with your data -

-

- You need to {{ row_errors[0] }} -

- {% else %} -

- There are some problems with your data -

-

- You need to: -

- - {% endif %} - {{ skip_to_file_contents() }} - {% endcall %} -
- - {% 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" %} - {% else %} - -

- Preview of {{ template.name }} -

- {{ skip_to_file_contents() }} - - {% endif %} - - {% if not errors %} - {{ template|string }} - {% endif %} + {{ template|string }}
- {% if errors %} - {% if request.args.from_test %} - Back - {% else %} - {{file_upload(form.file, button_text='Re-upload your file')}} - {% endif %} - {% else %} - {% endif %}
{% if not request.args.from_test %} @@ -186,14 +63,7 @@ {% endcall %} {% for column in recipients.column_headers %} - {% if item['columns'][column].error and not recipients.missing_column_headers %} - {% call field() %} - - {{ item['columns'][column].error }} - {{ item['columns'][column].data if item['columns'][column].data != None }} - - {% endcall %} - {% elif item['columns'][column].ignore %} + {% if item['columns'][column].ignore %} {{ text_field(item['columns'][column].data or '', status='default') }} {% else %} {{ text_field(item['columns'][column].data or '') }} @@ -208,12 +78,7 @@ {% endif %} - - {% if recipients.too_many_rows %} - - {% elif count_of_displayed_recipients < count_of_recipients %} + {% if count_of_displayed_recipients < count_of_recipients %} - {% elif row_errors and not recipients.missing_column_headers %} - - {% endif %} - - {% if errors %} -

Preview of {{ template.name }}

- {{ template|string }} {% endif %} {% endblock %}