aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2019-12-09 10:47:41 +0000
committerMatthew Somerville <matthew@mysociety.org>2019-12-09 10:47:41 +0000
commit4c7f66b2884c629c9f42250cdd878035990f88cb (patch)
treeeb80ad600a5d7d6ba509afbe8df9aa93f69a0ba1
parent2e9e82dfb57b972d1351ecef86687a0d067598b1 (diff)
parent1f43fc96b8c235c225eaa6be057663e11fbdf592 (diff)
Merge branch 'staging-banner-email'
-rw-r--r--CHANGELOG.md1
-rw-r--r--perllib/FixMyStreet/App.pm1
-rw-r--r--perllib/FixMyStreet/Email.pm1
-rw-r--r--templates/email/default/_email_settings.html2
-rw-r--r--templates/email/default/_email_top.html11
-rw-r--r--templates/web/base/debug_footer.html40
-rw-r--r--templates/web/base/debug_header.html8
-rw-r--r--templates/web/base/header.html3
-rw-r--r--templates/web/fiksgatami/header.html4
-rw-r--r--templates/web/fiksgatami/nn/footer.html1
-rw-r--r--templates/web/hart/header.html4
-rw-r--r--templates/web/oxfordshire/header.html4
-rw-r--r--templates/web/stevenage/header.html4
-rw-r--r--templates/web/zurich/header.html4
-rw-r--r--web/cobrands/sass/_base.scss13
15 files changed, 44 insertions, 57 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c74c48f2a..441505100 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -63,6 +63,7 @@
- Make contact edit note optional on staging sites.
- Store email addresses report sent to on the report.
- Add configuration for setting Content-Security-Policy header.
+ - Add banner on staging website/emails.
- Open311 improvements:
- Support use of 'private' service definition <keywords> to mark
reports made in that category private. #2488
diff --git a/perllib/FixMyStreet/App.pm b/perllib/FixMyStreet/App.pm
index 5f0518920..88ead39bc 100644
--- a/perllib/FixMyStreet/App.pm
+++ b/perllib/FixMyStreet/App.pm
@@ -373,6 +373,7 @@ sub construct_email {
};
$vars->{site_name} = Utils::trim_text($c->view('EmailText')->render($c, 'site-name.txt', $vars));
$vars->{signature} = $c->view('EmailText')->render($c, 'signature.txt', $vars);
+ $vars->{staging} = FixMyStreet->config('STAGING_SITE');
return if FixMyStreet::Email::is_abuser($c->model('DB')->schema, $vars->{to});
diff --git a/perllib/FixMyStreet/Email.pm b/perllib/FixMyStreet/Email.pm
index 18aff9d90..65b537d85 100644
--- a/perllib/FixMyStreet/Email.pm
+++ b/perllib/FixMyStreet/Email.pm
@@ -173,6 +173,7 @@ sub send_cron {
});
$vars->{signature} = _render_template($tt, 'signature.txt', $vars);
$vars->{site_name} = Utils::trim_text(_render_template($tt, 'site-name.txt', $vars));
+ $vars->{staging} = FixMyStreet->config('STAGING_SITE');
$hdrs->{_body_} = _render_template($tt, $template, $vars);
if ($html_template) {
diff --git a/templates/email/default/_email_settings.html b/templates/email/default/_email_settings.html
index 180adbbeb..5bc7faa66 100644
--- a/templates/email/default/_email_settings.html
+++ b/templates/email/default/_email_settings.html
@@ -83,6 +83,8 @@ wrapper_min_width = 520 # in pixels without "px" suffix
hint_min_width = wrapper_min_width - (column_padding * 2)
hint_style = "min-width: ${ hint_min_width }px; padding: ${ column_padding }px; color: $body_text_color; font-size: 12px; line-height: 18px;"
+warning_style = "min-width: ${ hint_min_width }x; padding: ${ column_padding }px; background-color: $color_red_dark; color: $color_white;"
+
header_style = "padding: $header_padding; background: $header_background_color; color: $header_text_color;"
only_column_style = "padding: ${ column_padding }px; vertical-align: top; background-color: $primary_column_background_color; color: $primary_column_text_color;"
diff --git a/templates/email/default/_email_top.html b/templates/email/default/_email_top.html
index c4622818d..3bde242a0 100644
--- a/templates/email/default/_email_top.html
+++ b/templates/email/default/_email_top.html
@@ -47,6 +47,17 @@
</style>
</head>
<body style="[% body_style %]">
+[% IF staging AND NOT for_rss %]
+ <table [% wrapper_table | safe %] style="[% td_style %]">
+ <tr>
+ <th class="spacer-cell"></th>
+ <th width="[% wrapper_max_width %]" style="[% td_style %][% warning_style %]" class="hint">
+ [% loc('This email was sent from a staging site.') %]
+ </th>
+ <th class="spacer-cell"></th>
+ </tr>
+ </table>
+[% END %]
<table [% wrapper_table | safe %] style="[% wrapper_style %]">
<tr>
<th class="spacer-cell"></th>
diff --git a/templates/web/base/debug_footer.html b/templates/web/base/debug_footer.html
deleted file mode 100644
index a1b7fc155..000000000
--- a/templates/web/base/debug_footer.html
+++ /dev/null
@@ -1,40 +0,0 @@
-[% IF c.config.STAGING_SITE and c.config.SHOW_DEBUG %]
-
-<hr style="clear: both;">
-
-<ul>
- <li>cobrand.moniker: [% c.cobrand.moniker %]</li>
- <li>additional_template_paths: [% additional_template_paths.join(', ') || '--empty--' %]</li>
- <li>lang_code: [% lang_code %]</li>
- <li>user.id: [% c.user.id || '--not logged in--' %]</li>
-</ul>
-
-<style type="text/css">
- #overrides_form {
- font-size: 80%;
- }
- #overrides_form label {
- float: left;
- text-align: right;
- padding-right: 0.5em;
- width: 12em;
- }
-
-</style>
-
-<!-- Use a post so that we don't clutter up the url -->
-<form action="" method="post" id="overrides_form" name="overrides_form">
-
- <label for="_override_clear_all">Clear all overrides:</label>
- <input type="checkbox" name="_override_clear_all" id="_override_clear_all" value="1"><br>
-
- [% FOREACH k IN ['cobrand_moniker', 'lang'] %]
- <label for="override_[% k %]">[% k %]:</label>
- <input type="text" name="_override_[% k %]" id="override_[% k %]" value="[% c.get_override(k)%]"><br>
- [% END %]
-
- <label>&nbsp;</label><input type="submit" value="Change overrides">
-</form>
-
-[% END %]
-
diff --git a/templates/web/base/debug_header.html b/templates/web/base/debug_header.html
index 92ccbc357..5bbb65cfc 100644
--- a/templates/web/base/debug_header.html
+++ b/templates/web/base/debug_header.html
@@ -1,5 +1,5 @@
-[% IF c.config.STAGING_SITE and c.config.SHOW_DEBUG %]
- <p class="dev-site-notice">
- [% loc("This is a developer site; things might break at any time, and the database will be periodically deleted.") %]
- </p>
+[% IF c.config.STAGING_SITE ~%]
+ <div class="dev-site-notice">
+ [% loc("Staging site") %]
+ </div>
[% END %]
diff --git a/templates/web/base/header.html b/templates/web/base/header.html
index 7ef1265de..74ec2d16a 100644
--- a/templates/web/base/header.html
+++ b/templates/web/base/header.html
@@ -26,6 +26,7 @@
[% TRY %][% PROCESS 'set_body_class.html' %][% CATCH file %][% END %]
<body class="[% bodyclass | html IF bodyclass %]">
+ [% INCLUDE 'debug_header.html' %]
[% TRY %][% PROCESS 'before_wrapper.html' %][% CATCH file %][% END %]
<div class="wrapper">
@@ -36,5 +37,3 @@
<div class="container">
<div class="content[% " $mainclass" | html IF mainclass %]" role="main">
-
- <!-- [% INCLUDE 'debug_header.html' %] -->
diff --git a/templates/web/fiksgatami/header.html b/templates/web/fiksgatami/header.html
index 80235194c..a0fd63626 100644
--- a/templates/web/fiksgatami/header.html
+++ b/templates/web/fiksgatami/header.html
@@ -19,6 +19,8 @@
[% TRY %][% PROCESS 'set_body_class.html' %][% CATCH file %][% END %]
<body class="[% bodyclass | html IF bodyclass %]">
+ [% INCLUDE 'debug_header.html' %]
+
<div class="wrapper">
<div class="table-cell">
<header id="site-header" role="banner">
@@ -32,5 +34,3 @@
<div class="container">
<div class="content[% " $mainclass" | html IF mainclass %]" role="main">
-
- <!-- [% INCLUDE 'debug_header.html' %] -->
diff --git a/templates/web/fiksgatami/nn/footer.html b/templates/web/fiksgatami/nn/footer.html
index 519a8c3f5..01b41728d 100644
--- a/templates/web/fiksgatami/nn/footer.html
+++ b/templates/web/fiksgatami/nn/footer.html
@@ -30,7 +30,6 @@
</div>
</div>
-<!-- [% INCLUDE 'debug_footer.html' %] -->
</div> <!-- .wrapper -->
</body>
</html>
diff --git a/templates/web/hart/header.html b/templates/web/hart/header.html
index fd5c70dd1..09c775454 100644
--- a/templates/web/hart/header.html
+++ b/templates/web/hart/header.html
@@ -20,6 +20,8 @@
[% TRY %][% PROCESS 'set_body_class.html' %][% CATCH file %][% END %]
<body class="[% bodyclass | html IF bodyclass %]">
+ [% INCLUDE 'debug_header.html' %]
+
<div class="wrapper">
<div class="table-cell">
<header id="site-header" role="banner">
@@ -38,5 +40,3 @@
<div class="container">
<div class="content[% " $mainclass" | html IF mainclass %]" role="main">
-
- <!-- [% INCLUDE 'debug_header.html' %] -->
diff --git a/templates/web/oxfordshire/header.html b/templates/web/oxfordshire/header.html
index 58df22db5..70d7e4b18 100644
--- a/templates/web/oxfordshire/header.html
+++ b/templates/web/oxfordshire/header.html
@@ -20,6 +20,8 @@
</head>
<body class="[% bodyclass | html IF bodyclass %]">
+ [% INCLUDE 'debug_header.html' %]
+
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-NT76GJ5"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
@@ -42,5 +44,3 @@ height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<div class="container">
<div class="content[% " $mainclass" | html IF mainclass %]" role="main">
-
- <!-- [% INCLUDE 'debug_header.html' %] -->
diff --git a/templates/web/stevenage/header.html b/templates/web/stevenage/header.html
index cda0c1757..052a27dfc 100644
--- a/templates/web/stevenage/header.html
+++ b/templates/web/stevenage/header.html
@@ -16,6 +16,8 @@
</head>
<body class="[% bodyclass | html IF bodyclass %]">
+ [% INCLUDE 'debug_header.html' %]
+
<div class="wrapper">
<div class="table-cell">
<header id="site-header">
@@ -28,5 +30,3 @@
<div class="container">
<div class="content[% " $mainclass" | html IF mainclass %]" role="main">
-
- <!-- [% INCLUDE 'debug_header.html' %] -->
diff --git a/templates/web/zurich/header.html b/templates/web/zurich/header.html
index 06b0558d7..347bf6b70 100644
--- a/templates/web/zurich/header.html
+++ b/templates/web/zurich/header.html
@@ -20,6 +20,8 @@
</head>
<body class="[% bodyclass | html IF bodyclass %]">
+ [% INCLUDE 'debug_header.html' %]
+
<div class="wrapper">
<div class="table-cell clearfix">
<header id="site-header" role="banner">
@@ -80,5 +82,3 @@
[% END %]
[% pre_container_extra | safe %]
-
- <!-- [% INCLUDE 'debug_header.html' %] -->
diff --git a/web/cobrands/sass/_base.scss b/web/cobrands/sass/_base.scss
index 587b50ebf..ced554249 100644
--- a/web/cobrands/sass/_base.scss
+++ b/web/cobrands/sass/_base.scss
@@ -659,6 +659,19 @@ ul.error {
/*** LAYOUT ***/
+.dev-site-notice {
+ font-size: 1.5em;
+ color: #fff;
+ background-color: #f00;
+ position: absolute;
+ padding: 1em 5em;
+ top: 1em;
+ left: -5em;
+ transform: rotate(-45deg);
+ z-index: 2;
+ pointer-events: none;
+}
+
// Padding creates page margins on mobile
.container {
margin: 0 auto;