From 4d10eec1e26d83ab49ebd8b1722bb5f14e3d41a1 Mon Sep 17 00:00:00 2001
From: Chris Hill-Scott
Date: Thu, 7 Jan 2016 20:11:22 +0000
Subject: [PATCH] Rename `submit_form` component to `page_footer`
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Submit form was
- a confusing name in itself
- not descriptive, because it also has an optional ‘back’ link
This commit also puts this component in as many pages as possible, stripping
out any hard-coded buttons and links.
It replaces any usage of buttons for ‘back’, because these are links, not
buttons (ie they don’t change any data).
---
.../{submit-form.scss => page-footer.scss} | 8 +++-----
app/assets/stylesheets/main.scss | 2 +-
app/templates/admin_template.html | 2 --
app/templates/components/page-footer.html | 11 +++++++++++
app/templates/components/submit-form.html | 9 ---------
app/templates/views/api-keys.html | 8 +++++---
app/templates/views/check-sms.html | 15 ++++++---------
app/templates/views/edit-template.html | 9 ++++++---
app/templates/views/email-not-received.html | 3 ++-
app/templates/views/manage-users.html | 8 +++++---
app/templates/views/notification.html | 9 +++++----
app/templates/views/register.html | 5 ++---
app/templates/views/send-email.html | 2 --
app/templates/views/send-sms.html | 7 ++-----
app/templates/views/service-settings/confirm.html | 4 ++--
app/templates/views/service-settings/delete.html | 4 ++--
app/templates/views/service-settings/name.html | 4 ++--
.../service-settings/request-to-go-live.html | 6 +++---
app/templates/views/service-settings/status.html | 4 ++--
app/templates/views/signin.html | 5 ++---
app/templates/views/text-not-received.html | 5 ++---
app/templates/views/two-factor.html | 7 +++----
app/templates/views/user-profile.html | 7 +++++--
app/templates/views/verify.html | 5 ++---
24 files changed, 73 insertions(+), 76 deletions(-)
rename app/assets/stylesheets/components/{submit-form.scss => page-footer.scss} (55%)
create mode 100644 app/templates/components/page-footer.html
delete mode 100644 app/templates/components/submit-form.html
diff --git a/app/assets/stylesheets/components/submit-form.scss b/app/assets/stylesheets/components/page-footer.scss
similarity index 55%
rename from app/assets/stylesheets/components/submit-form.scss
rename to app/assets/stylesheets/components/page-footer.scss
index 8b98d2905..53a94f75b 100644
--- a/app/assets/stylesheets/components/submit-form.scss
+++ b/app/assets/stylesheets/components/page-footer.scss
@@ -1,12 +1,10 @@
-.submit-form {
+.page-footer {
margin-bottom: 50px;
&-back-link {
- @include button($grey-1);
- padding: 0.52632em 0.78947em 0.26316em 0.78947em;
- @include inline-block;
- margin-left: 5px;
+ display: block;
+ margin-top: $gutter;
}
.button {}
diff --git a/app/assets/stylesheets/main.scss b/app/assets/stylesheets/main.scss
index ce2093c01..9beb5dd10 100644
--- a/app/assets/stylesheets/main.scss
+++ b/app/assets/stylesheets/main.scss
@@ -33,7 +33,7 @@
@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';
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/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 4627b6204..000000000
--- a/app/templates/components/submit-form.html
+++ /dev/null
@@ -1,9 +0,0 @@
-{% macro submit_form(button_text, back_link=False, back_link_text="Back", destructive=False) %}
-
-{% endmacro %}
diff --git a/app/templates/views/api-keys.html b/app/templates/views/api-keys.html
index dd1c7678d..c03b117bb 100644
--- a/app/templates/views/api-keys.html
+++ b/app/templates/views/api-keys.html
@@ -1,4 +1,5 @@
{% extends "withnav_template.html" %}
+{% from "components/page-footer.html" import page_footer %}
{% block page_title %}
GOV.UK Notify | API keys and documentation
@@ -10,8 +11,9 @@ GOV.UK Notify | API keys and documentation
Here's where developers can access information about the API and access keys
- Back to dashboard
-
-
+ {{ page_footer(
+ back_link=url_for('.dashboard'),
+ back_link_text='Back to dashboard'
+ ) }}
{% endblock %}
diff --git a/app/templates/views/check-sms.html b/app/templates/views/check-sms.html
index b3277f09e..d933b890b 100644
--- a/app/templates/views/check-sms.html
+++ b/app/templates/views/check-sms.html
@@ -2,7 +2,7 @@
{% from "components/sms-message.html" import sms_message %}
{% from "components/table.html" import table, field %}
{% from "components/placeholder.html" import placeholder %}
-{% from "components/submit-form.html" import submit_form %}
+{% from "components/page-footer.html" import page_footer %}
{% block page_title %}
GOV.UK Notify | Send text messages
@@ -17,9 +17,8 @@
- {{ submit_form(
- "Send {} text messages".format(number_of_recipients),
- url_for(".sendsms")
+ {{ page_footer(
+ button_text = "Send {} text messages".format(number_of_recipients),
+ back_link = url_for(".sendsms")
) }}
-
-
{% endblock %}
diff --git a/app/templates/views/edit-template.html b/app/templates/views/edit-template.html
index b17b5b64c..46615c78e 100644
--- a/app/templates/views/edit-template.html
+++ b/app/templates/views/edit-template.html
@@ -1,6 +1,6 @@
{% extends "withnav_template.html" %}
{% from "components/textbox.html" import textbox %}
-{% from "components/submit-form.html" import submit_form %}
+{% from "components/page-footer.html" import page_footer %}
{% block page_title %}
GOV.UK Notify | Edit template
@@ -13,9 +13,12 @@ GOV.UK Notify | Edit template
- Back to manage templates
{% endblock %}
diff --git a/app/templates/views/email-not-received.html b/app/templates/views/email-not-received.html
index 24bdcf33b..9f7960383 100644
--- a/app/templates/views/email-not-received.html
+++ b/app/templates/views/email-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
@@ -18,8 +19,8 @@ GOV.UK Notify
{{ render_field(form.email_address, class='form-control-2-3') }}
Your email address must end in .gov.uk
-
+ {{ page_footer('Resend confirmation code') }}
diff --git a/app/templates/views/manage-users.html b/app/templates/views/manage-users.html
index f60a6c53b..c0211affa 100644
--- a/app/templates/views/manage-users.html
+++ b/app/templates/views/manage-users.html
@@ -1,4 +1,5 @@
{% extends "withnav_template.html" %}
+{% from "components/page-footer.html" import page_footer %}
{% block page_title %}
GOV.UK Notify | Manage users
@@ -10,8 +11,9 @@ GOV.UK Notify | Manage users
Here's where you can add or remove users of a service.
- Back to dashboard
-
-
+ {{ 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 %}
-
Send email
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/confirm.html b/app/templates/views/service-settings/confirm.html
index 5216f3085..a6a08441a 100644
--- a/app/templates/views/service-settings/confirm.html
+++ b/app/templates/views/service-settings/confirm.html
@@ -1,6 +1,6 @@
{% extends "withnav_template.html" %}
{% from "components/textbox.html" import textbox %}
-{% from "components/submit-form.html" import submit_form %}
+{% from "components/page-footer.html" import page_footer %}
{% block page_title %}
GOV.UK Notify | Service settings
@@ -15,7 +15,7 @@ GOV.UK Notify | Service settings
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 settings
Here's where users can update their profile, password etc.
- Back to dashboard
-
+ {{ 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") }}