Merge pull request #2434 from alphagov/send-one-off-letter

Let people send one-off letters from the admin app
This commit is contained in:
Chris Hill-Scott
2018-11-02 09:33:04 +00:00
committed by GitHub
8 changed files with 245 additions and 63 deletions

View File

@@ -0,0 +1,8 @@
<h1 class='banner-title' data-module="track-error" data-error-type="Trying to send letters in trial mode" data-error-label="{{ upload_id }}">
You cant send
{{ 'this letter' if count_of_recipients == 1 else 'these letters' }}
</h1>
<p>
In <a href="{{ url_for('.using_notify') }}#trial-mode">trial mode</a> you
can only preview how your letters will look
</p>

View File

@@ -109,14 +109,13 @@
{% elif trying_to_send_letters_in_trial_mode %}
<h1 class='banner-title' data-module="track-error" data-error-type="Trying to send letters in trial mode" data-error-label="{{ upload_id }}">
You cant send
{{ 'this letter' if count_of_recipients == 1 else 'these letters' }}
</h1>
<p>
In <a href="{{ url_for('.using_notify') }}#trial-mode">trial mode</a> you
can only preview how your letters will look
</p>
<div class="bottom-gutter">
{% with
count_of_recipients=count_of_recipients
%}
{% include "partials/check/trying-to-send-letters-in-trial-mode.html" %}
{% endwith %}
</div>
{% elif recipients.more_rows_than_can_send %}

View File

@@ -7,7 +7,18 @@
{% endblock %}
{% block maincolumn_content %}
{% if error == 'not-allowed-to-send-to' %}
{% if template.template_type == 'letter' and current_service.trial_mode %}
{% set error = 'trial-mode-letters' %}
<div class="bottom-gutter">
{% call banner_wrapper(type='dangerous') %}
{% with
count_of_recipients=1
%}
{% include "partials/check/trying-to-send-letters-in-trial-mode.html" %}
{% endwith %}
{% endcall %}
</div>
{% elif error == 'not-allowed-to-send-to' %}
<div class="bottom-gutter">
{% call banner_wrapper(type='dangerous') %}
{% with
@@ -50,13 +61,12 @@
)}}" class='page-footer'>
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
{% if not error %}
{% if template.template_type != 'letter' or not request.args.from_test %}
<button type="submit" class="button">Send 1 {{ message_count_label(1, template.template_type, suffix='') }}</button>
{% else %}
<a href="{{ url_for('main.check_messages_preview', service_id=current_service.id, template_id=template.id, upload_id=upload_id, filetype='pdf') }}" download class="button">Download as a printable PDF</a>
{% endif %}
{% endif %}
<a href="{{ back_link }}" class="page-footer-back-link">Back</a>
{% if template.template_type == 'letter' %}
<a href="{{ url_for('main.check_notification_preview', service_id=current_service.id, template_id=template.id, filetype='pdf') }}" download class="page-footer-right-aligned-link">Download as a printable PDF</a>
{% endif %}
</form>
</div>

View File

@@ -16,14 +16,9 @@
<div class="grid-row">
{% if template.template_type == 'letter' %}
{% if current_user.has_permissions('send_messages', restrict_admin_usage=True) %}
<div class="column-half">
<a href="{{ url_for(".send_messages", service_id=current_service.id, template_id=template.id) }}" class="pill-separate-item">
Upload a list of addresses
</a>
</div>
<div class="column-half">
<a href="{{ url_for(".set_sender", service_id=current_service.id, template_id=template.id) }}" class="pill-separate-item">
Print a test letter
Send
</a>
</div>
{% endif %}