Skip to content

Commit

Permalink
Merge branch 'ds/issue186' into 'develop'
Browse files Browse the repository at this point in the history
Ds/issue186

See merge request PBSA/dapps/NFT-store!83
  • Loading branch information
Dipak Savaliya committed Jul 16, 2021
2 parents 1a8972f + 34cb455 commit c5de568
Show file tree
Hide file tree
Showing 12 changed files with 61 additions and 12 deletions.
8 changes: 4 additions & 4 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,11 +330,11 @@ handlebars = handlebars.create({
<use xlink:href="/dist/feather-sprite.svg#${icon}"/>
</svg>`;
},
eqHidden: (lvalue, rvalue) => {
return lvalue === rvalue ? 'd-none' : 'd-flex';
eqClass: (lvalue, rvalue, trueval, falseval) => {
return lvalue === rvalue ? trueval : falseval;
},
neqHidden: (lvalue, rvalue) => {
return lvalue !== rvalue ? 'd-none' : 'd-flex';
neqClass: (lvalue, rvalue, trueval, falseval) => {
return lvalue !== rvalue ? trueval : falseval;
}
}
});
Expand Down
3 changes: 2 additions & 1 deletion locales/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -205,5 +205,6 @@
"Request Date": "Data richiesta",
"NFTs purchased": "NFT acquistati",
"View": "Visualizza",
"Logout": "Disconnettersi"
"Logout": "Disconnettersi",
"Company": "Company"
}
12 changes: 12 additions & 0 deletions routes/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ router.get('/admin/login', async (req, res) => {
req.session.needsSetup = false;
res.render('login', {
title: 'Login',
language: req.cookies.locale || config.defaultLocale,
referringUrl: req.header('Referer'),
config: req.app.config,
message: clearSessionValue(req.session, 'message'),
Expand Down Expand Up @@ -230,6 +231,7 @@ router.get('/admin/setup', async (req, res) => {
res.render('setup', {
title: 'Setup',
config: req.app.config,
language: req.cookies.locale || config.defaultLocale,
helpers: req.handlebars.helpers,
message: clearSessionValue(req.session, 'message'),
messageType: clearSessionValue(req.session, 'messageType'),
Expand Down Expand Up @@ -379,6 +381,7 @@ router.get('/admin/dashboard', csrfProtection, restrict, async (req, res) => {
res.render('dashboard', {
title: 'Cart dashboard',
session: req.session,
language: req.cookies.locale || config.defaultLocale,
admin: true,
dashboardData,
themes: getThemes(),
Expand All @@ -396,6 +399,7 @@ router.get('/admin/settings', csrfProtection, restrict, (req, res) => {
res.render('settings', {
title: 'Cart settings',
session: req.session,
language: req.cookies.locale || config.defaultLocale,
admin: true,
themes: getThemes(),
message: clearSessionValue(req.session, 'message'),
Expand Down Expand Up @@ -423,6 +427,7 @@ router.get('/admin/redemptions', restrict, checkAccess, async (req, res) => {
res.render('redemptions', {
title: 'Redeem Requests',
config: req.app.config,
language: req.cookies.locale || config.defaultLocale,
helpers: req.handlebars.helpers,
redemptions,
message: clearSessionValue(req.session, 'message'),
Expand Down Expand Up @@ -471,6 +476,7 @@ router.get('/admin/settings/menu', csrfProtection, restrict, async (req, res) =>
res.render('settings-menu', {
title: 'Cart menu',
session: req.session,
language: req.cookies.locale || config.defaultLocale,
admin: true,
message: clearSessionValue(req.session, 'message'),
messageType: clearSessionValue(req.session, 'messageType'),
Expand All @@ -491,6 +497,7 @@ router.get('/admin/settings/pages', csrfProtection, restrict, async (req, res) =
title: 'Static pages',
pages: pages,
session: req.session,
language: req.cookies.locale || config.defaultLocale,
admin: true,
message: clearSessionValue(req.session, 'message'),
messageType: clearSessionValue(req.session, 'messageType'),
Expand All @@ -509,6 +516,7 @@ router.get('/admin/settings/pages/new', csrfProtection, restrict, checkAccess, a
res.render('settings-page', {
title: 'Static pages',
session: req.session,
language: req.cookies.locale || config.defaultLocale,
admin: true,
button_text: 'Create',
message: clearSessionValue(req.session, 'message'),
Expand Down Expand Up @@ -543,6 +551,7 @@ router.get('/admin/settings/pages/edit/:page', csrfProtection, restrict, checkAc
page: page,
button_text: 'Update',
session: req.session,
language: req.cookies.locale || config.defaultLocale,
admin: true,
message: clearSessionValue(req.session, 'message'),
messageType: clearSessionValue(req.session, 'messageType'),
Expand Down Expand Up @@ -681,6 +690,7 @@ router.get('/admin/settings/discounts', csrfProtection, restrict, checkAccess, a
title: 'Discount code',
config: req.app.config,
session: req.session,
language: req.cookies.locale || config.defaultLocale,
discounts,
admin: true,
message: clearSessionValue(req.session, 'message'),
Expand All @@ -700,6 +710,7 @@ router.get('/admin/settings/discount/edit/:id', csrfProtection, restrict, checkA
res.render('settings-discount-edit', {
title: 'Discount code edit',
session: req.session,
language: req.cookies.locale || config.defaultLocale,
admin: true,
discount,
message: clearSessionValue(req.session, 'message'),
Expand Down Expand Up @@ -770,6 +781,7 @@ router.get('/admin/settings/discount/new', csrfProtection, restrict, checkAccess
res.render('settings-discount-new', {
title: 'Discount code create',
session: req.session,
language: req.cookies.locale || config.defaultLocale,
admin: true,
message: clearSessionValue(req.session, 'message'),
messageType: clearSessionValue(req.session, 'messageType'),
Expand Down
9 changes: 8 additions & 1 deletion routes/customer.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ router.get('/customer/setup', async (req, res) => {
res.render('customer-create', {
title: 'Register',
config: req.app.config,
language: req.cookies.locale || config.defaultLocale,
helpers: req.handlebars.helpers,
session: req.session,
message: clearSessionValue(req.session, 'message'),
Expand Down Expand Up @@ -212,7 +213,6 @@ router.post('/customer/save', async (req, res) => {
router.get('/customer/account', async (req, res) => {
const db = req.app.db;
const config = req.app.config;

if(!req.session.customerPresent){
res.redirect('/customer/login');
return;
Expand Down Expand Up @@ -258,6 +258,7 @@ router.get('/customer/account', async (req, res) => {
session: req.session,
orders,
user,
language: req.cookies.locale || config.defaultLocale,
balance: balance ? (balance.balance / Math.pow(10, config.peerplaysAssetPrecision)).toFixed(config.peerplaysAssetPrecision) : 0,
transferFees,
message: clearSessionValue(req.session, 'message'),
Expand Down Expand Up @@ -511,6 +512,7 @@ router.get('/admin/customer/view/:id?', restrict, async (req, res) => {
return res.render('customer', {
title: 'View customer',
result: customer,
language: req.cookies.locale || config.defaultLocale,
admin: true,
session: req.session,
message: clearSessionValue(req.session, 'message'),
Expand All @@ -537,6 +539,7 @@ router.get('/admin/customers', restrict, async (req, res) => {
return res.render('customers', {
title: 'Customers - List',
admin: true,
language: req.cookies.locale || config.defaultLocale,
customers: customers,
session: req.session,
helpers: req.handlebars.helpers,
Expand Down Expand Up @@ -571,6 +574,7 @@ router.get('/admin/customers/filter/:search', restrict, async (req, res, next) =
return res.render('customers', {
title: 'Customer results',
customers: customers,
language: req.cookies.locale || config.defaultLocale,
admin: true,
config: req.app.config,
session: req.session,
Expand Down Expand Up @@ -620,6 +624,7 @@ router.get('/customer/login', async (req, res, next) => {
title: 'Customer login',
config: req.app.config,
session: req.session,
language: req.cookies.locale || config.deafultLocale,
message: clearSessionValue(req.session, 'message'),
messageType: clearSessionValue(req.session, 'messageType'),
pageUrl: req.originalUrl,
Expand Down Expand Up @@ -743,6 +748,7 @@ router.get('/customer/forgotten', (req, res) => {
title: 'Forgotten',
route: 'customer',
forgotType: 'customer',
language: req.cookies.locale || config.defaultLocale,
config: req.app.config,
helpers: req.handlebars.helpers,
message: clearSessionValue(req.session, 'message'),
Expand Down Expand Up @@ -810,6 +816,7 @@ router.get('/customer/reset/:token', async (req, res) => {
res.render('reset', {
title: 'Reset password',
token: req.params.token,
language: req.cookies.locale || config.defaultLocale,
route: 'customer',
config: req.app.config,
message: clearSessionValue(req.session, 'message'),
Expand Down
12 changes: 12 additions & 0 deletions routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ router.get('/payment/:orderId', async (req, res, next) => {
title: 'Payment complete',
config: req.app.config,
session: req.session,
language: req.cookies.locale || config.defaultLocale,
result: order,
message: clearSessionValue(req.session, 'message'),
messageType: clearSessionValue(req.session, 'messageType'),
Expand Down Expand Up @@ -197,6 +198,7 @@ router.get('/checkout/information', async (req, res, next) => {
title: 'Checkout - Information',
config: req.app.config,
session: req.session,
language: req.cookies.locale || config.defaultLocale,
paymentType,
cartClose: false,
page: 'checkout-information',
Expand Down Expand Up @@ -242,6 +244,7 @@ router.get('/checkout/shipping', async (req, res, next) => {
config: req.app.config,
session: req.session,
cartClose: false,
language: req.cookies.locale || config.defaultLocale,
cartReadOnly: true,
page: 'checkout-shipping',
countryList,
Expand All @@ -258,6 +261,7 @@ router.get('/checkout/cart', (req, res) => {
res.render(`${config.themeViews}checkout-cart`, {
title: 'Checkout - Cart',
page: req.query.path,
language: req.cookies.locale || config.defaultLocale,
config,
session: req.session,
message: clearSessionValue(req.session, 'message'),
Expand Down Expand Up @@ -301,6 +305,7 @@ router.get('/checkout/payment/:ppyAmount', async (req, res) => {
config: req.app.config,
paymentConfig: getPaymentConfig(),
session: req.session,
language: req.cookies.locale || config.defaultLocale,
paymentPage: true,
paymentType: '',
cartClose: true,
Expand Down Expand Up @@ -328,6 +333,7 @@ router.get('/blockonomics_payment', (req, res, next) => {
config: req.app.config,
paymentConfig: getPaymentConfig(),
session: req.session,
language: req.cookies.locale || config.defaultLocale,
paymentPage: true,
paymentType,
cartClose: true,
Expand Down Expand Up @@ -604,6 +610,7 @@ router.get('/product/:id/:offerId', async (req, res) => {
title: product.productTitle,
result: product,
relatedProducts,
language: req.cookies.locale || config.defaultLocale,
balance,
fee,
bidFee,
Expand Down Expand Up @@ -1118,6 +1125,7 @@ router.get('/search/:searchTerm?/:pageNum?', (req, res) => {
res.render(`${config.themeViews}index`, {
title: 'Results',
results: results.data,
language: req.cookies.locale || config.defaultLocale,
filtered: true,
session: req.session,
metaDescription: `${req.app.config.cartTitle} - Search term: ${searchTerm}`,
Expand Down Expand Up @@ -1175,6 +1183,7 @@ router.get('/category/:cat/:pageNum?', (req, res) => {
title: `Category: ${searchTerm}`,
results: results.data,
filtered: true,
language: req.cookies.locale || config.defaultLocale,
session: req.session,
searchTerm: searchTerm,
metaDescription: `${req.app.config.cartTitle} - Category: ${searchTerm}`,
Expand Down Expand Up @@ -1260,6 +1269,7 @@ router.get('/page/:pageNum', (req, res, next) => {
title: 'Shop',
results: results.data,
session: req.session,
language: req.cookies.locale || config.defaultLocale,
message: clearSessionValue(req.session, 'message'),
messageType: clearSessionValue(req.session, 'messageType'),
metaDescription: `${req.app.config.cartTitle} - Products page: ${req.params.pageNum}`,
Expand Down Expand Up @@ -1301,6 +1311,7 @@ router.get('/:page?', async (req, res, next) => {
res.render(`${config.themeViews}index`, {
title: `${config.cartTitle} - Shop`,
theme: config.theme,
language: req.cookies.locale || config.defaultLocale,
results: results.data,
session: req.session,
message: clearSessionValue(req.session, 'message'),
Expand Down Expand Up @@ -1332,6 +1343,7 @@ router.get('/:page?', async (req, res, next) => {
title: page.pageName,
page: page,
searchTerm: req.params.page,
language: req.cookies.locale || config.defaultLocale,
session: req.session,
message: clearSessionValue(req.session, 'message'),
messageType: clearSessionValue(req.session, 'messageType'),
Expand Down
7 changes: 6 additions & 1 deletion routes/order.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const {
clearCustomer
} = require('../lib/common');
const {
paginateData,
paginateData
} = require('../lib/paginate');
const {
emptyCart
Expand Down Expand Up @@ -40,6 +40,7 @@ router.get('/admin/orders/:page?', restrict, async (req, res, next) => {
title: 'Cart',
orders: orders.data,
totalItemCount: orders.totalItems,
language: req.cookies.locale || config.defaultLocale,
pageNum,
paginateUrl: 'admin/orders',
admin: true,
Expand Down Expand Up @@ -78,6 +79,7 @@ router.get('/admin/orders/bystatus/:orderstatus', restrict, async (req, res, nex
orders: orders,
admin: true,
filteredOrders: true,
language: req.cookies.locale || config.defaultLocale,
filteredStatus: req.params.orderstatus,
config: req.app.config,
session: req.session,
Expand All @@ -97,6 +99,7 @@ router.get('/admin/order/view/:id', restrict, async (req, res) => {
title: 'View order',
result: order,
config: req.app.config,
language: req.cookies.locale || config.defaultLocale,
session: req.session,
message: clearSessionValue(req.session, 'message'),
messageType: clearSessionValue(req.session, 'messageType'),
Expand All @@ -113,6 +116,7 @@ router.get('/admin/order/create', restrict, async (req, res) => {
title: 'Create order',
config: req.app.config,
session: req.session,
language: req.cookies.locale || config.defaultLocale,
message: clearSessionValue(req.session, 'message'),
messageType: clearSessionValue(req.session, 'messageType'),
countryList: getCountryList(),
Expand Down Expand Up @@ -236,6 +240,7 @@ router.get('/admin/orders/filter/:search', restrict, async (req, res, next) => {
title: 'Order results',
orders: orders,
admin: true,
language: req.cookies.locale || config.defaultLocale,
config: req.app.config,
session: req.session,
searchTerm: searchTerm,
Expand Down
4 changes: 4 additions & 0 deletions routes/product.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ router.get('/customer/products/:page?', async (req, res, next) => {

res.render('products', {
title: 'My NFTs',
language: req.cookies.locale || config.defaultLocale,
results: products.data,
purchases,
totalItemCount: products.totalItems,
Expand Down Expand Up @@ -405,6 +406,7 @@ router.get('/customer/products/filter/:search', async (req, res, next) => {
res.render('products', {
title: 'Results',
results: results,
language: req.cookies.locale || config.defaultLocale,
resultType: 'filtered',
admin: req.session.isAdmin || false,
mintFee,
Expand Down Expand Up @@ -454,6 +456,7 @@ router.get('/customer/product/new', async (req, res) => {
res.render('product-new', {
title: 'New NFT',
session: req.session,
language: req.cookies.locale || config.defaultLocale,
productTitle: clearSessionValue(req.session, 'productTitle'),
productDescription: clearSessionValue(req.session, 'productDescription'),
productPermalink: clearSessionValue(req.session, 'productPermalink'),
Expand Down Expand Up @@ -770,6 +773,7 @@ router.get('/customer/product/edit/:id', async (req, res) => {
title: 'Edit product',
result: product,
admin: false,
language: req.cookies.locale || config.defaultLocale,
session: req.session,
updateFee,
updateFeeFloat,
Expand Down
2 changes: 2 additions & 0 deletions routes/reviews.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ router.get('/admin/reviews/:page?', restrict, async (req, res, next) => {
res.render('reviews', {
title: 'Cart - Reviews',
results: reviews.data,
language: req.cookies.locale || config.defaultLocale,
totalItemCount: reviews.totalItems,
pageNum,
paginateUrl: 'admin/reviews',
Expand Down Expand Up @@ -57,6 +58,7 @@ router.get('/admin/reviews/filter/:search', restrict, async (req, res, next) =>
results: results,
resultType: 'filtered',
admin: true,
language: req.cookies.locale || config.defaultLocale,
config: req.app.config,
session: req.session,
searchTerm: searchTerm,
Expand Down
Loading

0 comments on commit c5de568

Please sign in to comment.