mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-26 08:09:51 -04:00
Make first page of ‘send texts’ use links not form
This doesn’t need to be a form—it’s not changing any data. And having the primary action on the page as ‘Use this template’ it makes it clear what the page is for.
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
|
||||
.sms-message-name {
|
||||
@include bold-19;
|
||||
margin: 30px 0 10px 0;
|
||||
margin: 20px 0 10px 0;
|
||||
}
|
||||
|
||||
.sms-message-picker {
|
||||
@@ -61,3 +61,8 @@ label.sms-message-option {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.sms-message-use-link {
|
||||
margin-top: 70px;
|
||||
@include bold-19;
|
||||
}
|
||||
|
||||
@@ -32,13 +32,8 @@ from app.main.utils import (
|
||||
)
|
||||
|
||||
|
||||
@main.route("/services/<service_id>/sms/send", methods=['GET', 'POST'])
|
||||
@main.route("/services/<service_id>/sms/send", methods=['GET'])
|
||||
def choose_sms_template(service_id):
|
||||
if request.method == 'POST':
|
||||
return redirect(url_for('.send_sms',
|
||||
service_id=service_id,
|
||||
template_id=request.form.get('template')))
|
||||
|
||||
try:
|
||||
templates = templates_dao.get_service_templates(service_id)['data']
|
||||
except HTTPError as e:
|
||||
|
||||
@@ -14,15 +14,18 @@
|
||||
<form method="POST" enctype="multipart/form-data">
|
||||
|
||||
{% if templates %}
|
||||
<fieldset class='form-group'>
|
||||
<div class="grid-row">
|
||||
{% for template in templates %}
|
||||
{{ sms_message(
|
||||
template.content, name=template.name, input_name='template', input_index=template.id
|
||||
) }}
|
||||
<div class="column-two-thirds">
|
||||
{{ sms_message(template.content, name=template.name) }}
|
||||
</div>
|
||||
<div class="column-one-third">
|
||||
<div class="sms-message-use-link">
|
||||
<a href="{{ url_for(".send_sms", service_id=service_id, template_id=template.id) }}">Use this template</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</fieldset>
|
||||
|
||||
{{ page_footer("Continue") }}
|
||||
</div>
|
||||
{% else %}
|
||||
{{ banner(
|
||||
'<a href="{}">Add a text message template</a> to start sending messages'.format(
|
||||
|
||||
@@ -23,24 +23,6 @@ def test_choose_sms_template(app_,
|
||||
assert 'template two content' in content
|
||||
|
||||
|
||||
def test_choose_sms_template_redirects(app_,
|
||||
api_user_active,
|
||||
mock_get_user,
|
||||
mock_get_service_templates,
|
||||
mock_check_verify_code,
|
||||
mock_get_service_template):
|
||||
with app_.test_request_context():
|
||||
with app_.test_client() as client:
|
||||
client.login(api_user_active)
|
||||
response = client.post(
|
||||
url_for('main.choose_sms_template', service_id=12345),
|
||||
data={'template': '54321'}
|
||||
)
|
||||
|
||||
assert response.status_code == 302
|
||||
assert response.location == url_for('main.send_sms', service_id=12345, template_id=54321, _external=True)
|
||||
|
||||
|
||||
def test_upload_empty_csvfile_returns_to_upload_page(app_,
|
||||
api_user_active,
|
||||
mock_get_user,
|
||||
|
||||
@@ -9,7 +9,8 @@ def test_should_return_list_of_all_templates(app_,
|
||||
mock_get_service_templates,
|
||||
mock_get_user,
|
||||
mock_get_user_by_email,
|
||||
mock_login):
|
||||
mock_login,
|
||||
mock_get_jobs):
|
||||
with app_.test_request_context():
|
||||
with app_.test_client() as client:
|
||||
client.login(api_user_active)
|
||||
|
||||
Reference in New Issue
Block a user