Refactor uploads preview error banner to use a shared component

Also refactor a corresponding test to avoid asserting on the content
This commit is contained in:
Pea Tyczynska
2019-10-24 22:57:05 +01:00
parent f2c7eb5c3e
commit 5e10ed23a1
5 changed files with 14 additions and 18 deletions

View File

@@ -1,4 +1,4 @@
<h1 class='banner-title' data-module="track-error" data-error-type="Trying to send a letter that's too long" data-error-label="{{ upload_id }}">
<h1 class='banner-title' data-module="track-error" data-error-type="Trying to send a letter that's too long" data-error-label="service_id: {{ current_service.id }}">
Your letter is too long
</h1>
<p>

View File

@@ -2,9 +2,13 @@
{% call banner_wrapper(type='dangerous') %}
{% if message is string %}
<h1 class="banner-title">{{ message }}</h1>
<h1 class="banner-title">
{{ message }}
</h1>
{% else %}
<h1 class="banner-title">{{ message.title }}</h1>
<h1 class="banner-title" data-module="track-error" data-error-type="{{ error_code }}" data-error-label="precompiled letter validation failed for service_id: {{ current_service.id }}">
{{ message.title }}
</h1>
{% if message.detail %}
<p>
{{ message.detail | safe }}

View File

@@ -9,13 +9,8 @@
{% endblock %}
{% block maincolumn_content %}
{% if status == 'invalid' and error %}
{% call banner_wrapper(type='dangerous') %}
<h1 class="banner-title">{{ error.title }}</h1>
{% if error.detail %}
<p>{{ error.detail | safe }}</p>
{% endif %}
{% endcall %}
{% if status == 'invalid' and message %}
{% include "partials/check/letter-validation-failed-banner.html" %}
{% elif current_service.trial_mode %}
{% call banner_wrapper(type='dangerous') %}
{% with