plugged in feeaturd posts into template
This commit is contained in:
parent
a4b945d31d
commit
302147df57
3 changed files with 15 additions and 3 deletions
|
@ -48,10 +48,10 @@ router.post('/sync', (req, res) => {
|
|||
message: 'Settings Saved'
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
.catch(err => {
|
||||
res.json({
|
||||
type: DataEvent.REQUEST_LAME,
|
||||
message: "You're not logged in, champ"
|
||||
message: "Uh oh. Settings didn't take, sport"
|
||||
});
|
||||
});
|
||||
})
|
||||
|
|
|
@ -36,6 +36,13 @@ export default class Render {
|
|||
let rendered = 0;
|
||||
let display_count = 0;
|
||||
let recent = [];
|
||||
let featured = _.filter(pages, page => {
|
||||
return (
|
||||
page.metadata.deleted === false &&
|
||||
page.metadata.published === true &&
|
||||
page.metadata.featured === true
|
||||
);
|
||||
});
|
||||
for (let index = 0; index < pages.length; index++) {
|
||||
pages.sort((a, b) => parseFloat(b.metadata.id) - parseFloat(a.metadata.id));
|
||||
|
||||
|
@ -52,6 +59,7 @@ export default class Render {
|
|||
display_count = ++display_count;
|
||||
}
|
||||
let writeFile, template;
|
||||
|
||||
let path =
|
||||
'public/' +
|
||||
moment(page.metadata.created).format('YYYY') +
|
||||
|
@ -91,6 +99,7 @@ export default class Render {
|
|||
});
|
||||
}
|
||||
buffed = new StringUtils().decodeHTML(buffed);
|
||||
|
||||
let html = md.render(buffed, { html: true, xhtmlOut: true });
|
||||
let file = pug.renderFile(template, {
|
||||
title: page.metadata.title,
|
||||
|
@ -99,6 +108,7 @@ export default class Render {
|
|||
tags: tags,
|
||||
menu: config.menu,
|
||||
recent_posts: recent,
|
||||
featured_posts: featured,
|
||||
meta: {
|
||||
who: author,
|
||||
when: moment(page.metadata.created).fromNow(),
|
||||
|
|
|
@ -19,6 +19,9 @@ export default class Settings {
|
|||
self.loadConfigData()
|
||||
.then(result => {
|
||||
let payload = req.body;
|
||||
//so payload matches loaded config
|
||||
payload.global.display_limit = result.settings.global.display_limit;
|
||||
payload.global.last_backup = result.settings.global.last_backup;
|
||||
let user = req.session.user;
|
||||
let found = _.find(result.folks, { id: user.id });
|
||||
let needToUpdate = false;
|
||||
|
@ -44,7 +47,6 @@ export default class Settings {
|
|||
};
|
||||
reject(response);
|
||||
}
|
||||
|
||||
if (!_.isEqual(result.settings.global, payload.global)) {
|
||||
let bg = payload.global.background;
|
||||
payload.global.background = bg.substr(21, bg.length);
|
||||
|
|
Loading…
Reference in a new issue