diff --git a/app/assets/stylesheets/components/browse-list.scss b/app/assets/stylesheets/components/browse-list.scss new file mode 100644 index 000000000..abb95ecc0 --- /dev/null +++ b/app/assets/stylesheets/components/browse-list.scss @@ -0,0 +1,27 @@ +.browse-list { + + margin-bottom: $gutter; + + &-item { + list-style: none; + margin-bottom: $gutter-two-thirds; + } + + a.browse-list-link { + + @include bold-24; + + &-destructive, + &-destructive:visited { + @include bold-24; + color: $error-colour; + } + + } + + &-hint { + @include core-19; + margin-top: 5px; + } + +} diff --git a/app/assets/stylesheets/components/page-footer.scss b/app/assets/stylesheets/components/page-footer.scss new file mode 100644 index 000000000..53a94f75b --- /dev/null +++ b/app/assets/stylesheets/components/page-footer.scss @@ -0,0 +1,17 @@ +.page-footer { + + margin-bottom: 50px; + + &-back-link { + display: block; + margin-top: $gutter; + } + + .button {} + + .button-destructive { + @include button($error-colour); + padding: 0.52632em 0.78947em 0.26316em 0.78947em; + } + +} diff --git a/app/assets/stylesheets/components/submit-form.scss b/app/assets/stylesheets/components/submit-form.scss deleted file mode 100644 index 041c71773..000000000 --- a/app/assets/stylesheets/components/submit-form.scss +++ /dev/null @@ -1,12 +0,0 @@ -.submit-form { - - margin-bottom: 50px; - - &-back-link { - @include button($grey-1); - padding: 0.52632em 0.78947em 0.26316em 0.78947em; - @include inline-block; - margin-left: 5px; - } - -} diff --git a/app/assets/stylesheets/main.scss b/app/assets/stylesheets/main.scss index ece58780a..9beb5dd10 100644 --- a/app/assets/stylesheets/main.scss +++ b/app/assets/stylesheets/main.scss @@ -33,12 +33,13 @@ @import 'components/template-picker'; @import 'components/placeholder'; @import 'components/sms-message'; -@import 'components/submit-form'; +@import 'components/page-footer'; @import 'components/table'; @import 'components/navigation'; @import 'components/big-number'; @import 'components/banner'; @import 'components/textbox'; +@import 'components/browse-list'; @import 'views/job'; diff --git a/app/main/__init__.py b/app/main/__init__.py index 93354853b..9354e06db 100644 --- a/app/main/__init__.py +++ b/app/main/__init__.py @@ -5,5 +5,5 @@ main = Blueprint('main', __name__) from app.main.views import ( index, sign_in, sign_out, register, two_factor, verify, sms, add_service, - code_not_received, jobs, dashboard, templates + code_not_received, jobs, dashboard, templates, service_settings ) diff --git a/app/main/views/index.py b/app/main/views/index.py index 9c9ef1f6c..dec87cf89 100644 --- a/app/main/views/index.py +++ b/app/main/views/index.py @@ -54,11 +54,6 @@ def manageusers(): return render_template('views/manage-users.html') -@main.route("/service-settings") -def servicesettings(): - return render_template('views/service-settings.html') - - @main.route("/api-keys") def apikeys(): return render_template('views/api-keys.html') diff --git a/app/main/views/service_settings.py b/app/main/views/service_settings.py new file mode 100644 index 000000000..6553a876e --- /dev/null +++ b/app/main/views/service_settings.py @@ -0,0 +1,97 @@ +from flask import render_template, redirect, request, url_for, abort +from flask_login import login_required + +from app.main import main + +service = { + 'name': 'Service name', + 'live': False, + 'active': True +} + + +@main.route("/service-settings") +def service_settings(): + return render_template( + 'views/service-settings.html', + service=service + ) + + +@main.route("/service-settings/name", methods=['GET', 'POST']) +def name(): + if request.method == 'GET': + return render_template( + 'views/service-settings/name.html', + service=service + ) + elif request.method == 'POST': + return redirect(url_for('.confirm_name_change')) + + +@main.route("/service-settings/name/confirm", methods=['GET', 'POST']) +def confirm_name_change(): + if request.method == 'GET': + return render_template( + 'views/service-settings/confirm.html', + heading='Change your service name' + ) + elif request.method == 'POST': + return redirect(url_for('.service_settings')) + + +@main.route("/service-settings/request-to-go-live", methods=['GET', 'POST']) +def request_to_go_live(): + if request.method == 'GET': + return render_template( + 'views/service-settings/request-to-go-live.html', + service=service + ) + elif request.method == 'POST': + return redirect(url_for('.service_settings')) + + +@main.route("/service-settings/status", methods=['GET', 'POST']) +def status(): + if request.method == 'GET': + return render_template( + 'views/service-settings/status.html', + service=service + ) + elif request.method == 'POST': + return redirect(url_for('.confirm_status_change')) + + +@main.route("/service-settings/status/confirm", methods=['GET', 'POST']) +def confirm_status_change(): + if request.method == 'GET': + return render_template( + 'views/service-settings/confirm.html', + heading='Turn off all outgoing notifications', + destructive=True + ) + elif request.method == 'POST': + return redirect(url_for('.service_settings')) + + +@main.route("/service-settings/delete", methods=['GET', 'POST']) +def delete(): + if request.method == 'GET': + return render_template( + 'views/service-settings/delete.html', + service=service + ) + elif request.method == 'POST': + return redirect(url_for('.confirm_delete')) + + +@main.route("/service-settings/delete/confirm", methods=['GET', 'POST']) +def confirm_delete(): + if request.method == 'GET': + return render_template( + 'views/service-settings/confirm.html', + heading='Delete this service from Notify', + destructive=True + ) + elif request.method == 'POST': + return redirect(url_for('.dashboard')) diff --git a/app/templates/admin_template.html b/app/templates/admin_template.html index 63cff92ce..4613ca442 100644 --- a/app/templates/admin_template.html +++ b/app/templates/admin_template.html @@ -20,11 +20,9 @@ GOV.UK Notify admin {% endblock %} - {% block cookie_message %} {% endblock %} - {% block inside_header %} {% endblock %} {% block header_class %}with-proposition{% endblock %} diff --git a/app/templates/components/browse-list.html b/app/templates/components/browse-list.html new file mode 100644 index 000000000..d59e9ae37 --- /dev/null +++ b/app/templates/components/browse-list.html @@ -0,0 +1,20 @@ +{% macro browse_list(items) %} + {% if items %} + + {% endif %} +{% endmacro %} diff --git a/app/templates/components/page-footer.html b/app/templates/components/page-footer.html new file mode 100644 index 000000000..333755449 --- /dev/null +++ b/app/templates/components/page-footer.html @@ -0,0 +1,11 @@ +{% macro page_footer(button_text=None, back_link=False, back_link_text="Back", destructive=False) %} +
+{% endmacro %} diff --git a/app/templates/components/submit-form.html b/app/templates/components/submit-form.html deleted file mode 100644 index 012d0a580..000000000 --- a/app/templates/components/submit-form.html +++ /dev/null @@ -1,9 +0,0 @@ -{% macro submit_form(button_text, back_link=False) %} -+ {{ empty_message }} +
+ {% endif %} +{%- endmacro %} + +{% macro row() -%} +Here's where you can add or remove users of a service.
- - - + {{ page_footer( + back_link = url_for('.dashboard'), + back_link_text = 'Back to dashboard' + ) }} {% endblock %} diff --git a/app/templates/views/notification.html b/app/templates/views/notification.html index 1dcb034a2..1e771062a 100644 --- a/app/templates/views/notification.html +++ b/app/templates/views/notification.html @@ -1,5 +1,6 @@ {% extends "withnav_template.html" %} {% from "components/sms-message.html" import sms_message, message_status %} +{% from "components/page-footer.html" import page_footer %} {% block page_title %} GOV.UK Notify | Notifications activity @@ -21,9 +22,9 @@ GOV.UK Notify | Notifications activity -- View other notifications in this job -
- + {{ page_footer( + back_link = url_for('.showjob'), + back_link_text = 'View other messages in this job' + ) }} {% endblock %} diff --git a/app/templates/views/register.html b/app/templates/views/register.html index 9de86a373..f640ac116 100644 --- a/app/templates/views/register.html +++ b/app/templates/views/register.html @@ -1,4 +1,5 @@ {% extends "admin_template.html" %} +{% from "components/page-footer.html" import page_footer %} {% block page_title %} GOV.UK Notify | Create an account @@ -21,9 +22,7 @@ GOV.UK Notify | Create an account {{ render_field(form.mobile_number, class='form-control-2-3') }} {{ render_field(form.password, class='form-control-2-3') }} Your password must have at least 10 characters -- -
+ {{ page_footer("Continue") }} diff --git a/app/templates/views/send-email.html b/app/templates/views/send-email.html index e5911ec4c..94edfab93 100644 --- a/app/templates/views/send-email.html +++ b/app/templates/views/send-email.html @@ -6,7 +6,6 @@ GOV.UK Notify | Send email {% block maincolumn_content %} -This page will be where we construct email messages
@@ -15,5 +14,4 @@ GOV.UK Notify | Send email Continue - {% endblock %} diff --git a/app/templates/views/send-sms.html b/app/templates/views/send-sms.html index 75d81ffeb..c413b12db 100644 --- a/app/templates/views/send-sms.html +++ b/app/templates/views/send-sms.html @@ -1,5 +1,6 @@ {% extends "withnav_template.html" %} {% from "components/sms-message.html" import sms_message %} +{% from "components/page-footer.html" import page_footer %} {% block page_title %} GOV.UK Notify | Send text messages @@ -39,11 +40,7 @@ - -- - -
+ {{ page_footer("Continue") }} diff --git a/app/templates/views/service-settings.html b/app/templates/views/service-settings.html index e53fb9efe..305db1da1 100644 --- a/app/templates/views/service-settings.html +++ b/app/templates/views/service-settings.html @@ -1,17 +1,39 @@ {% extends "withnav_template.html" %} +{% from "components/browse-list.html" import browse_list %} {% block page_title %} -GOV.UK Notify | Service settings + GOV.UK Notify | Service settings {% endblock %} {% block maincolumn_content %} -Here's where users can update their service profile.
- - - ++ This can’t be undone. You will lose: +
+ ++ Your service name ({{ service.name }}) is included in every sent notification +
+ + ++ A live service can send messages to any phone number or email address. +
+ ++ First you need to: +
+ ++ It takes a few working days for your request to be approved. +
+ + + ++ You’ll still be able to send notifications to yourself by uploading a + CSV file. +
+ ++ You can start sending notifications again when you’re ready. +
+ + + +- -
+ {{ page_footer("Continue") }} diff --git a/app/templates/views/text-not-received.html b/app/templates/views/text-not-received.html index a37c27cdd..529193617 100644 --- a/app/templates/views/text-not-received.html +++ b/app/templates/views/text-not-received.html @@ -1,4 +1,5 @@ {% extends "admin_template.html" %} +{% from "components/page-footer.html" import page_footer %} {% block page_title %} GOV.UK Notify @@ -15,9 +16,7 @@ GOV.UK Notify diff --git a/app/templates/views/two-factor.html b/app/templates/views/two-factor.html index 119836381..46724c617 100644 --- a/app/templates/views/two-factor.html +++ b/app/templates/views/two-factor.html @@ -1,4 +1,5 @@ {% extends "admin_template.html" %} +{% from "components/page-footer.html" import page_footer %} {% block page_title %} GOV.UK Notify | Text verification @@ -16,10 +17,8 @@ GOV.UK Notify | Text verification diff --git a/app/templates/views/user-profile.html b/app/templates/views/user-profile.html index 12f322314..3384c9ba5 100644 --- a/app/templates/views/user-profile.html +++ b/app/templates/views/user-profile.html @@ -1,4 +1,5 @@ {% extends "withnav_template.html" %} +{% from "components/page-footer.html" import page_footer %} {% block page_title %} GOV.UK Notify | User settings @@ -10,7 +11,9 @@ GOV.UK Notify | User settingsHere's where users can update their profile, password etc.
- - + {{ page_footer( + back_link = url_for('.dashboard'), + back_link_text = 'Back to dashboard' + ) }} {% endblock %} diff --git a/app/templates/views/verify.html b/app/templates/views/verify.html index 1f22ea29e..94e594d1a 100644 --- a/app/templates/views/verify.html +++ b/app/templates/views/verify.html @@ -1,4 +1,5 @@ {% extends "admin_template.html" %} +{% from "components/page-footer.html" import page_footer %} {% block page_title %} GOV.UK Notify | Confirm email address and mobile number @@ -18,9 +19,7 @@ GOV.UK Notify | Confirm email address and mobile number I haven't received an email {{ render_field(form.sms_code, class='form-control-1-4') }} I haven't received a text -- -
+ {{ page_footer("Continue") }} diff --git a/tests/app/main/views/test_service_settings.py b/tests/app/main/views/test_service_settings.py new file mode 100644 index 000000000..0628cb159 --- /dev/null +++ b/tests/app/main/views/test_service_settings.py @@ -0,0 +1,103 @@ +def test_should_show_overview(notifications_admin): + response = notifications_admin.test_client().get('/service-settings') + + assert response.status_code == 200 + assert 'Service settings' in response.get_data(as_text=True) + + +def test_should_show_service_name(notifications_admin): + response = notifications_admin.test_client().get('/service-settings/name') + + assert response.status_code == 200 + assert 'Change your service name' in response.get_data(as_text=True) + + +def test_should_redirect_after_change_service_name(notifications_admin): + response = notifications_admin.test_client().post('/service-settings/request-to-go-live') + + assert response.status_code == 302 + assert 'http://localhost/service-settings' == response.location + + +def test_should_show_service_name_confirmation(notifications_admin): + response = notifications_admin.test_client().get('/service-settings/name/confirm') + + assert response.status_code == 200 + assert 'Change your service name' in response.get_data(as_text=True) + + +def test_should_redirect_after_service_name_confirmation(notifications_admin): + response = notifications_admin.test_client().post('/service-settings/name/confirm') + + assert response.status_code == 302 + assert 'http://localhost/service-settings' == response.location + + +def test_should_show_request_to_go_live(notifications_admin): + response = notifications_admin.test_client().get('/service-settings/request-to-go-live') + + assert response.status_code == 200 + assert 'Request to go live' in response.get_data(as_text=True) + + +def test_should_redirect_after_request_to_go_live(notifications_admin): + response = notifications_admin.test_client().post('/service-settings/request-to-go-live') + + assert response.status_code == 302 + assert 'http://localhost/service-settings' == response.location + + +def test_should_show_status_page(notifications_admin): + response = notifications_admin.test_client().get('/service-settings/status') + + assert response.status_code == 200 + assert 'Turn off all outgoing notifications' in response.get_data(as_text=True) + + +def test_should_show_redirect_after_status_change(notifications_admin): + response = notifications_admin.test_client().post('/service-settings/status') + + assert response.status_code == 302 + assert 'http://localhost/service-settings/status/confirm' == response.location + + +def test_should_show_status_confirmation(notifications_admin): + response = notifications_admin.test_client().get('/service-settings/status/confirm') + + assert response.status_code == 200 + assert 'Turn off all outgoing notifications' in response.get_data(as_text=True) + + +def test_should_redirect_after_status_confirmation(notifications_admin): + response = notifications_admin.test_client().post('/service-settings/status/confirm') + + assert response.status_code == 302 + assert 'http://localhost/service-settings' == response.location + + +def test_should_show_delete_page(notifications_admin): + response = notifications_admin.test_client().get('/service-settings/delete') + + assert response.status_code == 200 + assert 'Delete this service from Notify' in response.get_data(as_text=True) + + +def test_should_show_redirect_after_deleting_service(notifications_admin): + response = notifications_admin.test_client().post('/service-settings/delete') + + assert response.status_code == 302 + assert 'http://localhost/service-settings/delete/confirm' == response.location + + +def test_should_show_delete_confirmation(notifications_admin): + response = notifications_admin.test_client().get('/service-settings/delete/confirm') + + assert response.status_code == 200 + assert 'Delete this service from Notify' in response.get_data(as_text=True) + + +def test_should_redirect_delete_confirmation(notifications_admin): + response = notifications_admin.test_client().post('/service-settings/delete/confirm') + + assert response.status_code == 302 + assert 'http://localhost/dashboard' == response.location