From b7064185d471c2399eae86ea2b1efd6f64c0c21f Mon Sep 17 00:00:00 2001 From: Tim Griesser Date: Sat, 1 Jun 2013 15:42:11 -0400 Subject: [PATCH] server half of #83, posts are draft by default, browse shows published by default --- core/admin/controllers/index.js | 6 +++--- core/frontend/controllers/index.js | 4 ++-- core/shared/api.js | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/admin/controllers/index.js b/core/admin/controllers/index.js index 14afb4633a..bb7dde14f6 100755 --- a/core/admin/controllers/index.js +++ b/core/admin/controllers/index.js @@ -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 }); }); }, diff --git a/core/frontend/controllers/index.js b/core/frontend/controllers/index.js index 8213e550ff..4815865c83 100644 --- a/core/frontend/controllers/index.js +++ b/core/frontend/controllers/index.js @@ -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}); }); }); diff --git a/core/shared/api.js b/core/shared/api.js index f30ebc7ec6..7f62b9de09 100644 --- a/core/shared/api.js +++ b/core/shared/api.js @@ -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); },