fixed page path bug, added path to nav ui and api payload, added navigation to render template methodology

This commit is contained in:
Ro 2020-06-11 13:22:00 -07:00
parent ee7af528cd
commit c1615602c8
5 changed files with 15 additions and 8 deletions

View file

@ -102,7 +102,7 @@ export default class Book {
'path: ' +
moment(body.created).format('YYYY') +
'/' +
moment().format('MM') +
moment(body.created).format('MM') +
'\n' +
'layout: ' +
layout +

View file

@ -2,6 +2,7 @@ import * as DataEvent from '../../src/com/events/DataEvent';
import StringUtils from '../../src/com/utils/StringUtils';
import fs from 'fs-extra';
import sanitize from 'sanitize-html';
import Settings from './Settings';
const config = require('../../site/settings.json');
const tags_list = require('../../site/tags.json');
const pug = require('pug');
@ -66,7 +67,8 @@ export default class Render {
title: page.metadata.title,
default_bg: page.metadata.feature,
content: html,
tags: page.metadata.tags
tags: page.metadata.tags,
menu: config.menu
});
fs.ensureDir(path).then(() => {

View file

@ -7,7 +7,7 @@ const book = new Book();
//--------------------------
// SETTINGS
//--------------------------
router.get('/', function(req, res) {
router.get('/', function (req, res) {
if (req.session.user) {
var nav = [];
book.getPage()
@ -20,7 +20,8 @@ router.get('/', function(req, res) {
id: item.id,
uuid: item.uuid,
title: item.title,
slug: item.slug
slug: item.slug,
path: item.path
});
}
}
@ -34,7 +35,8 @@ router.get('/', function(req, res) {
id: item.id,
uuid: item.uuid,
title: item.title,
slug: item.slug
slug: item.slug,
path: item.path
});
}
for (let i = 0; i < newpages.length; i++) {
@ -45,7 +47,8 @@ router.get('/', function(req, res) {
id: newpages[i].id,
uuid: newpages[i].uuid,
title: newpages[i].title,
slug: newpages[i].slug
slug: newpages[i].slug,
path: newpages[i].path
});
}
}
@ -59,6 +62,7 @@ router.get('/', function(req, res) {
})
.catch(err => {
//console.log('ERROR', err);
//render error pages
});
} else {
res.redirect('/@/dashboard');

View file

@ -5,7 +5,7 @@ block main-content
#nav-pages
- var index = 0;
- for ( index; index < menu.length; index++)
.nav-item(id=menu[index].id, data-slug=menu[index].slug, data-uuid=menu[index].uuid)
.nav-item(id=menu[index].id, data-slug=menu[index].slug, data-uuid=menu[index].uuid, data-path=menu[index].path)
svg#item-arrows(viewBox="0 0 20 20" class="icons")
use(xlink:href='/assets/images/global/sprite.svg#entypo-select-arrows')
label

View file

@ -14,7 +14,8 @@ export default class NavActions {
title: items[index].getElementsByTagName('label')[0].innerHTML,
id: items[index].id,
slug: items[index].getAttribute('data-slug'),
uuid: items[index].getAttribute('data-uuid')
uuid: items[index].getAttribute('data-uuid'),
path: items[index].getAttribute('data-path')
});
}
return new Promise(function (resolve) {