From d60c59992f4715dede775b4a5865672871cc4a89 Mon Sep 17 00:00:00 2001 From: Simon Diemert Date: Fri, 31 Jul 2015 10:27:18 -0700 Subject: [PATCH] added correct title management --- lib/routes.js | 25 ++++++++++++++++++++----- views/partials/head.hbs | 17 +++++++++++------ views/population-health.hbs | 2 +- visualizations/ClusterBarVis.html | 2 +- 4 files changed, 33 insertions(+), 13 deletions(-) diff --git a/lib/routes.js b/lib/routes.js index 25f8c71..b0f14f9 100644 --- a/lib/routes.js +++ b/lib/routes.js @@ -35,7 +35,7 @@ function routes(next, data) { logger.error("Route: / caught an exception: " + util.inspect(e, false, null)); res.status(500); - return res.render("error", {message: 'An error occurred while loading the home page.', redirect: '/'}); + return res.render("error", {message: 'An error occurred while loading the home page.', redirect: '/', title:'error'}); } } @@ -155,6 +155,7 @@ function routes(next, data) { res.status(500); return res.render("error", { message : "Number of queries in database with title " + req.params.title + " was not exactly 1", + title:"Error", redirect: '/' }); @@ -168,7 +169,7 @@ function routes(next, data) { errorMessage = 'query - ' + req.params.title + ' has undefined executions'; logger.error('visualization/:title/:endpoint/:provider:' + errorMessage); res.status(500); - return res.render('error', {message: errorMessage, redirect: '/'}); + return res.render('error', {message: errorMessage, redirect: '/', title:'Error'}); } @@ -181,6 +182,7 @@ function routes(next, data) { res.status(404); return res.render("error", { message : "There were not executions found for query: " + req.params.title, + title:"Error", redirect: '/' }); @@ -295,6 +297,7 @@ function routes(next, data) { res.status(500); return res.render('error', { message : "Could not find a visualization for query: " + req.params.title, + title:"Error", redirect: '/' }); @@ -311,6 +314,7 @@ function routes(next, data) { res.status(500); return res.render('error', { message : 'Could not load visualization for query : ' + req.params.title, + title:"Error", redirect: '/' }); @@ -336,6 +340,7 @@ function routes(next, data) { res.status(500); return res.render('error', { message : "An exception occurred while trying load query: " + req.params.title + ".", + title:"Error", redirect: '/' }); @@ -350,6 +355,7 @@ function routes(next, data) { res.status(500); return res.render('error', { message : "An exception occurred while trying load query: " + req.params.title + ".", + title:"Error", redirect: '/' }); @@ -388,6 +394,7 @@ function routes(next, data) { res.status(404); return res.render('error', { message : 'Successfully fetched report ' + t + ', but it had no data.', + title:"Error", redirect: '/' }); break; @@ -398,6 +405,7 @@ function routes(next, data) { res.status(400); return res.render("error", { message : "routes: Failed to fetch report" + t, + title:"Error", redirect: '/' }); break; @@ -408,6 +416,7 @@ function routes(next, data) { res.status(401); return res.render("error", { message : "routes: Unable to verify identity, either the session expired or invalid there are credentials.", + title:"Error", redirect: '/auth' }); break; @@ -418,6 +427,7 @@ function routes(next, data) { res.status(500); return res.render("error", { message : "routes: Failure to get report data from hubapi.", + title:"Error", redirect: '/' }); break; @@ -428,6 +438,7 @@ function routes(next, data) { res.status(500); return res.render("error", { message : "routes: Failure to get report data from hubapi.", + title:"Error", redirect: '/' }); break; @@ -440,6 +451,7 @@ function routes(next, data) { res.status(404); return res.render("error", { message : "Failure to get report data from hubapi.", + title:"Error", redirect: '/' }) @@ -456,6 +468,7 @@ function routes(next, data) { res.status(500); return res.render('error', { message : 'Failed to get report data from hubapi.', + title:"Error", redirect: '/' }); @@ -468,7 +481,7 @@ function routes(next, data) { logger.error("/report/title caught an exception: " + util.inspect(e, false, null)); res.status(500); - return res.render('error', {message: 'Failed to get report data from hubapi.', redirect: '/'}); + return res.render('error', {message: 'Failed to get report data from hubapi.', redirect: '/', title: 'Error'}); } @@ -492,7 +505,7 @@ function routes(next, data) { } - return res.render('auth', {message: message, user: req.session.user}); + return res.render('auth', {message: message, user: req.session.user, title: "Login"}); } catch (e) { @@ -500,7 +513,8 @@ function routes(next, data) { res.status(500); return res.render('error', { message : 'Internal server error: ' + util.inspect(e, false, null), - redirect: '/auth' + redirect: '/auth', + title:"Error" }); } @@ -520,6 +534,7 @@ function routes(next, data) { res.status(500); return res.render('error', { message : 'Internal server error: ' + util.inspect(e, false, null), + title:"Error", redirect: '/auth' }); diff --git a/views/partials/head.hbs b/views/partials/head.hbs index 6fa243f..0314c7e 100644 --- a/views/partials/head.hbs +++ b/views/partials/head.hbs @@ -1,13 +1,18 @@ - - PDC - {{ title }} - - + + {{#if title}} + {{ title }} - PDC + {{else}} + PDC + {{/if}} - {{> styles }} - {{> scripts }} + + + + {{> styles }} + {{> scripts }} diff --git a/views/population-health.hbs b/views/population-health.hbs index 45eb117..7b37cf8 100644 --- a/views/population-health.hbs +++ b/views/population-health.hbs @@ -96,7 +96,7 @@