Skip to content

Commit

Permalink
Merge pull request #103 from EFForg/maintenance_mode
Browse files Browse the repository at this point in the history
Add a maintenance page, shown in MAINTENANCE_MODE
  • Loading branch information
wioux authored Mar 28, 2017
2 parents 74a5e70 + 8f9d5f4 commit e30a6f3
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 1 deletion.
2 changes: 2 additions & 0 deletions config/custom-environment-variables.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"POTC_BASE_URL": "POTC_BASE_URL"
},

"MAINTENANCE_MODE": "MAINTENANCE_MODE",

"CREDENTIALS": {
"POTC": {
"DEBUG_KEY": "POTC_DEBUG_KEY"
Expand Down
2 changes: 2 additions & 0 deletions config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
"maxAge": 0
},

"MAINTENANCE_MODE": false,

"API": {
"POTC_BASE_URL": "https://congressforms.eff.org",
"SMARTY_STREETS": {
Expand Down
9 changes: 8 additions & 1 deletion server/routes/app/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
};


Expand Down
24 changes: 24 additions & 0 deletions server/templates/maintenance.dust
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{>"layouts/master" /}

{<body}

<div ng-controller="SendMessageController"
data-pagename="[[pageName]]"
data-pagefrom="[[pageFrom]]"
id="wrapper"
class="content">

<div class="main">

{>"components/nav-bar"/}

<div class="header">
<h1>Offline for maintenance</h1>
<h2>Please check back soon!</h2>
</div>
</div>
</div>

{>"components/footer"/}

{/body}
20 changes: 20 additions & 0 deletions www/sass/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}
Expand Down

0 comments on commit e30a6f3

Please sign in to comment.