Adding view to see things staged for upload.

This commit is contained in:
Andrew Davidson 2016-01-23 17:47:15 -05:00
parent 7f11623bd8
commit 62a38c1695
3 changed files with 43 additions and 3 deletions

15
app.js
View file

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

View file

@ -269,9 +269,9 @@ Post.getNeedsGeneration = function (callback) {
// Returns: List of Post objects
Post.getNeedsUpload = function (callback) {
db.collection("posts").find({
$where: 'this.lastUploadDate < this.updatedDate',
$where: 'this.lastGenerateDate <= this.updatedDate',
$where: 'this.published === "True"'
$where: '(this.lastUploadDate < this.updatedDate) && \
(this.lastGenerateDate >= this.updatedDate) && \
this.published'
}).toArray( function (err, docs) {
if (err) console.log(err);
posts = [];

View file

@ -0,0 +1,25 @@
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 Uploads
include ./admin-messages.jade
table(class="table table-striped")
each post in posts
tr
td #{post.get("uuid")}
td: a(href="/admin/post/view/#{post.get('uuid')}") #{post.get("title")}
td #{post.getShortDate()}
td
a(href="/admin/post/edit/#{post.get('uuid')}") Edit
| -
a(href="/admin/post/delete/#{post.get('uuid')}") Delete
| -
a(href="/admin/post/regenerate/#{post.get('uuid')}") Regenerate
| -
a(href="/admin/post/publish/#{post.get('uuid')}") Publish