From de5741750a78a044b2075a053d60e382de165683 Mon Sep 17 00:00:00 2001 From: Mark Moffat Date: Tue, 13 Feb 2018 21:21:22 +0100 Subject: [PATCH] Refactoring theming --- routes/index.js | 6 ++++-- views/layouts/layout.hbs | 16 +++++++++------- views/partials/payments/authorizenet.hbs | 4 ++-- views/partials/payments/paypal.hbs | 4 ++-- views/partials/payments/stripe.hbs | 4 ++-- views/{partials => themes/Cloth}/cart.hbs | 18 +++++++++--------- views/themes/Cloth/checkout.hbs | 2 +- views/themes/Cloth/pay.hbs | 2 +- 8 files changed, 30 insertions(+), 26 deletions(-) rename views/{partials => themes/Cloth}/cart.hbs (89%) diff --git a/routes/index.js b/routes/index.js index c38d41c..5adb7a2 100644 --- a/routes/index.js +++ b/routes/index.js @@ -58,7 +58,7 @@ router.get('/checkout', async (req, res, next) => { }); router.get('/pay', async (req, res, next) => { - let config = common.getConfig(); + const config = common.getConfig(); // if there is no items in the cart then render a failure if(!req.session.cart){ @@ -85,7 +85,9 @@ router.get('/pay', async (req, res, next) => { }); router.get('/cartPartial', (req, res) => { - res.render('partials/cart', { + const config = common.getConfig(); + + res.render(`${config.themeViews}cart`, { pageCloseBtn: common.showCartCloseBtn(req.query.path), page: req.query.path, layout: false, diff --git a/views/layouts/layout.hbs b/views/layouts/layout.hbs index c0f9bf9..1ffda57 100644 --- a/views/layouts/layout.hbs +++ b/views/layouts/layout.hbs @@ -38,6 +38,7 @@ + @@ -61,7 +62,11 @@ {{#if config.googleAnalytics}}{{{config.googleAnalytics}}}{{/if}} {{#if config.customCss}}{{/if}} + {{#if admin}} + + {{else}} {{#if config.theme}}{{/if}} + {{/if}} {{#if admin}} @@ -117,20 +122,16 @@ {{#unless admin}} {{#ifCond page '!=' 'checkout'}} {{#ifCond page '!=' 'pay'}} -
-
-
- {{> partials/cart}} -
+
+ {{> (getTheme 'cart')}}
-
{{/ifCond}} {{/ifCond}} {{/unless}}
{{#if admin}} -
+
{{{body}}}
{{else}} @@ -141,6 +142,7 @@ +
{{#if showFooter}}