Skip to content
This repository has been archived by the owner on Nov 22, 2018. It is now read-only.

Commit

Permalink
added correct title management
Browse files Browse the repository at this point in the history
  • Loading branch information
sdiemert committed Jul 31, 2015
1 parent 644dc1e commit d60c599
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 13 deletions.
25 changes: 20 additions & 5 deletions lib/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'});

}
}
Expand Down Expand Up @@ -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: '/'
});

Expand All @@ -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'});

}

Expand All @@ -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: '/'
});

Expand Down Expand Up @@ -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: '/'
});

Expand All @@ -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: '/'
});

Expand All @@ -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: '/'
});

Expand All @@ -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: '/'
});

Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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: '/'
})

Expand All @@ -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: '/'
});

Expand All @@ -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'});

}

Expand All @@ -492,15 +505,16 @@ 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) {

logger.error(util.inspect(e, false, null));
res.status(500);
return res.render('error', {
message : 'Internal server error: ' + util.inspect(e, false, null),
redirect: '/auth'
redirect: '/auth',
title:"Error"
});

}
Expand All @@ -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'
});

Expand Down
17 changes: 11 additions & 6 deletions views/partials/head.hbs
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
<html>

<head>
<meta charset="UTF-8">
<title>PDC - {{ title }}</title>
<meta name="description" content="Visualization Dashboard.">
<link rel="PDC Icon" href="/assets/images/favicon.ico" type="image/x-icon" />
<meta charset="UTF-8">
{{#if title}}
<title>{{ title }} - PDC</title>
{{else}}
<title>PDC</title>
{{/if}}

{{> styles }}
{{> scripts }}
<meta name="description" content="Visualization Dashboard.">
<link rel="PDC Icon" href="/assets/images/favicon.ico" type="image/x-icon"/>

{{> styles }}
{{> scripts }}
</head>

<body>
2 changes: 1 addition & 1 deletion views/population-health.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@

<ul class="query-list">

<li><a href="/visualization/PDC-020/{{user.clinic}}/{{user.clinician}}">Colon Cancer Screening in last two years (50-74)</a></li>
<li><a href="/visualization/PDC-1902/{{user.clinic}}/{{user.clinician}}">Colon Cancer Screening in last two years (50-74)</a></li>
<li><a href="/visualization/PDC-1149/{{user.clinic}}/{{user.clinician}}">Cervical Cancer - Females 18-70</a></li>
<li><a href="/visualization/PDC-995/{{user.clinic}}/{{user.clinician}}">Breast Cancer Screen - Females 50-70</a></li>
<li>
Expand Down
2 changes: 1 addition & 1 deletion visualizations/ClusterBarVis.html
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@

//append entry text
d.append('text')
.style({"text-anchor": "start", "text-decoration": "underline", "font-size": "14pt"})
.style({"text-anchor": "start", "text-decoration": "none", "font-size": "14pt"})
.text(function (d) {
return data.processed_result.display_names[d];
})
Expand Down

0 comments on commit d60c599

Please sign in to comment.