Merge pull request #741 from alphagov/revert-template-actions

Revert questionable design decisions in send messages flow
This commit is contained in:
Chris Hill-Scott
2016-07-05 16:58:20 +01:00
committed by GitHub
7 changed files with 46 additions and 50 deletions

View File

@@ -29,10 +29,6 @@
}
.primary {
@include bold-19;
}
}
}

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

@@ -9,7 +9,7 @@
{% from "components/message-count-label.html" import message_count_label %}
{% block page_title %}
{{ "Error" if errors else "Check and confirm" }} GOV.UK Notify
{{ "Error" if errors else "Preview" }} GOV.UK Notify
{% endblock %}
{% block maincolumn_content %}
@@ -136,7 +136,7 @@
{% else %}
<h1 class="heading-large">
Check and confirm
Preview
</h1>
{% endif %}

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 %}
@@ -54,8 +54,8 @@
{% endfor %}
{% endcall %}
{{ page_footer("Check and confirm", back_link=(
url_for('.send_messages', service_id=current_service.id, template_id=template.id)) if not request.args['help'] else None
{{ page_footer("Preview", back_link=(
url_for('.choose_template', service_id=current_service.id, template_type=template.template_type)) if not request.args['help'] else None
) }}
</form>

View File

@@ -11,7 +11,7 @@
{% block maincolumn_content %}
<h1 class="heading-large">Send {{ 'text messages' if 'sms' == template.template_type else 'emails' }}</h1>
<h1 class="heading-large">Upload recipients</h1>
{% if 'sms' == template.template_type %}
<div class="grid-row">
@@ -35,42 +35,34 @@
<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='Choose a file'
)}}
</div>
<details role="group">
<summary role="button" aria-controls="how-to-format-your-file" aria-expanded="false">
<span class="summary">See an example</span>
</summary>
<h2 class="heading-medium">Your file needs to look like this example</h2>
<div class="spreadsheet">
{% call(item, row_number) list_table(
example,
caption="Example",
caption_visible=False,
field_headings=[''] + column_headings
) %}
{{ index_field(row_number - 1) }}
{% for column in item %}
{{ text_field(column) }}
{% endfor %}
{% endcall %}
</div>
<p class="table-show-more-link">
<a href="{{ url_for('.get_example_csv', service_id=current_service.id, template_id=template.id) }}">Download this example</a>
</p>
<div id="how-to-format-your-file" aria-hidden="true">
<div class="spreadsheet">
{% call(item, row_number) list_table(
example,
caption="Example",
caption_visible=False,
field_headings=[''] + column_headings
) %}
{{ index_field(row_number - 1) }}
{% for column in item %}
{{ text_field(column) }}
{% endfor %}
{% endcall %}
</div>
<p class="table-show-more-link">
<a href="{{ url_for('.get_example_csv', service_id=current_service.id, template_id=template.id) }}">Download this example</a>
</p>
<p>Save the file as</p>
<ul class="list list-bullet">
<li>.<acronym title="Comma Separated Values">csv</acronym></li>
<li>.<acronym title="Comma Separated Values">tsv</acronym></li>
<li>Open Document Spreadsheet (.ods)</li>
<li>or Microsoft Excel (.xls, .xlsx, .xlsm)</li>
</p>
</div>
</details>
<h2 class="heading-medium">Accepted file formats</h2>
<ul class="list list-bullet">
<li>.<acronym title="Comma Separated Values">csv</acronym></li>
<li>.<acronym title="Comma Separated Values">tsv</acronym></li>
<li>Open Document Spreadsheet (.ods)</li>
<li>Microsoft Excel (.xls, .xlsx, .xlsm)</li>
</p>
{% endblock %}

View File

@@ -24,9 +24,12 @@
<div class="message-use-links{% if show_title %}-with-title{% endif %}">
{% if current_user.has_permissions(permissions=['send_texts', 'send_emails', 'send_letters']) %}
<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' }}
Upload recipients
</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 %}

View File

@@ -694,7 +694,7 @@ def test_send_and_check_page_renders_if_no_statistics(
today = datetime.today().date().strftime('%Y-%m-%d')
assert resp.status_code == 200
page = BeautifulSoup(resp.data.decode('utf-8'), 'html.parser')
assert page.h1.text.strip() == 'Check and confirm'
assert page.h1.text.strip() == 'Preview'
mock_get_stats.assert_called_once_with(fake_uuid, today)