mirror of
https://github.com/sergeyyarkov/digital-store.git
synced 2026-10-11 10:19:15 +03:00
theme site
This commit is contained in:
parent
8a9b907b40
commit
f33fd4f857
@ -143,6 +143,23 @@ module.exports = function (server, db) {
|
||||
}
|
||||
});
|
||||
|
||||
server.get('/control-panel/theme', checkAuthenticated, async (req, res) => {
|
||||
try {
|
||||
const store = await db.collection('content').findOne({});
|
||||
res.render('admin/theme', {
|
||||
id: req.user.id,
|
||||
name: req.user.name,
|
||||
email: req.user.email,
|
||||
title: `${store.title} | Оформление`,
|
||||
host: req.headers.host,
|
||||
pageName: ['Оформление', 'theme'],
|
||||
color: store.color
|
||||
});
|
||||
} catch {
|
||||
res.status(500).render('main/404');
|
||||
}
|
||||
});
|
||||
|
||||
// редактирование категорий
|
||||
server.post('/control-panel/categories/create', checkAuthenticated, (req, res) => {
|
||||
try {
|
||||
@ -299,5 +316,18 @@ module.exports = function (server, db) {
|
||||
} catch {
|
||||
res.status(500).render('main/404');
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
// формление
|
||||
server.post('/control-panel/theme/update', checkAuthenticated, (req, res) => {
|
||||
try {
|
||||
const data = {
|
||||
color: req.body.color
|
||||
}
|
||||
db.collection('content').updateOne({}, {$set: {color: data.color}});
|
||||
res.redirect('/control-panel/theme');
|
||||
} catch {
|
||||
res.status(500).render('main/404');
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -14,7 +14,8 @@ module.exports = function (server, db) {
|
||||
store: {
|
||||
title: store.title,
|
||||
info: store.info,
|
||||
infoBottom: store.infoBottom
|
||||
infoBottom: store.infoBottom,
|
||||
color: store.color
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -30,7 +31,8 @@ module.exports = function (server, db) {
|
||||
title: `${store.title} | Как купить товар`,
|
||||
store: {
|
||||
title: store.title,
|
||||
howToBuy: store.howToBuy
|
||||
howToBuy: store.howToBuy,
|
||||
color: store.color
|
||||
}
|
||||
});
|
||||
} catch {
|
||||
@ -45,7 +47,8 @@ module.exports = function (server, db) {
|
||||
title: `${store.title} | Контакты`,
|
||||
store: {
|
||||
title: store.title,
|
||||
contacts: store.contacts
|
||||
contacts: store.contacts,
|
||||
color: store.color
|
||||
}
|
||||
});
|
||||
} catch {
|
||||
@ -59,7 +62,8 @@ module.exports = function (server, db) {
|
||||
pageName: 'comments',
|
||||
title: `${store.title} | Отзывы`,
|
||||
store: {
|
||||
title: store.title
|
||||
title: store.title,
|
||||
color: store.color
|
||||
}
|
||||
});
|
||||
} catch {
|
||||
@ -73,7 +77,8 @@ module.exports = function (server, db) {
|
||||
pageName: 'my-orders',
|
||||
title: `${store.title} | Мои покупки`,
|
||||
store: {
|
||||
title: store.title
|
||||
title: store.title,
|
||||
color: store.color
|
||||
}
|
||||
});
|
||||
} catch {
|
||||
@ -115,7 +120,8 @@ module.exports = function (server, db) {
|
||||
format: category.format,
|
||||
store: {
|
||||
title: store.title,
|
||||
recommendations: store.recommendations
|
||||
recommendations: store.recommendations,
|
||||
color: store.color
|
||||
}
|
||||
});
|
||||
}))
|
||||
|
||||
4
dist/views/admin/assets/templates/header.pug
vendored
4
dist/views/admin/assets/templates/header.pug
vendored
@ -55,6 +55,10 @@ header.admin-header
|
||||
a(href='http://'+host+'/control-panel/content')
|
||||
i.material-icons visibility
|
||||
| Контент на сайте
|
||||
li(data-page="theme")
|
||||
a(href='http://'+host+'/control-panel/theme')
|
||||
i.material-icons create
|
||||
| Оформление
|
||||
ul.collapsible
|
||||
li
|
||||
a(href="#" class="collapsible-header waves-effect")
|
||||
|
||||
24
dist/views/admin/theme.pug
vendored
Normal file
24
dist/views/admin/theme.pug
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
include ./assets/head.pug
|
||||
body.has-fixed-sidenav
|
||||
include ./assets/templates/header.pug
|
||||
main.admin-main
|
||||
.container
|
||||
.row
|
||||
.col.s12
|
||||
h2 Изменить оформление
|
||||
p Измените оформление вашего магазине на этой странице.
|
||||
.col.s12
|
||||
#theme.card
|
||||
.card-content
|
||||
.theme-change
|
||||
h5 Общий цвета
|
||||
.row
|
||||
form(action="/control-panel/theme/update" method="POST")
|
||||
#color.input-field.col.s12
|
||||
input(id="color" type="text" pattern="^#(?:[0-9a-fA-F]{3}){1,2}$" name="color" value=color required)
|
||||
label(for="color") Цвет в формате HEX (#000000)
|
||||
.edit_success.col.s12
|
||||
button(type="submit" class="btn waves-effect") Сохранить
|
||||
|
||||
include ./assets/templates/footer.pug
|
||||
include ./assets/scripts.pug
|
||||
12
dist/views/main/assets/head.pug
vendored
12
dist/views/main/assets/head.pug
vendored
@ -13,4 +13,16 @@ html(lang='ru')
|
||||
link(rel="stylesheet", href="/css/media.css")
|
||||
// Material Icons
|
||||
link(rel="stylesheet", href="https://fonts.googleapis.com/icon?family=Material+Icons")
|
||||
if store
|
||||
style.
|
||||
nav, footer.main-footer, .items-category, .category-items li .active, .category-items li a:hover, .progress .indeterminate, button {
|
||||
background-color: #{store.color} !important;
|
||||
}
|
||||
button:hover {
|
||||
background-color: #{store.color} !important;
|
||||
opacity: .7;
|
||||
}
|
||||
.progress {
|
||||
background-color: #deecea;
|
||||
}
|
||||
body
|
||||
6
dist/views/main/my-orders.pug
vendored
6
dist/views/main/my-orders.pug
vendored
@ -28,13 +28,13 @@ main.main-section
|
||||
.orders-text
|
||||
hr
|
||||
p
|
||||
strong Введите почту
|
||||
strong Введите вашу почту и мы вышлем вам ваши товары которые вы оплачивали
|
||||
p
|
||||
form(action='#')
|
||||
.email-field(style='max-width: 400px;margin-bottom: 10px;')
|
||||
.email-field(style='margin-bottom: 10px;')
|
||||
label(for='email') Почта
|
||||
input#email(required='' type='email' name='email')
|
||||
.show-orders
|
||||
.show-orders(style='display: flex;justify-content: flex-end;')
|
||||
button.waves-effect.waves-light.btn(type='submit') Узнать
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user