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 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 {} extra_args = {'help': 1} if request.args.get('help', '0') != '0' else {}
back_link = url_for( if len(template.placeholders):
'.send_test', service_id=service_id, template_id=template.id, **extra_args 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: else:
back_link = url_for('.send_messages', service_id=service_id, template_id=template.id) 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 %} {% from "components/message-count-label.html" import message_count_label %}
{% block page_title %} {% block page_title %}
{{ "Error" if errors else "Check and confirm" }} GOV.UK Notify {{ "Error" if errors else "Preview" }} GOV.UK Notify
{% endblock %} {% endblock %}
{% block maincolumn_content %} {% block maincolumn_content %}
@@ -136,7 +136,7 @@
{% else %} {% else %}
<h1 class="heading-large"> <h1 class="heading-large">
Check and confirm Preview
</h1> </h1>
{% endif %} {% endif %}

View File

@@ -14,7 +14,7 @@
{% if request.args['help'] %} {% if request.args['help'] %}
<h1 class="heading-large">Example text message</h1> <h1 class="heading-large">Example text message</h1>
{% else %} {% else %}
<h1 class="heading-large">Send a test</h1> <h1 class="heading-large">Send yourself a test</h1>
{% endif %} {% endif %}
{% if 'sms' == template.template_type %} {% if 'sms' == template.template_type %}
@@ -54,8 +54,8 @@
{% endfor %} {% endfor %}
{% endcall %} {% endcall %}
{{ page_footer("Check and confirm", back_link=( {{ page_footer("Preview", back_link=(
url_for('.send_messages', service_id=current_service.id, template_id=template.id)) if not request.args['help'] else None url_for('.choose_template', service_id=current_service.id, template_type=template.template_type)) if not request.args['help'] else None
) }} ) }}
</form> </form>

View File

@@ -11,7 +11,7 @@
{% block maincolumn_content %} {% 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 %} {% if 'sms' == template.template_type %}
<div class="grid-row"> <div class="grid-row">
@@ -35,42 +35,34 @@
<div class="page-footer bottom-gutter"> <div class="page-footer bottom-gutter">
{{file_upload( {{file_upload(
form.file, form.file,
button_text='Upload a file of recipients', button_text='Choose a file'
alternate_link=url_for(".send_test", service_id=current_service.id, template_id=template.id),
alternate_link_text='send yourself a test'
)}} )}}
</div> </div>
<details role="group"> <h2 class="heading-medium">Your file needs to look like this example</h2>
<summary role="button" aria-controls="how-to-format-your-file" aria-expanded="false"> <div class="spreadsheet">
<span class="summary">See an example</span> {% call(item, row_number) list_table(
</summary> 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"> <h2 class="heading-medium">Accepted file formats</h2>
<div class="spreadsheet"> <ul class="list list-bullet">
{% call(item, row_number) list_table( <li>.<acronym title="Comma Separated Values">csv</acronym></li>
example, <li>.<acronym title="Comma Separated Values">tsv</acronym></li>
caption="Example", <li>Open Document Spreadsheet (.ods)</li>
caption_visible=False, <li>Microsoft Excel (.xls, .xlsx, .xlsm)</li>
field_headings=[''] + column_headings </p>
) %}
{{ 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>
{% endblock %} {% endblock %}

View File

@@ -24,9 +24,12 @@
<div class="message-use-links{% if show_title %}-with-title{% endif %}"> <div class="message-use-links{% if show_title %}-with-title{% endif %}">
{% if current_user.has_permissions(permissions=['send_texts', 'send_emails', 'send_letters']) %} {% 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"> <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> </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) %} {% 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> <a href="{{ url_for(".edit_service_template", service_id=current_service.id, template_id=template.id) }}">Edit template</a>
{% endif %} {% 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') today = datetime.today().date().strftime('%Y-%m-%d')
assert resp.status_code == 200 assert resp.status_code == 200
page = BeautifulSoup(resp.data.decode('utf-8'), 'html.parser') 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) mock_get_stats.assert_called_once_with(fake_uuid, today)