From 67b5887ba516cd4f9be922aa1fc4fc0c719eb10c Mon Sep 17 00:00:00 2001 From: bill bittner Date: Mon, 2 Jul 2018 18:22:06 -0700 Subject: [PATCH] fixed layout path --- index.js | 11 ++++++----- server/controllers/pages/sendVideoEmbedPage.js | 2 +- server/views/embed.handlebars | 2 +- server/views/layouts/embed.handlebars | 10 +++++----- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/index.js b/index.js index be30317c..75097f3b 100644 --- a/index.js +++ b/index.js @@ -16,7 +16,6 @@ checkForConfig('siteConfig'); const express = require('express'); const bodyParser = require('body-parser'); const expressHandlebars = require('express-handlebars'); -const Handlebars = require('handlebars'); const helmet = require('helmet'); const cookieSession = require('cookie-session'); const http = require('http'); @@ -81,11 +80,13 @@ function Server () { app.use(speechPassport.session()); // configure handlebars & register it with express app - const hbs = expressHandlebars.create({ + const viewsPath = Path.resolve(process.cwd(), 'node_modules/spee.ch/server/views'); + app.engine('handlebars', expressHandlebars({ defaultLayout: 'embed', - handlebars : Handlebars, - }); - app.engine('handlebars', hbs.engine); + partialsDir: Path.join(viewsPath, '/partials'), + layoutsDir: Path.join(viewsPath, '/layouts') + })); + app.set('views', viewsPath); app.set('view engine', 'handlebars'); // set the routes on the app diff --git a/server/controllers/pages/sendVideoEmbedPage.js b/server/controllers/pages/sendVideoEmbedPage.js index 01f6b1f4..a401360a 100644 --- a/server/controllers/pages/sendVideoEmbedPage.js +++ b/server/controllers/pages/sendVideoEmbedPage.js @@ -4,7 +4,7 @@ const sendVideoEmbedPage = ({ params }, res) => { const claimId = params.claimId; const name = params.name; // get and render the content - res.status(200).render('embed', { layout: 'embed', host, claimId, name }); + res.status(200).render('embed', { host, claimId, name }); }; module.exports = sendVideoEmbedPage; diff --git a/server/views/embed.handlebars b/server/views/embed.handlebars index eb6c4839..c0b2e4f5 100644 --- a/server/views/embed.handlebars +++ b/server/views/embed.handlebars @@ -1 +1 @@ - + diff --git a/server/views/layouts/embed.handlebars b/server/views/layouts/embed.handlebars index 59b5b52f..6626e1f5 100644 --- a/server/views/layouts/embed.handlebars +++ b/server/views/layouts/embed.handlebars @@ -3,14 +3,14 @@ {{{body}}} - \ No newline at end of file +