mirror of
https://github.com/sergeyyarkov/digital-store.git
synced 2026-10-11 18:29:11 +03:00
Control-panel pages
This commit is contained in:
parent
266c21a4b6
commit
9d5e785a75
@ -191,6 +191,36 @@ function controlPanelCategoriesRoute(req, res) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function controlPanelContentRoute(req, res) {
|
||||||
|
res.render('admin/content', {
|
||||||
|
name: req.user.name,
|
||||||
|
email: req.user.email,
|
||||||
|
title: 'Digital-Store | Контент',
|
||||||
|
host: req.headers.host,
|
||||||
|
pageName: ['Контент', 'content'],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function controlPanelAdministratorsRoute(req, res) {
|
||||||
|
res.render('admin/administrators', {
|
||||||
|
name: req.user.name,
|
||||||
|
email: req.user.email,
|
||||||
|
title: 'Digital-Store | Администраторы',
|
||||||
|
host: req.headers.host,
|
||||||
|
pageName: ['Администраторы', 'administrators'],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function controlPanelDatabaseRoute(req, res) {
|
||||||
|
res.render('admin/database', {
|
||||||
|
name: req.user.name,
|
||||||
|
email: req.user.email,
|
||||||
|
title: 'Digital-Store | Настройка Базы Данных',
|
||||||
|
host: req.headers.host,
|
||||||
|
pageName: ['База данных', 'database'],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = function (server, db) {
|
module.exports = function (server, db) {
|
||||||
server.get('/', (req, res) => indexRoute(req, res, db));
|
server.get('/', (req, res) => indexRoute(req, res, db));
|
||||||
server.get('/api', (req, res) => getItemsRoute(req, res, db));
|
server.get('/api', (req, res) => getItemsRoute(req, res, db));
|
||||||
@ -202,4 +232,7 @@ module.exports = function (server, db) {
|
|||||||
server.get('/control-panel', checkAuthenticated, (req, res) => controlPanelRoute(req, res));
|
server.get('/control-panel', checkAuthenticated, (req, res) => controlPanelRoute(req, res));
|
||||||
server.get('/control-panel/items', checkAuthenticated, (req, res) => controlPanelItemsRoute(req, res));
|
server.get('/control-panel/items', checkAuthenticated, (req, res) => controlPanelItemsRoute(req, res));
|
||||||
server.get('/control-panel/categories', checkAuthenticated, (req, res) => controlPanelCategoriesRoute(req, res));
|
server.get('/control-panel/categories', checkAuthenticated, (req, res) => controlPanelCategoriesRoute(req, res));
|
||||||
|
server.get('/control-panel/content', checkAuthenticated, (req, res) => controlPanelContentRoute(req, res));
|
||||||
|
server.get('/control-panel/administrators', checkAuthenticated, (req, res) => controlPanelAdministratorsRoute(req, res));
|
||||||
|
server.get('/control-panel/database', checkAuthenticated, (req, res) => controlPanelDatabaseRoute(req, res));
|
||||||
}
|
}
|
||||||
|
|||||||
6
dist/public/css/style.css
vendored
6
dist/public/css/style.css
vendored
@ -744,8 +744,8 @@ div.table-items > table > tbody > tr > td:nth-child(7) > button.btn.orange {
|
|||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
}
|
}
|
||||||
.sidenav .collapsible-body>ul:not(.collapsible)>li.active, .sidenav.sidenav-fixed .collapsible-body>ul:not(.collapsible)>li.active {
|
.sidenav .collapsible-body>ul:not(.collapsible)>li.active, .sidenav.sidenav-fixed .collapsible-body>ul:not(.collapsible)>li.active {
|
||||||
background-color: #e6e6e6;
|
background-color: #4E978C;
|
||||||
}
|
}
|
||||||
.sidenav .collapsible-body>ul:not(.collapsible)>li.active a, .sidenav.sidenav-fixed .collapsible-body>ul:not(.collapsible)>li.active a {
|
.sidenav .collapsible-body>ul:not(.collapsible)>li.active a, .sidenav.sidenav-fixed .collapsible-body>ul:not(.collapsible)>li.active a, .sidenav.sidenav-fixed .collapsible-body>ul:not(.collapsible)>li.active i {
|
||||||
color: rgba(0,0,0,0.87);
|
color: #f6f6f6;
|
||||||
}
|
}
|
||||||
43
dist/public/js/admin/materialize.config.js
vendored
43
dist/public/js/admin/materialize.config.js
vendored
@ -1,16 +1,43 @@
|
|||||||
document.addEventListener('DOMContentLoaded', function () {
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
|
// Closest полифилл для ie11
|
||||||
|
(function() {
|
||||||
|
if (!Element.prototype.closest) {
|
||||||
|
Element.prototype.closest = function(css) {
|
||||||
|
var node = this;
|
||||||
|
|
||||||
|
while (node) {
|
||||||
|
if (node.matches(css)) return node;
|
||||||
|
else node = node.parentElement;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
// Matches полифилл для ie11
|
||||||
|
(function() {
|
||||||
|
if (!Element.prototype.matches) {
|
||||||
|
Element.prototype.matches = Element.prototype.matchesSelector ||
|
||||||
|
Element.prototype.webkitMatchesSelector ||
|
||||||
|
Element.prototype.mozMatchesSelector ||
|
||||||
|
Element.prototype.msMatchesSelector;
|
||||||
|
}
|
||||||
|
})()
|
||||||
|
|
||||||
M.Sidenav.init(document.querySelectorAll('.sidenav'));
|
M.Sidenav.init(document.querySelectorAll('.sidenav'));
|
||||||
M.Collapsible.init(document.querySelectorAll('.collapsible'));
|
M.Collapsible.init(document.querySelectorAll('.collapsible'));
|
||||||
M.Modal.init(document.querySelectorAll('.modal'));
|
M.Modal.init(document.querySelectorAll('.modal'));
|
||||||
|
|
||||||
//- active временно!!!!!
|
//- active временно!!!!!
|
||||||
const currentPage = document.querySelector('#editCollapse .collapsible-body ul').dataset.current;
|
const currentPage = document.querySelector('#currentPage').dataset.current;
|
||||||
const pages = document.querySelectorAll('#editCollapse .collapsible-body ul li');
|
const pages = Array.from(document.querySelectorAll('.collapsible li'));
|
||||||
pages.forEach(page => {
|
pages.forEach(function (page) {
|
||||||
if (currentPage === page.dataset.page) {
|
if (page.dataset.page) {
|
||||||
page.classList.add('active');
|
if (currentPage === page.dataset.page) {
|
||||||
const list = M.Collapsible.getInstance(document.querySelector('#editCollapse'));
|
document.querySelector('#dashboard').classList.remove('active');
|
||||||
list.open();
|
page.classList.add('active');
|
||||||
|
const collapse = M.Collapsible.getInstance(page.closest('.collapsible'));
|
||||||
|
collapse.open();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
11
dist/views/admin/administrators.pug
vendored
Normal file
11
dist/views/admin/administrators.pug
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
include ../assets/head.pug
|
||||||
|
body.has-fixed-sidenav
|
||||||
|
include ./assets/templates/header.pug
|
||||||
|
main.admin-main
|
||||||
|
.container
|
||||||
|
.row
|
||||||
|
.col.s12
|
||||||
|
h2 Редактирование администраторов
|
||||||
|
|
||||||
|
include ./assets/templates/footer.pug
|
||||||
|
include ./assets/scripts.pug
|
||||||
56
dist/views/admin/assets/templates/header.pug
vendored
56
dist/views/admin/assets/templates/header.pug
vendored
@ -25,36 +25,36 @@ header.admin-header
|
|||||||
i.material-icons exit_to_app
|
i.material-icons exit_to_app
|
||||||
li
|
li
|
||||||
.divider
|
.divider
|
||||||
li
|
li#currentPage(data-current=pageName[1])
|
||||||
a(href="#" class="subheader") Управление сайтом
|
a(href="#" class="subheader") Управление сайтом
|
||||||
li.no-padding
|
li.no-padding
|
||||||
li
|
li#dashboard.active
|
||||||
a(href="/control-panel" class="collapsible-header waves-effect")
|
a(href="/control-panel" class="collapsible-header waves-effect active")
|
||||||
i.material-icons dashboard
|
i.material-icons dashboard
|
||||||
| Статистика
|
| Статистика
|
||||||
ul#editCollapse.collapsible
|
ul.collapsible
|
||||||
li
|
li
|
||||||
a(href="#" class="collapsible-header waves-effect")
|
a(href="#" class="collapsible-header waves-effect")
|
||||||
i.material-icons edit
|
i.material-icons edit
|
||||||
| Редактирование
|
| Редактирование
|
||||||
.collapsible-body
|
.collapsible-body
|
||||||
ul(data-current=pageName[1])
|
ul
|
||||||
li(data-page="items")
|
li(data-page="items")
|
||||||
a(href='http://'+host+'/control-panel/items')
|
a(href='http://'+host+'/control-panel/items')
|
||||||
i.material-icons list
|
i.material-icons list
|
||||||
| Товары
|
| Товары
|
||||||
li(data-page="categories")
|
li(data-page="categories")
|
||||||
a(href='http://'+host+'/control-panel/categories')
|
a(href='http://'+host+'/control-panel/categories')
|
||||||
i.material-icons category
|
i.material-icons category
|
||||||
| Категории
|
| Категории
|
||||||
li(data-page="content")
|
li(data-page="content")
|
||||||
a(href="#content")
|
a(href='http://'+host+'/control-panel/content')
|
||||||
i.material-icons visibility
|
i.material-icons visibility
|
||||||
| Контент на сайте
|
| Контент на сайте
|
||||||
li(data-page="administrators")
|
li(data-page="administrators")
|
||||||
a(href="#administrators")
|
a(href='http://'+host+'/control-panel/administrators')
|
||||||
i.material-icons supervisor_account
|
i.material-icons supervisor_account
|
||||||
| Администраторы
|
| Администраторы
|
||||||
ul.collapsible
|
ul.collapsible
|
||||||
li
|
li
|
||||||
a(href="#" class="collapsible-header waves-effect")
|
a(href="#" class="collapsible-header waves-effect")
|
||||||
@ -62,8 +62,8 @@ header.admin-header
|
|||||||
| Настройки
|
| Настройки
|
||||||
.collapsible-body
|
.collapsible-body
|
||||||
ul
|
ul
|
||||||
li
|
li(data-page="database")
|
||||||
a(href="#items")
|
a(href='http://'+host+'/control-panel/database')
|
||||||
i.material-icons storage
|
i.material-icons storage
|
||||||
| База данных
|
| База данных
|
||||||
//- Модальные окна
|
//- Модальные окна
|
||||||
|
|||||||
11
dist/views/admin/content.pug
vendored
Normal file
11
dist/views/admin/content.pug
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
include ../assets/head.pug
|
||||||
|
body.has-fixed-sidenav
|
||||||
|
include ./assets/templates/header.pug
|
||||||
|
main.admin-main
|
||||||
|
.container
|
||||||
|
.row
|
||||||
|
.col.s12
|
||||||
|
h2 Редактирование контента
|
||||||
|
|
||||||
|
include ./assets/templates/footer.pug
|
||||||
|
include ./assets/scripts.pug
|
||||||
11
dist/views/admin/database.pug
vendored
Normal file
11
dist/views/admin/database.pug
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
include ../assets/head.pug
|
||||||
|
body.has-fixed-sidenav
|
||||||
|
include ./assets/templates/header.pug
|
||||||
|
main.admin-main
|
||||||
|
.container
|
||||||
|
.row
|
||||||
|
.col.s12
|
||||||
|
h2 Настройка БД
|
||||||
|
|
||||||
|
include ./assets/templates/footer.pug
|
||||||
|
include ./assets/scripts.pug
|
||||||
Loading…
x
Reference in New Issue
Block a user