Fixes to icon display

master
Mark Moffat 2020-02-01 19:24:11 +10:30
parent a325dc4532
commit fdbbceb114
13 changed files with 75 additions and 35 deletions

18
app.js
View File

@ -320,6 +320,21 @@ handlebars = handlebars.create({
return text.substring(0, 155) + '...';
}
return text;
},
feather: (icon) => {
// eslint-disable-next-line keyword-spacing
return `<svg
width="16"
height="16"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="feather feather-${icon}"
>
<use xlink:href="/dist/feather-sprite.svg#${icon}"/>
</svg>`;
}
}
});
@ -375,6 +390,9 @@ app.use(i18n.init);
// serving static content
app.use(express.static(path.join(__dirname, 'public')));
app.use(express.static(path.join(__dirname, 'views', 'themes')));
app.use(express.static(path.join(__dirname, 'node_modules', 'feather-icons')));
console.log('test', path.join(__dirname, 'node_modules', 'feather-icons', 'dist'));
// Make stuff accessible to our router
app.use((req, res, next) => {

21
package-lock.json generated
View File

@ -1975,6 +1975,11 @@
}
}
},
"classnames": {
"version": "2.2.6",
"resolved": "https://registry.npmjs.org/classnames/-/classnames-2.2.6.tgz",
"integrity": "sha512-JR/iSQOSt+LQIWwrwEzJ9uk0xfN3mTVYMwt1Ir5mUcSN6pU+V4zQFFaJsclJbPuAUQH+yfWef6tm7l1quW3C8Q=="
},
"clean-css": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/clean-css/-/clean-css-4.2.1.tgz",
@ -4108,6 +4113,22 @@
"reusify": "1.0.4"
}
},
"feather-icons": {
"version": "4.25.0",
"resolved": "https://registry.npmjs.org/feather-icons/-/feather-icons-4.25.0.tgz",
"integrity": "sha512-gIJbA4Kmzqub+eTwqA3LRJhC+G267t7QlvFxx+nnHYEEaCpXh5HwRY9pW39b51/Y8c7D9mjLplNdzGCWPz39Sg==",
"requires": {
"classnames": "2.2.6",
"core-js": "3.6.4"
},
"dependencies": {
"core-js": {
"version": "3.6.4",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.6.4.tgz",
"integrity": "sha512-4paDGScNgZP2IXXilaffL9X7968RuvwlkK3xWtZRVqgd8SYNiVKRJvkFd1aqqEuPfN7E68ZHEp9hDj6lHj4Hyw=="
}
}
},
"feature-policy": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/feature-policy/-/feature-policy-0.3.0.tgz",

View File

@ -42,6 +42,7 @@
"express-handlebars": "^3.1.0",
"express-rate-limit": "^5.0.0",
"express-session": "^1.17.0",
"feather-icons": "^4.25.0",
"glob": "^7.1.5",
"gulp-less": "^4.0.1",
"helmet": "^3.21.2",

View File

@ -8,7 +8,7 @@
<input type="text" name="customer_filter" id="customer_filter" class="form-control" placeholder="Filter customers">
<div class="input-group-append">
<button type="button" class="btn btn-outline-success" id="btn_customer_filter">Filter</button>
<a href="/admin/customers" class="hidden-xs btn btn-outline-warning"><i class="feather" data-feather="x-octagon"></i></a>
<a href="/admin/customers" class="hidden-xs btn btn-outline-warning">{{{feather 'x-octagon'}}}</a>
</div>
</div>
<p class="text-warning top-pad-10">{{ @root.__ "Customers can be filtered by: email, name or phone number" }}</p>

View File

