From 8f9d5f42c6e0b676afe6bf4a8f65dd283f41f1d0 Mon Sep 17 00:00:00 2001 From: Peter Woo Date: Tue, 28 Mar 2017 15:04:20 -0700 Subject: [PATCH] Add a maintenance page, shown in MAINTENANCE_MODE --- .../custom-environment-variables.json.example | 2 ++ config/default.json | 2 ++ server/routes/app/home.js | 9 ++++++- server/templates/maintenance.dust | 24 +++++++++++++++++++ www/sass/_base.scss | 20 ++++++++++++++++ 5 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 server/templates/maintenance.dust diff --git a/config/custom-environment-variables.json.example b/config/custom-environment-variables.json.example index 8b4fb90..edf67a2 100644 --- a/config/custom-environment-variables.json.example +++ b/config/custom-environment-variables.json.example @@ -4,6 +4,8 @@ "POTC_BASE_URL": "POTC_BASE_URL" }, + "MAINTENANCE_MODE": "MAINTENANCE_MODE", + "CREDENTIALS": { "POTC": { "DEBUG_KEY": "POTC_DEBUG_KEY" diff --git a/config/default.json b/config/default.json index 1e4f6b3..e0cf213 100644 --- a/config/default.json +++ b/config/default.json @@ -11,6 +11,8 @@ "maxAge": 0 }, + "MAINTENANCE_MODE": false, + "API": { "POTC_BASE_URL": "https://congressforms.eff.org", "SMARTY_STREETS": { diff --git a/server/routes/app/home.js b/server/routes/app/home.js index 3fba88a..e55e094 100644 --- a/server/routes/app/home.js +++ b/server/routes/app/home.js @@ -3,7 +3,14 @@ */ var home = function(req, res) { - res.render('index'); + var maintenanceMode = req.app.locals.CONFIG.get('MAINTENANCE_MODE'); + if (maintenanceMode == 'false') + maintenanceMode = false; + + if (maintenanceMode && !req.query.maintenance) + res.render('maintenance'); + else + res.render('index'); }; diff --git a/server/templates/maintenance.dust b/server/templates/maintenance.dust new file mode 100644 index 0000000..82b486e --- /dev/null +++ b/server/templates/maintenance.dust @@ -0,0 +1,24 @@ +{>"layouts/master" /} + +{ + +
+ + {>"components/nav-bar"/} + +
+

Offline for maintenance

+

Please check back soon!

+
+
+ + + {>"components/footer"/} + +{/body} diff --git a/www/sass/_base.scss b/www/sass/_base.scss index 1b09d8f..6e44efa 100644 --- a/www/sass/_base.scss +++ b/www/sass/_base.scss @@ -59,6 +59,18 @@ h1 { font-size: 35px; } } +h2 { + font-family: 'DroidSerif', serif; + font-size: 35px; + text-align: center; + color: #444444; + @media (max-width: $screen-sm-max) { + font-size: 29px; + } + @media (max-width: $screen-xs-max) { + font-size: 20px; + } +} .header h1 { // Appears on first page margin-top: 70px; @@ -71,6 +83,14 @@ h1.header { // Appears on other pages margin-top: 0; } +.header h2 { + // Appears on first page (maintenance mode) + margin-top: 70px; + + @media (max-width: $screen-xs-max) { + margin-top: 30px; + } +} .boxshadow { box-shadow: 0px 2px 7px 0px rgba(100, 100, 100, 0.18); }