added 'show' layout with custom header info

This commit is contained in:
bill bittner 2017-07-24 16:09:44 -07:00
parent 2463bbf257
commit b393de8268
4 changed files with 35 additions and 17 deletions

View file

@ -79,7 +79,7 @@ module.exports = (app) => {
} }
// serve the file or the show route // serve the file or the show route
postToStats('show', originalUrl, ip, fileInfo.name, fileInfo.claimId, 'success'); postToStats('show', originalUrl, ip, fileInfo.name, fileInfo.claimId, 'success');
res.status(200).render('show', { fileInfo }); res.status(200).render('show', { layout: 'show', fileInfo });
}) })
.catch(error => { .catch(error => {
errorHandlers.handleRequestError('show', originalUrl, ip, error, res); errorHandlers.handleRequestError('show', originalUrl, ip, error, res);
@ -97,7 +97,7 @@ module.exports = (app) => {
} }
// serve the show route // serve the show route
postToStats('show', originalUrl, ip, fileInfo.name, fileInfo.claimId, 'success'); postToStats('show', originalUrl, ip, fileInfo.name, fileInfo.claimId, 'success');
res.status(200).render('show', { fileInfo }); res.status(200).render('show', { layout: 'show', fileInfo });
}) })
.catch(error => { .catch(error => {
errorHandlers.handleRequestError('show', originalUrl, ip, error, res); errorHandlers.handleRequestError('show', originalUrl, ip, error, res);

View file

@ -72,21 +72,15 @@ const hbs = expressHandlebars.create({
return options.inverse(this); return options.inverse(this);
} }
}, },
grouped_each (every, context, options) { twitterCard (type) {
let out = ''; return new Handlebars.SafeString(`
let subcontext = []; <meta name="twitter:card" content="summary_large_image">
let i; <meta name="twitter:site" content="@spee.ch">
if (context && context.length > 0) { <meta name="twitter:creator" content="@SarahMaslinNir">
for (i = 0; i < context.length; i++) { <meta name="twitter:title" content="Parade of Fans for Houstons Funeral">
if (i > 0 && i % every === 0) { <meta name="twitter:description" content="NEWARK - The guest list and parade of limousines with celebrities emerging from them seemed more suited to a red carpet event in Hollywood or New York than than a gritty stretch of Sussex Avenue near the former site of the James M. Baxter Terrace public housing project here.">
out += options.fn(subcontext); <meta name="twitter:image" content="http://graphics8.nytimes.com/images/2012/02/19/us/19whitney-span/19whitney-span-articleLarge.jpg">
subcontext = []; `);
}
subcontext.push(context[i]);
}
out += options.fn(subcontext);
}
return out;
}, },
}, },
}); });

View file

@ -7,6 +7,7 @@
<title>Spee.ch</title> <title>Spee.ch</title>
<link rel="stylesheet" href="/assets/css/generalStyle.css" type="text/css"> <link rel="stylesheet" href="/assets/css/generalStyle.css" type="text/css">
<link rel="stylesheet" href="/assets/css/componentStyle.css" type="text/css"> <link rel="stylesheet" href="/assets/css/componentStyle.css" type="text/css">
{{ twitterCard }}
</head> </head>
<body> <body>
{{{ body }}} {{{ body }}}

View file

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Spee.ch</title>
<link rel="stylesheet" href="/assets/css/generalStyle.css" type="text/css">
<link rel="stylesheet" href="/assets/css/componentStyle.css" type="text/css">
<!-- twitter card -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@spee.ch">
<meta name="twitter:creator" content="@spee.ch">
<meta name="twitter:title" content="{{fileInfo.name}}">
<meta name="twitter:description" content="An image hosted via Spee.ch">
<meta name="twitter:image" content="/api/streamFile/{{fileInfo.fileName}}">
</head>
<body>
{{{ body }}}
<!-- google analytics -->
{{ googleAnalytics }}
</body>
</html>