mirror of
https://github.com/sergeyyarkov/digital-store.git
synced 2026-10-11 10:19:15 +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) {
|
||||
server.get('/', (req, res) => indexRoute(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/items', checkAuthenticated, (req, res) => controlPanelItemsRoute(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;
|
||||
}
|
||||
.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 {
|
||||
color: rgba(0,0,0,0.87);
|
||||
.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: #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 () {
|
||||
// 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.Collapsible.init(document.querySelectorAll('.collapsible'));
|
||||
M.Modal.init(document.querySelectorAll('.modal'));
|
||||
|
||||
//- active временно!!!!!
|
||||
const currentPage = document.querySelector('#editCollapse .collapsible-body ul').dataset.current;
|
||||
const pages = document.querySelectorAll('#editCollapse .collapsible-body ul li');
|
||||
pages.forEach(page => {
|
||||
if (currentPage === page.dataset.page) {
|
||||
page.classList.add('active');
|
||||
const list = M.Collapsible.getInstance(document.querySelector('#editCollapse'));
|
||||
list.open();
|
||||
const currentPage = document.querySelector('#currentPage').dataset.current;
|
||||
const pages = Array.from(document.querySelectorAll('.collapsible li'));
|
||||
pages.forEach(function (page) {
|
||||
if (page.dataset.page) {
|
||||
if (currentPage === page.dataset.page) {
|
||||
document.querySelector('#dashboard').classList.remove('active');
|
||||
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
|
||||
li
|
||||
.divider
|
||||
li
|
||||
li#currentPage(data-current=pageName[1])
|
||||
a(href="#" class="subheader") Управление сайтом
|
||||
li.no-padding
|
||||
li
|
||||
a(href="/control-panel" class="collapsible-header waves-effect")
|
||||
li#dashboard.active
|
||||
a(href="/control-panel" class="collapsible-header waves-effect active")
|
||||
i.material-icons dashboard
|
||||
| Статистика
|
||||
ul#editCollapse.collapsible
|
||||
li
|
||||
a(href="#" class="collapsible-header waves-effect")
|
||||
i.material-icons edit
|
||||
| Редактирование
|
||||
.collapsible-body
|
||||
ul(data-current=pageName[1])
|
||||
li(data-page="items")
|
||||
a(href='http://'+host+'/control-panel/items')
|
||||
i.material-icons list
|
||||
| Товары
|
||||
li(data-page="categories")
|
||||
a(href='http://'+host+'/control-panel/categories')
|
||||
i.material-icons category
|
||||
| Категории
|
||||
li(data-page="content")
|
||||
a(href="#content")
|
||||
i.material-icons visibility
|
||||
| Контент на сайте
|
||||
li(data-page="administrators")
|
||||
a(href="#administrators")
|
||||
i.material-icons supervisor_account
|
||||
| Администраторы
|
||||
ul.collapsible
|
||||
li
|
||||
a(href="#" class="collapsible-header waves-effect")
|
||||
i.material-icons edit
|
||||
| Редактирование
|
||||
.collapsible-body
|
||||
ul
|
||||
li(data-page="items")
|
||||
a(href='http://'+host+'/control-panel/items')
|
||||
i.material-icons list
|
||||
| Товары
|
||||
li(data-page="categories")
|
||||
a(href='http://'+host+'/control-panel/categories')
|
||||
i.material-icons category
|
||||
| Категории
|
||||
li(data-page="content")
|
||||
a(href='http://'+host+'/control-panel/content')
|
||||
i.material-icons visibility
|
||||
| Контент на сайте
|
||||
li(data-page="administrators")
|
||||
a(href='http://'+host+'/control-panel/administrators')
|
||||
i.material-icons supervisor_account
|
||||
| Администраторы
|
||||
ul.collapsible
|
||||
li
|
||||
a(href="#" class="collapsible-header waves-effect")
|
||||
@ -62,8 +62,8 @@ header.admin-header
|
||||
| Настройки
|
||||
.collapsible-body
|
||||
ul
|
||||
li
|
||||
a(href="#items")
|
||||
li(data-page="database")
|
||||
a(href='http://'+host+'/control-panel/database')
|
||||
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