@ -162,14 +162,14 @@
<nav class="navbar navbar-expand-lg justify-content-between mainNavBar">
<a class="navbar-brand" href="/">{{@root.config.cartTitle}}</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarMenu" aria-controls="navbarMenu" aria-expanded="false" aria-label="Toggle navigation">
<i class="feather" data-feather="menu"></i>
{{{feather 'menu'}}}
</button>
<div id="navbarText">
<ul class="navbar-nav ml-auto">
{{#ifCond @root.config.enableLanguages "!=" false}}
<div class="dropdown d-none d-sm-block">
<button class="btn btn-primary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="feather" data-feather="globe"></i>
{{{feather 'globe'}}}
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
{{#availableLanguages}}
@ -179,9 +179,9 @@
</div>
{{/ifCond}}
{{#if @root.session.cart}}
<li class="nav-item"><a href="/checkout/cart" class="btn menu-btn"><i class="feather" data-feather="shopping-cart"></i> {{ @root.__ "Cart" }} <span class="badge badge-danger" id="cart-count">{{@root.session.totalCartItems}}</span></a></li>
<li class="nav-item"><a href="/checkout/cart" class="btn menu-btn">{{{feather 'shopping-cart'}}} {{ @root.__ "Cart" }} <span class="badge badge-danger" id="cart-count">{{@root.session.totalCartItems}}</span></a></li>
{{else}}
<li class="nav-item"><a href="/checkout/cart" class="btn menu-btn"><i class="feather" data-feather="shopping-cart"></i></i> {{ @root.__ "Cart" }} <span class="badge badge-danger" id="cart-count">0</span></a></li>
<li class="nav-item"><a href="/checkout/cart" class="btn menu-btn">{{{feather 'shopping-cart'}}}</i> {{ @root.__ "Cart" }} <span class="badge badge-danger" id="cart-count">0</span></a></li>
{{/if}}
</ul>
</div>
@ -194,7 +194,7 @@
<div id="cart" class="col-md-12 pad-left-12 top-pad-10 pushy pushy-right">
<div class="row {{checkout}}">
<div class="col-sm-12 text-right">
<button class="pushy-link btn btn-primary" type="button"><i class="feather" data-feather="x"></i></button>
<button class="pushy-link btn btn-primary" type="button">{{{feather 'x'}}}</button>
</div>
</div>
<div class="row">
@ -249,7 +249,7 @@
<div class="form-group global-search-form">
<div class="input-group">
<div class="input-group-prepend">
<label class="input-group-text search-input-addon" for="global-search-value"><i class="feather" data-feather="search"></i></label>
<label class="input-group-text search-input-addon" for="global-search-value">{{{feather 'search'}}}</label>
</div>
<input type="text" class="form-control form-control-lg" id="global-search-value">
</div>

View File

@ -9,7 +9,7 @@
<div class="input-group-append">
<button class="btn btn-outline-success" id="btn_order_filter">{{ @root.__ "Filter" }}</button>
<a href="/admin/orders/bystatus/" class="hidden-xs btn btn-outline-info orderFilterByStatus">{{ @root.__ "By status" }}</a>
<a href="/admin/orders" class="hidden-xs btn btn-outline-warning"><i class="feather" data-feather="x-octagon"></i></a>
<a href="/admin/orders" class="hidden-xs btn btn-outline-warning">{{{feather 'x-octagon'}}}</a>
</div>
</div>
<div class="orderFilter">
@ -46,7 +46,7 @@
<li class="list-group-item">
<div class="float-right top-pad-5">
{{ @root.__ "Status" }}: <span class="text-{{getStatusColor this.orderStatus}}">{{this.orderStatus}}</span>
<a class="text-danger" href="/admin/order/delete/{{this._id}}" onclick="return confirm('Are you sure you want to delete this order?');"> <i class="feather" data-feather="trash-2"></i></a>
<a class="text-danger" href="/admin/order/delete/{{this._id}}" onclick="return confirm('Are you sure you want to delete this order?');"> {{{feather 'trash-2'}}}</a>
</div>
<div class="top-pad-5">
<a href="/admin/order/view/{{this._id}}" class="text-success">View order</a> - <span class="text-info">Date: </span>{{formatDate this.orderDate "DD/MM/YYYY hh:mm"}} | <span class="text-info">Email:</span> {{this.orderEmail}} | <span class="text-info">{{ @root.__ "Last name" }}:</span> {{this.orderLastname}}

View File

@ -3,11 +3,11 @@
<ul class="nav flex-column">
<li class="nav-item">
<a href="/admin"><img class="sidebar-brand" src="/images/logo-admin.png"></a>
<a href="#" data-toggle="modal" data-target="#globalSearchModal" class="sidebar-search text-muted"><i class="feather" data-feather="search"></i></a>
<a href="#" data-toggle="modal" data-target="#globalSearchModal" class="sidebar-search text-muted">{{{feather 'search'}}}</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/admin/dashboard">
<i class="feather" data-feather="bar-chart"></i> &nbsp;
{{{feather 'bar-chart'}}} &nbsp;
{{ @root.__ "Dashboard" }}
</a>
</li>
@ -17,43 +17,43 @@
{{#ifCond session.isAdmin '===' true}}
<li class="nav-item sidebar-addon">
<a class="nav-link sidebar-link" href="/admin/products">
<i class="feather" data-feather="tag"></i> &nbsp;
{{{feather 'tag'}}} &nbsp;
Products
</a>
<a class="sidebar-link-addon text-muted" href="/admin/product/new">
<i class="feather" data-feather="plus"></i>
{{{feather 'plus'}}}
</a>
</li>
{{else}}
<li class="nav-item">
<a class="nav-link" href="/admin/products">
<i class="feather" data-feather="tag"></i> &nbsp;
{{{feather 'tag'}}} &nbsp;
Products
</a>
</li>
{{/ifCond}}
<li class="nav-item sidebar-addon">
<a class="nav-link sidebar-link" href="/admin/orders">
<i class="feather" data-feather="package"></i> &nbsp;
{{{feather 'package'}}} &nbsp;
Orders
</a>
<a class="sidebar-link-addon text-muted" href="/admin/order/create">
<i class="feather" data-feather="plus"></i>
{{{feather 'plus'}}}
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/admin/customers">
<i class="feather" data-feather="users"></i> &nbsp;
{{{feather 'users'}}} &nbsp;
Customers
</a>
</li>
<li class="nav-item sidebar-addon">
<a class="nav-link sidebar-link" href="/admin/users">
<i class="feather" data-feather="user"></i> &nbsp;
{{{feather 'user'}}} &nbsp;
Users
</a>
<a class="sidebar-link-addon text-muted" href="/admin/user/new">
<i class="feather" data-feather="plus"></i>
{{{feather 'plus'}}}
</a>
</li>
</ul>
@ -64,26 +64,26 @@
<ul class="nav flex-column mb-2">
<li class="nav-item">
<a class="nav-link" href="/admin/settings">
<i class="feather" data-feather="sliders"></i> &nbsp;
{{{feather 'sliders'}}} &nbsp;
{{ @root.__ "General settings" }}
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/admin/settings/menu">
<i class="feather" data-feather="menu"></i> &nbsp;
{{{feather 'menu'}}} &nbsp;
{{ @root.__ "Menu" }}
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/admin/settings/pages">
<i class="feather" data-feather="file-text"></i> &nbsp;
{{{feather 'file-text'}}} &nbsp;
{{ @root.__ "Static pages" }}
</a>
</li>
{{#ifCond session.isAdmin '===' true}}
<li class="nav-item">
<a class="nav-link" href="/admin/settings/discounts">
<i class="feather" data-feather="code"></i> &nbsp;
{{{feather 'code'}}} &nbsp;
{{ @root.__ "Discount codes" }}
</a>
</li>

View File

@ -8,7 +8,7 @@
<input type="text" name="product_filter" id="product_filter" class="form-control" placeholder="Filter products">
<div class="input-group-append">
<button class="btn btn-outline-success" id="btn_product_filter">Filter</button>
<a href="/admin/products" class="hidden-xs btn btn-outline-warning"><i class="feather" data-feather="x-octagon"></i></a>
<a href="/admin/products" class="hidden-xs btn btn-outline-warning">{{{feather 'x-octagon'}}}</a>
</div>
</div>
<p class="text-warning top-pad-10">{{ @root.__ "Products can be filtered by: product title or product description keywords" }}</p>
@ -25,7 +25,7 @@
</li>
{{#each results}}
<li class="list-group-item">
<button class="float-right btn text-danger btn-delete-product" data-id="{{this._id}}"> <i class="feather" data-feather="trash-2"></i></button>
<button class="float-right btn text-danger btn-delete-product" data-id="{{this._id}}"> {{{feather 'trash-2'}}}</button>
<h4 class="float-right"><input id="{{this._id}}" class="publishedState" type="checkbox" {{checkedState this.productPublished}}></h4>
<div class="top-pad-8"><a href="/admin/product/edit/{{this._id}}">{{this.productTitle}}</a></div>
</li>

View File

@ -11,7 +11,7 @@
{{#each menu.items}}
<div class="row drag-row" id="menuId-{{@key}}">
<input type="hidden" class="navId" value="{{title}}">
<div class="col-sm-1 dragable_item"><i class="feather" data-feather="move"></i></div>
<div class="col-sm-1 dragable_item">{{{feather 'move'}}}</div>
<div class="col-sm-2 dragable_item">
<input type="text" class="form-control navMenu navItem" value="{{title}}">
</div>
@ -20,10 +20,10 @@
</div>
<div class="col-sm-3 dragable_item">
<a class="btn btn-outline-danger settings-menu-delete" data-id="{{@key}}">
<i class="feather" data-feather="trash-2"></i>
{{{feather 'trash-2'}}}
</a>
<button type="submit" class="btn btn-outline-success" id="settings-menu-update" data-id="{{@key}}">
<i class="feather" data-feather="save"></i>
{{{feather 'save'}}}
</button>
</div>
</div>
@ -38,7 +38,7 @@
</div>
<div class="col-sm-3">
<button type="submit" id="settings-menu-new" class="btn btn-outline-success">
<i class="feather" data-feather="plus"></i>
{{{feather 'plus'}}}
</button>
</div>
</div>

View File

@ -38,7 +38,7 @@
</div>
</div>
<div class="col-4 col-md-2 no-pad-left">
<button class="btn btn-danger btn-delete-from-cart" data-id="{{../this.productId}}" data-cartid="{{../this.productId}}" type="button"><i class="feather" data-feather="trash-2"></i></button>
<button class="btn btn-danger btn-delete-from-cart" data-id="{{../this.productId}}" data-cartid="{{../this.productId}}" type="button">{{{feather 'trash-2'}}}</button>
</div>
{{else}}
<div class="col-12 col-md-8 no-pad-left mb-2"></div>

View File

@ -46,7 +46,7 @@
<button class="btn btn-outline-success" id="addDiscountCode">{{ @root.__ "Apply" }}</button>
</div>
<div class="input-group-append">
<button class="btn btn-outline-danger" id="removeDiscountCode"><i class="feather" data-feather="x"></i></button>
<button class="btn btn-outline-danger" id="removeDiscountCode">{{{feather 'x'}}}</button>
</div>
</div>
{{/if}}

View File

@ -4,9 +4,9 @@
<div class="col-sm-12 col-md-6 mr-auto">
{{#if result.productImage}}
<div class="title-image-container">
<div class="image-prev image-button"> <i class="feather" data-feather="chevron-right"></i></div>
<div class="image-prev image-button"> {{{feather 'chevron-left'}}}</div>
<img src="{{result.productImage}}" id="product-title-image" class="product-title-image img-fluid" alt="...">
<div class="image-next image-button"> <i class="feather" data-feather="chevron-left"></i></div>
<div class="image-next image-button"> {{{feather 'chevron-right'}}}</div>
</div>
{{else}}
<div class="title-image-container">

View File

@ -19,8 +19,8 @@
<span>{{ @root.__ "User" }}</span>
{{/isAnAdmin}}
{{#isAnAdmin @root.session.isAdmin}}
<a href="/admin/user/edit/{{../this._id}}"><i class="feather" data-feather="edit"></i></a>
<a href="#" class="userDelete text-danger" data-id="{{../this._id}}"><i class="feather" data-feather="trash-2"></i></a>
<a href="/admin/user/edit/{{../this._id}}">{{{feather 'edit'}}}</a>
<a href="#" class="userDelete text-danger" data-id="{{../this._id}}">{{{feather 'trash-2'}}}</a>
{{/isAnAdmin}}
</span>
</li>