fixed page path bug, added path to nav ui and api payload, added navigation to render template methodology
This commit is contained in:
parent
ee7af528cd
commit
c1615602c8
5 changed files with 15 additions and 8 deletions
|
@ -102,7 +102,7 @@ export default class Book {
|
||||||
'path: ' +
|
'path: ' +
|
||||||
moment(body.created).format('YYYY') +
|
moment(body.created).format('YYYY') +
|
||||||
'/' +
|
'/' +
|
||||||
moment().format('MM') +
|
moment(body.created).format('MM') +
|
||||||
'\n' +
|
'\n' +
|
||||||
'layout: ' +
|
'layout: ' +
|
||||||
layout +
|
layout +
|
||||||
|
|
|
@ -2,6 +2,7 @@ import * as DataEvent from '../../src/com/events/DataEvent';
|
||||||
import StringUtils from '../../src/com/utils/StringUtils';
|
import StringUtils from '../../src/com/utils/StringUtils';
|
||||||
import fs from 'fs-extra';
|
import fs from 'fs-extra';
|
||||||
import sanitize from 'sanitize-html';
|
import sanitize from 'sanitize-html';
|
||||||
|
import Settings from './Settings';
|
||||||
const config = require('../../site/settings.json');
|
const config = require('../../site/settings.json');
|
||||||
const tags_list = require('../../site/tags.json');
|
const tags_list = require('../../site/tags.json');
|
||||||
const pug = require('pug');
|
const pug = require('pug');
|
||||||
|
@ -66,7 +67,8 @@ export default class Render {
|
||||||
title: page.metadata.title,
|
title: page.metadata.title,
|
||||||
default_bg: page.metadata.feature,
|
default_bg: page.metadata.feature,
|
||||||
content: html,
|
content: html,
|
||||||
tags: page.metadata.tags
|
tags: page.metadata.tags,
|
||||||
|
menu: config.menu
|
||||||
});
|
});
|
||||||
|
|
||||||
fs.ensureDir(path).then(() => {
|
fs.ensureDir(path).then(() => {
|
||||||
|
|
|
@ -7,7 +7,7 @@ const book = new Book();
|
||||||
//--------------------------
|
//--------------------------
|
||||||
// SETTINGS
|
// SETTINGS
|
||||||
//--------------------------
|
//--------------------------
|
||||||
router.get('/', function(req, res) {
|
router.get('/', function (req, res) {
|
||||||
if (req.session.user) {
|
if (req.session.user) {
|
||||||
var nav = [];
|
var nav = [];
|
||||||
book.getPage()
|
book.getPage()
|
||||||
|
@ -20,7 +20,8 @@ router.get('/', function(req, res) {
|
||||||
id: item.id,
|
id: item.id,
|
||||||
uuid: item.uuid,
|
uuid: item.uuid,
|
||||||
title: item.title,
|
title: item.title,
|
||||||
slug: item.slug
|
slug: item.slug,
|
||||||
|
path: item.path
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +35,8 @@ router.get('/', function(req, res) {
|
||||||
id: item.id,
|
id: item.id,
|
||||||
uuid: item.uuid,
|
uuid: item.uuid,
|
||||||
title: item.title,
|
title: item.title,
|
||||||
slug: item.slug
|
slug: item.slug,
|
||||||
|
path: item.path
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
for (let i = 0; i < newpages.length; i++) {
|
for (let i = 0; i < newpages.length; i++) {
|
||||||
|
@ -45,7 +47,8 @@ router.get('/', function(req, res) {
|
||||||
id: newpages[i].id,
|
id: newpages[i].id,
|
||||||
uuid: newpages[i].uuid,
|
uuid: newpages[i].uuid,
|
||||||
title: newpages[i].title,
|
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 => {
|
.catch(err => {
|
||||||
//console.log('ERROR', err);
|
//console.log('ERROR', err);
|
||||||
|
//render error pages
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
res.redirect('/@/dashboard');
|
res.redirect('/@/dashboard');
|
||||||
|
|
|
@ -5,7 +5,7 @@ block main-content
|
||||||
#nav-pages
|
#nav-pages
|
||||||
- var index = 0;
|
- var index = 0;
|
||||||
- for ( index; index < menu.length; index++)
|
- 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")
|
svg#item-arrows(viewBox="0 0 20 20" class="icons")
|
||||||
use(xlink:href='/assets/images/global/sprite.svg#entypo-select-arrows')
|
use(xlink:href='/assets/images/global/sprite.svg#entypo-select-arrows')
|
||||||
label
|
label
|
||||||
|
|
|
@ -14,7 +14,8 @@ export default class NavActions {
|
||||||
title: items[index].getElementsByTagName('label')[0].innerHTML,
|
title: items[index].getElementsByTagName('label')[0].innerHTML,
|
||||||
id: items[index].id,
|
id: items[index].id,
|
||||||
slug: items[index].getAttribute('data-slug'),
|
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) {
|
return new Promise(function (resolve) {
|
||||||
|
|
Loading…
Reference in a new issue