server half of #83, posts are draft by default, browse shows published by default

This commit is contained in:
Tim Griesser 2013-06-01 15:42:11 -04:00
parent c55a96083a
commit b7064185d4
3 changed files with 6 additions and 6 deletions

View File

@ -132,12 +132,12 @@
}
},
'content': function (req, res) {
api.posts.browse()
.then(function (posts) {
api.posts.browse({status: req.params.status || 'all'})
.then(function (page) {
res.render('content', {
bodyClass: 'manage',
adminNav: setSelected(adminNavbar, 'content'),
posts: posts.toJSON()
posts: page.posts
});
});
},

View File

@ -14,8 +14,8 @@
frontendControllers = {
'homepage': function (req, res) {
api.posts.browse().then(function (posts) {
ghost.doFilter('prePostsRender', posts.toJSON(), function (posts) {
api.posts.browse().then(function (page) {
ghost.doFilter('prePostsRender', page.posts, function (posts) {
res.render('index', {posts: posts, ghostGlobals: res.locals.ghostGlobals, navItems: res.locals.navItems});
});
});

View File

@ -22,7 +22,7 @@
// # Posts
posts = {
// takes filter / pagination parameters
// returns a list of posts in a json response
// returns a page of posts in a json response
browse: function (options) {
return dataProvider.Post.findPage(options);
},