Theme now defaults to Cloth to avoid duplicate code

master
Mark Moffat 2018-02-11 13:44:45 +01:00
parent 11a0ce909b
commit 2990c9e8fe
7 changed files with 4 additions and 396 deletions

View File

@ -202,10 +202,12 @@ exports.getConfig = () => {
// setup theme
config.themeViews = '';
if(typeof config.theme !== 'undefined' && config.theme !== ''){
config.themeViews = '../public/themes/' + config.theme + '/';
if(typeof config.theme === 'undefined' || config.theme === ''){
config.theme = 'Cloth'; // Default to Cloth theme
}
config.themeViews = '../public/themes/' + config.theme + '/';
// if db set to mongodb override connection with MONGODB_CONNECTION_STRING env var
config.databaseConnectionString = process.env.MONGODB_CONNECTION_STRING || config.databaseConnectionString;

View File

@ -1,5 +0,0 @@
<div class="col-xl-8 col-xl-offset-2 col-xs-12">
<div id="cart">
{{> cart}}
</div>
</div>

View File

@ -1,117 +0,0 @@
<div class="col-xl-8 col-xl-offset-2 col-xs-12">
<div class="row">
<form>
{{#ifCond config.menuEnabled '==' 'true'}}
{{#ifCond config.menuLocation '==' "side"}}
<div class="col-md-offset-2 col-lg-offset-2 col-xl-9 col-xl-offset-3 search-bar col-md-10 search-bar">
{{else}}
<div class="col-md-8 col-md-offset-2 col-lg-8 col-lg-offset-2 search-bar">
{{/ifCond}}
{{else}}
<div class="col-md-8 col-md-offset-2 col-lg-8 col-lg-offset-2 search-bar">
{{/ifCond}}
<div class="search-bar-input input-group searchMenuLocation-{{config.menuLocation}} searchProPerRow-{{config.productsPerRow}}">
<input type="text" name="frm_search" id="frm_search" class="form-control" placeholder="Search the shop">
<span class="input-group-btn">
<button class="btn btn-primary" id="btn_search" type="submit">Search</button>
<a href="/" class="hidden-xs btn btn-primary"><i class="fa fa-times" aria-hidden="true"></i></a>
</span>
</div>
</div>
</form>
</div>
<div class="row">
{{#ifCond config.menuEnabled '==' 'true'}}
{{#ifCond config.menuLocation '==' "side"}}
<div class="col-xl-3 col-md-2">
<ul class="list-group menu-side">
<li class="list-group-item active">{{config.menuTitle}}</li>
<li class="list-group-item"><a href="/">All</a></li>
{{#each menu.items}}
<li class="list-group-item"><a href="/category/{{this.link}}">{{this.title}}</a></li>
{{/each}}
</ul>
</div>
<div class="col-xl-9 col-md-10">
{{else}}
<div class="row">
<div class="col-md-8 col-md-offset-2 col-lg-8 col-lg-offset-2">
<ol class="breadcrumb menu-top breadcrumbProPerRow-{{config.productsPerRow}}">
<li><a href="/">Home</a></li>
{{#each menu.items}}
<li><a href="/category/{{this.link}}">{{this.title}}</a></li>
{{/each}}
</ol>
</div>
</div>
<div class="col-md-8 col-md-offset-2 col-lg-8 col-lg-offset-2">
{{/ifCond}}
{{else}}
<div class="col-md-8 col-md-offset-2 col-lg-8 col-lg-offset-2">
{{/ifCond}}
{{#if filtered}}
<div class="product-layout left-pad-30 col-md-12">
<strong>Showing results for: {{searchTerm}}</strong>
</div>
{{/if}}
<div class="product-layout">
{{#ifCond results.length '==' 0}}
<div class="col-md-12">
<p class="text-danger">No products found</p>
</div>
{{/ifCond}}
{{#each results}}
<div class="{{perRowClass ../config.productsPerRow}}">
<div class="thumbnail">
{{#if productPermalink}}
<div class="product_wrapper">
<a href="/product/{{this.productPermalink}}">
<div class="vertical-center thumbnail-image-container">
{{#if productImage}}
<img class="img-responsive" src="{{this.productImage}}" alt="...">
{{else}}
<img class="img-responsive" src="/uploads/placeholder.png" alt="...">
{{/if}}
</div>
<h3 class="product-title product-title-home top-pad-10">
{{this.productTitle}}
</h3>
</a>
</div>
{{else}}
<a href="/product/{{this._id}}">
<div class="vertical-center thumbnail-image-container">
{{#if productImage}}
<img class="img-responsive" src="{{this.productImage}}" alt="...">
{{else}}
<img class="img-responsive" src="/uploads/placeholder.png" alt="...">
{{/if}}
</div>
<h3 class="product-title product-title-home top-pad-10">
{{this.productTitle}}
</h3>
</a>
{{/if}}
<h3 class="product-price text-center">
{{currencySymbol ../config.currencySymbol}}{{formatAmount productPrice}}
</h3>
<p class="text-center">
<a class="btn btn-primary add-to-cart" data-id="{{this._id}}" data-link="{{this.productPermalink}}" data-has-options="{{checkProductOptions this.productOptions}}" role="button">Add to cart</a>
</p>
</div>
</div>
{{/each}}
</div>
</div>
</div>
<input type="hidden" id="productsPerPage" value="{{productsPerPage}}" >
<input type="hidden" id="pageNum" value="{{pageNum}}">
<input type="hidden" id="totalProductCount" value="{{totalProductCount}}">
<input type="hidden" id="paginateUrl" value="{{paginateUrl}}">
<input type="hidden" id="searchTerm" value="{{searchTerm}}">
<div class="row">
<div class="col-md-10 col-md-offset-2 col-xl-9 col-xl-offset-3">
<div id="pager" class="text-center"></div>
</div>
</div>
</div>

View File

@ -1,64 +0,0 @@
<div class="col-xl-8 col-xl-offset-2 col-xs-12">
<div class="row">
<form action="/search" id="search_form" method="post">
<div class="row">
{{#ifCond config.menuEnabled '==' 'true'}}
{{#ifCond config.menuLocation '==' "side"}}
<div class="col-md-offset-2 col-lg-offset-2 col-xl-9 col-xl-offset-3 search-bar col-md-10 search-bar">
{{else}}
<div class="col-md-8 col-md-offset-2 col-lg-8 col-lg-offset-2 search-bar">
{{/ifCond}}
{{else}}
<div class="col-md-8 col-md-offset-2 col-lg-8 col-lg-offset-2 search-bar">
{{/ifCond}}
<div class="search-bar-input input-group">
<input type="text" name="frm_search" id="frm_search" class="form-control" placeholder="Search the shop">
<span class="input-group-btn">
<button class="btn btn-primary" id="btn_search" type="submit">Search</button>
<a href="/" class="hidden-xs btn btn-primary"><i class="fa fa-times" aria-hidden="true"></i></a>
</span>
</div>
</div>
</div>
</form>
</div>
<div class="row">
{{#ifCond config.menuEnabled '==' 'true'}}
{{#ifCond config.menuLocation '==' "side"}}
<div class="col-xl-3 col-md-2">
<ul class="list-group menu-side">
<li class="list-group-item active">{{config.menuTitle}}</li>
<li class="list-group-item"><a href="/">All</a></li>
{{#each menu.items}}
<li class="list-group-item"><a href="/category/{{this.link}}">{{this.title}}</a></li>
{{/each}}
</ul>
</div>
<div class="col-xl-9 col-md-10">
{{else}}
<div class="row">
<div class="col-md-8 col-md-offset-2 col-lg-8 col-lg-offset-2">
<ol class="breadcrumb menu-top">
<li><a href="/">Home</a></li>
{{#each menu.items}}
<li><a href="/category/{{this.link}}">{{this.title}}</a></li>
{{/each}}
</ol>
</div>
</div>
<div class="col-md-8 col-md-offset-2 col-lg-8 col-lg-offset-2">
{{/ifCond}}
{{else}}
<div class="col-md-8 col-md-offset-2 col-lg-8 col-lg-offset-2">
{{/ifCond}}
{{#if filtered}}
<div class="product-layout left-pad-30 col-md-12">
<strong>Showing results for: {{searchTerm}}</strong>
</div>
{{/if}}
<div class="product-layout">
{{{page.pageContent}}}
</div>
</div>
</div>
</div>

View File

@ -1,65 +0,0 @@
<div class="col-xl-8 col-xl-offset-2 col-xs-12">
<div class="row">
{{#if paymentMessage}}
<p class="text-danger text-center">{{paymentMessage}}</p>
{{/if}}
<div class="col-md-5">
<div class="panel panel-default" style="margin-top: 30px;">
<div class="panel-heading">Customer details</div>
{{#unless session.customer}}
<div class="panel-body customer-details-login">
<p>Existing customer</p>
<div class="form-group">
<input type="email" class="form-control" id="customerLoginEmail" name="loginEmail" minlength="5" placeholder="Email address" required>
</div>
<div class="form-group">
<input type="password" class="form-control" id="customerLoginPassword" name="loginPassword" minlength="5" placeholder="Password" required>
</div>
<div class="form-group">
<a href="/customer/forgotten" class="btn btn-default pull-left">Forgotten</a>
</div>
<div class="form-group">
<button id="customerLogin" class="btn btn-success pull-right" type="submit">Login</button>
</div>
</div>
{{/unless}}
<div class="panel-body customer-details">
{{#if session.customer}}
<div class="col-xs-12 col-md-12">
<button id="customerLogout" class="btn btn-sm btn-success pull-right">Change customer</button>
</div>
{{/if}}
<form id="shipping-form" class="shipping-form" action="/{{config.paymentGateway}}/checkout_action" method="post" role="form" data-toggle="validator" novalidate="false">
{{> payments/shipping-form}}
{{#if session.customer}}
{{#ifCond config.paymentGateway '==' 'paypal'}}
{{> payments/paypal}}
{{/ifCond}}
{{/if}}
{{#unless session.customer}}
<div class="col-xs-12 col-md-12">
<p class="text-muted">Enter a password to create an account for next time</p>
<div class="form-group">
<input type="password" class="form-control customerDetails" id="newCustomerPassword" name="newCustomerPassword" placeholder="Password" required>
</div>
<a id="createCustomerAccount" class="btn btn-success pull-right">Create account</a>
</div>
{{/unless}}
</form>
{{#if session.customer}}
{{#ifCond config.paymentGateway '==' 'stripe'}}
{{> payments/stripe}}
{{/ifCond}}
{{#ifCond config.paymentGateway '==' 'authorizenet'}}
{{> payments/authorizenet}}
{{/ifCond}}
{{/if}}
</div>
</div>
</div>
<div id="cart" class="col-md-7">
{{> cart}}
</div>
</div>
</div>

View File

@ -1,21 +0,0 @@
<div class="col-xl-8 col-xl-offset-2 col-xs-12">
<div class="row">
<div class="text-center col-md-10 col-md-offset-1">
{{#ifCond result.orderStatus '==' 'Paid'}}
<h2 class="text-success">Your payment has been successfully processed</h2>
{{else}}
<h2 class="text-danger">Your payment has failed. Please try again or contact us.</h2>
{{/ifCond}}
{{#if result}}
<div>
<p><strong>Order ID:</strong> {{result._id}}</p>
<p><strong>Payment ID:</strong> {{result.orderPaymentId}}</p>
</div>
{{/if}}
{{#ifCond result.orderStatus '==' 'Paid'}}
<h3 class="text-warning">Please retain the details above as a reference of payment.</h3>
{{/ifCond}}
<a href="/" class="btn btn-warning">Home</a>
</div>
</div>
</div>

View File

@ -1,122 +0,0 @@
<div class="col-xl-8 col-xl-offset-2 col-xs-12">
<div class="row">
{{#ifCond config.menuEnabled '==' 'true'}}
{{#ifCond config.menuLocation '==' "side"}}
<div class="col-xl-3 col-md-2">
<ul class="list-group menu-side">
<li class="list-group-item active">{{config.menuTitle}}</li>
<li class="list-group-item"><a href="/">All</a></li>
{{#each menu.items}}
<li class="list-group-item"><a href="/category/{{this.link}}">{{this.title}}</a></li>
{{/each}}
</ul>
</div>
<div class="product-layout col-md-8">
{{else}}
<div class="row">
<div class="product-layout col-md-offset-1 col-md-8">
<ol class="breadcrumb menu-top">
<li><a href="/">Home</a></li>
{{#each menu.items}}
<li><a href="/category/{{this.link}}">{{this.title}}</a></li>
{{/each}}
</ol>
</div>
</div>
<div class="product-layout col-md-offset-1 col-md-8">
{{/ifCond}}
{{else}}
<div class="product-layout col-md-8">
{{/ifCond}}
<div class="container-fluid">
<div class="row">
<div class="col-xs-12 col-md-6 pull-right">
<h1 class="product-title">{{result.productTitle}}</h1>
<h4 class="product-price">{{currencySymbol config.currencySymbol}}{{result.productPrice}}</h4>
{{#if productOptions}}
<h4 class="product-option">Options</h4>
{{#each productOptions}}
{{#ifCond this.optType '==' "select"}}
<strong>{{this.optName}}</strong>
<select name="opt-{{this.optName}}" class="form-control product-opt">
{{#each this.optOptions}}
<option value="{{this}}">{{this}}</option>
{{/each}}
</select>
{{/ifCond}}
{{#ifCond this.optType '==' "radio"}}
{{#each this.optOptions}}
<strong>{{this.optName}}</strong>
<div class="radio">
<label>
<input type="radio" class="product-opt" name="opt-{{../this.optName}}" value="{{this}}">
{{this}}
</label>
</div>
{{/each}}
{{/ifCond}}
{{#ifCond this.optType '==' "checkbox"}}
<div class="checkbox">
<label>
<input type="checkbox" class="product-opt" name="opt-{{../this.optName}}" value="{{this.optName}}"><strong>{{this.optName}}</strong>
</label>
</div>
{{/ifCond}}
{{/each}}
{{/if}}
<p>
<div class="row">
<div class="col-md-6">
<p class="product-option-text">Quantity</p>
<div class="input-group">
<span class="input-group-btn">
<button class="btn btn-primary qty-btn-minus" type="button">-</button>
</span>
<input type="text" class="form-control add-color text-center" id="product_quantity" maxlength="3" value="1">
<span class="input-group-btn">
<button class="btn btn-primary qty-btn-plus" type="button">+</button>
</span>
</div>
</div>
</div>
</p>
<p>
<div class="row">
<div class="col-md-6">
<button class="btn btn-primary btn-block product-add-to-cart" type="button">Add to cart</button>
</div>
</div>
</p>
<p class="seporator"></p>
<p class="body_text">
{{{productDescription}}}
</p>
</div>
<div class="col-xs-12 col-md-6 pull-left">
{{#if result.productImage}}
<div class="title-image-container">
<div class="image-prev image-button"> <i class="fa fa-chevron-left" aria-hidden="true"></i></div>
<img src="{{result.productImage}}" id="product-title-image" class="product-title-image img-responsive" alt="...">
<div class="image-next image-button"> <i class="fa fa-chevron-right" aria-hidden="true"></i></div>
</div>
{{else}}
<div class="title-image-container">
<img src="/uploads/placeholder.png" id="product-title-image" class="product-title-image img-responsive" alt="...">
</div>
{{/if}}
{{#ifCond images.length '>' 1}}
<div class="row">
{{#each images}}
<div class="vertical-center top-pad-20 col-xs-6 col-lg-6 col-xl-6">
<img src="{{this.path}}" class="thumbnail-image img-responsive">
</div>
{{/each}}
</div>
{{/ifCond}}
</div>
</div>
</div>
</div>
</div>
<input type="hidden" id="productId" value="{{result._id}}">
</div>