Adding a view for pending builds

This commit is contained in:
Andrew Davidson 2016-01-23 18:19:37 -05:00
parent 821b431eec
commit c44dc8ce95
3 changed files with 39 additions and 1 deletions

15
app.js
View file

@ -116,6 +116,21 @@ app.get('/admin/view/uploads',
} }
); );
// Admin page to view all the items that need to be built.
app.get('/admin/view/builds',
function(req, res, next) {
Post.getNeedsBuild(function (err, posts) {
if (err) console.log(err);
res.render('admin-view-builds', {
successNotice: req.flash('successNotice'),
failureNotice: req.flash('failureNotice'),
posts: posts,
user: req.user
});
});
}
);
// Admin dashboard page. // Admin dashboard page.
app.get('/admin', app.get('/admin',
function(req, res, next) { function(req, res, next) {

View file

@ -251,7 +251,7 @@ Post.getPosts = function(count, start, callback) {
// Function to find posts that need to be built // Function to find posts that need to be built
// Inputs: Callback function // Inputs: Callback function
// Returns: list of Post objects // Returns: list of Post objects
Post.getNeedsGeneration = function (callback) { Post.getNeedsBuild = function (callback) {
db.collection("posts").find({ db.collection("posts").find({
$where: "(this.lastBuildDate < this.updatedDate) && this.published" $where: "(this.lastBuildDate < this.updatedDate) && this.published"
}).toArray( }).toArray(

View file

@ -0,0 +1,23 @@
extends admin-layout
block content
div(class="row")
include ./admin-sidebar.jade
div(class="col-sm-10 col-sm-offset-2 main")
h1(class="page-header") Pending Builds
include ./admin-messages.jade
if Posts
h2 Posts
table(class="table table-striped")
each post in posts
tr
td: a(href="/admin/post/view/#{post.get('uuid')}") #{post.get("title")}
td #{post.getShortDate()}
td #{post.get("uuid")}
td
a(href="/admin/post/edit/#{post.get('uuid')}") Edit
| -
a(href="/admin/post/rebuild/#{post.get('uuid')}") Rebuild