aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZarino Zappia <mail@zarino.co.uk>2020-01-07 15:10:36 +0000
committerZarino Zappia <mail@zarino.co.uk>2020-01-07 15:10:36 +0000
commitcffacce503f6f34bbf362f1aae7c0218afbdee55 (patch)
treeb139c7d857138b67c9e30e5083fd16f807f26041
parenta1a3991dc1a8ff8199ab117f6c665323462a3ba3 (diff)
STAGING_FLAGS option to hide the staging site banner
Allows you to hide the banner introduced in 1f43fc9. Useful when you’re making front-end changes—especially on small screens—and don’t want the banner getting in the way.
-rw-r--r--CHANGELOG.md2
-rw-r--r--conf/general.yml-docker1
-rw-r--r--conf/general.yml-example1
-rw-r--r--docs/customising/config.md18
-rw-r--r--t/cobrand/staging.t18
-rw-r--r--templates/web/base/debug_header.html2
6 files changed, 37 insertions, 5 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6ae350b1a..c5dd771fe 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -64,7 +64,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.
+ - Add banner on staging website/emails, and STAGING_FLAGS option to hide it.
- Do not hard code site name in database fixture.
- Open311 improvements:
- Support use of 'private' service definition <keywords> to mark
diff --git a/conf/general.yml-docker b/conf/general.yml-docker
index fb789daf5..c73bd3657 100644
--- a/conf/general.yml-docker
+++ b/conf/general.yml-docker
@@ -57,6 +57,7 @@ STAGING_SITE: 1
STAGING_FLAGS:
send_reports: 0
skip_checks: 0
+ hide_staging_banner: 0
enable_appcache: 0
# What to use as front page/alert example places placeholder
diff --git a/conf/general.yml-example b/conf/general.yml-example
index 86da4cf2c..9bf6d1d05 100644
--- a/conf/general.yml-example
+++ b/conf/general.yml-example
@@ -57,6 +57,7 @@ STAGING_SITE: 1
STAGING_FLAGS:
send_reports: 0
skip_checks: 0
+ hide_staging_banner: 0
enable_appcache: 0
# What to use as front page/alert example places placeholder
diff --git a/docs/customising/config.md b/docs/customising/config.md
index f3a023b1b..ff994a25b 100644
--- a/docs/customising/config.md
+++ b/docs/customising/config.md
@@ -311,12 +311,23 @@ The following are all the configuration settings that you can change in `conf/ge
<p>
A variety of flags that change the behaviour of a site when
<code><a href="#staging_site">STAGING_SITE</a></code> is <code>1</code>.
- <code>send_reports</code> being set to 0 will
+ </p>
+ <p>
+ Setting <code>send_reports</code> to <code>0</code> will
<a href="{{ "/customising/send_reports" | relative_url }}">send
reports</a> to the reporter <em>instead of</em> the relevant body's
- contact address; <code>skip_checks</code> will stop cobrands from
+ contact address.
+ </p>
+ <p>
+ Setting <code>skip_checks</code> to <code>1</code> will stop cobrands from
performing some checks such as the map pin location being within their
- covered area, which makes testing multiple cobrands much easier;
+ covered area, which makes testing multiple cobrands much easier.
+ </p>
+ <p>
+ Setting <code>hide_staging_banner</code> to <code>1</code> will hide the
+ red “Staging site” banner in the top left corner of the site.
+ </p>
+ <p>
<code>enable_appcache</code> lets you say whether the appcache should be
active or not.
</p>
@@ -336,6 +347,7 @@ The following are all the configuration settings that you can change in `conf/ge
STAGING_FLAGS:
send_reports: 0
skip_checks: 1
+ hide_staging_banner: 1
enable_appcache: 0
</pre>
</div>
diff --git a/t/cobrand/staging.t b/t/cobrand/staging.t
new file mode 100644
index 000000000..5d79daa4b
--- /dev/null
+++ b/t/cobrand/staging.t
@@ -0,0 +1,18 @@
+use FixMyStreet::TestMech;
+my $mech = FixMyStreet::TestMech->new;
+
+subtest 'staging banner is visible by default on staging sites' => sub {
+ $mech->get_ok('/');
+ $mech->content_contains('<div class="dev-site-notice">');
+};
+
+FixMyStreet::override_config {
+ STAGING_FLAGS => { hide_staging_banner => 1 },
+}, sub {
+ subtest 'staging banner can be hidden through STAGING_FLAGS config' => sub {
+ $mech->get_ok('/');
+ $mech->content_lacks('<div class="dev-site-notice">');
+ };
+};
+
+done_testing();
diff --git a/templates/web/base/debug_header.html b/templates/web/base/debug_header.html
index 5bbb65cfc..222878871 100644
--- a/templates/web/base/debug_header.html
+++ b/templates/web/base/debug_header.html
@@ -1,4 +1,4 @@
-[% IF c.config.STAGING_SITE ~%]
+[% IF c.config.STAGING_SITE and !c.config.STAGING_FLAGS.hide_staging_banner ~%]
<div class="dev-site-notice">
[% loc("Staging site") %]
</div>