Move ‘send test’ link back to template page

This changes it back to how it was when we first introduced this
feature:
https://github.com/alphagov/notifications-admin/pull/181

It’s kind of lost on the page where you upload a file, which is a shame
because it’s a good teaching aid.
This commit is contained in:
Chris Hill-Scott
2016-07-01 07:04:55 +01:00
parent facfb98bb3
commit 46f8dd3c79
4 changed files with 15 additions and 9 deletions

View File

@@ -242,11 +242,16 @@ def check_messages(service_id, template_type, upload_id):
) if current_service['restricted'] else None
)
if request.args.get('from_test') and len(template.placeholders):
if request.args.get('from_test'):
extra_args = {'help': 1} if request.args.get('help', '0') != '0' else {}
back_link = url_for(
'.send_test', service_id=service_id, template_id=template.id, **extra_args
)
if len(template.placeholders):
back_link = url_for(
'.send_test', service_id=service_id, template_id=template.id, **extra_args
)
else:
back_link = url_for(
'.choose_template', service_id=service_id, template_type=template.template_type, **extra_args
)
else:
back_link = url_for('.send_messages', service_id=service_id, template_id=template.id)

View File

@@ -14,7 +14,7 @@
{% if request.args['help'] %}
<h1 class="heading-large">Example text message</h1>
{% else %}
<h1 class="heading-large">Send a test</h1>
<h1 class="heading-large">Send yourself a test</h1>
{% endif %}
{% if 'sms' == template.template_type %}

View File

@@ -35,9 +35,7 @@
<div class="page-footer bottom-gutter">
{{file_upload(
form.file,
button_text='Upload a file of recipients',
alternate_link=url_for(".send_test", service_id=current_service.id, template_id=template.id),
alternate_link_text='send yourself a test'
button_text='Upload a file of recipients'
)}}
</div>

View File

@@ -26,7 +26,10 @@
<a href="{{ url_for(".send_messages", service_id=current_service.id, template_id=template.id) }}" class="primary">
Send {{ 'text messages' if 'sms' == template.template_type else 'emails' }}
</a>
{% endif %}
<a href="{{ url_for(".send_test", service_id=current_service.id, template_id=template.id) }}">
Send yourself a test
</a>
{% endif %}
{% if current_user.has_permissions(permissions=['manage_templates'], admin_override=True) %}
<a href="{{ url_for(".edit_service_template", service_id=current_service.id, template_id=template.id) }}">Edit template</a>
{% endif %}