plugged in feeaturd posts into template

pull/20/head
Ro 4 years ago
parent a4b945d31d
commit 302147df57

@ -48,10 +48,10 @@ router.post('/sync', (req, res) => {
message: 'Settings Saved' message: 'Settings Saved'
}); });
}) })
.catch(() => { .catch(err => {
res.json({ res.json({
type: DataEvent.REQUEST_LAME, 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 rendered = 0;
let display_count = 0; let display_count = 0;
let recent = []; 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++) { for (let index = 0; index < pages.length; index++) {
pages.sort((a, b) => parseFloat(b.metadata.id) - parseFloat(a.metadata.id)); pages.sort((a, b) => parseFloat(b.metadata.id) - parseFloat(a.metadata.id));
@ -52,6 +59,7 @@ export default class Render {
display_count = ++display_count; display_count = ++display_count;
} }
let writeFile, template; let writeFile, template;
let path = let path =
'public/' + 'public/' +
moment(page.metadata.created).format('YYYY') + moment(page.metadata.created).format('YYYY') +
@ -91,6 +99,7 @@ export default class Render {
}); });
} }
buffed = new StringUtils().decodeHTML(buffed); buffed = new StringUtils().decodeHTML(buffed);
let html = md.render(buffed, { html: true, xhtmlOut: true }); let html = md.render(buffed, { html: true, xhtmlOut: true });
let file = pug.renderFile(template, { let file = pug.renderFile(template, {
title: page.metadata.title, title: page.metadata.title,
@ -99,6 +108,7 @@ export default class Render {
tags: tags, tags: tags,
menu: config.menu, menu: config.menu,
recent_posts: recent, recent_posts: recent,
featured_posts: featured,
meta: { meta: {
who: author, who: author,
when: moment(page.metadata.created).fromNow(), when: moment(page.metadata.created).fromNow(),

@ -19,6 +19,9 @@ export default class Settings {
self.loadConfigData() self.loadConfigData()
.then(result => { .then(result => {
let payload = req.body; 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 user = req.session.user;
let found = _.find(result.folks, { id: user.id }); let found = _.find(result.folks, { id: user.id });
let needToUpdate = false; let needToUpdate = false;
@ -44,7 +47,6 @@ export default class Settings {
}; };
reject(response); reject(response);
} }
if (!_.isEqual(result.settings.global, payload.global)) { if (!_.isEqual(result.settings.global, payload.global)) {
let bg = payload.global.background; let bg = payload.global.background;
payload.global.background = bg.substr(21, bg.length); payload.global.background = bg.substr(21, bg.length);

Loading…
Cancel
Save