Adding view to see things staged for upload.
This commit is contained in:
parent
7f11623bd8
commit
62a38c1695
3 changed files with 43 additions and 3 deletions
15
app.js
15
app.js
|
@ -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.
|
// Admin dashboard page.
|
||||||
app.get('/admin',
|
app.get('/admin',
|
||||||
function(req, res, next) {
|
function(req, res, next) {
|
||||||
|
|
6
post.js
6
post.js
|
@ -269,9 +269,9 @@ Post.getNeedsGeneration = function (callback) {
|
||||||
// Returns: List of Post objects
|
// Returns: List of Post objects
|
||||||
Post.getNeedsUpload = function (callback) {
|
Post.getNeedsUpload = function (callback) {
|
||||||
db.collection("posts").find({
|
db.collection("posts").find({
|
||||||
$where: 'this.lastUploadDate < this.updatedDate',
|
$where: '(this.lastUploadDate < this.updatedDate) && \
|
||||||
$where: 'this.lastGenerateDate <= this.updatedDate',
|
(this.lastGenerateDate >= this.updatedDate) && \
|
||||||
$where: 'this.published === "True"'
|
this.published'
|
||||||
}).toArray( function (err, docs) {
|
}).toArray( function (err, docs) {
|
||||||
if (err) console.log(err);
|
if (err) console.log(err);
|
||||||
posts = [];
|
posts = [];
|
||||||
|
|
25
views/admin-view-uploads.jade
Normal file
25
views/admin-view-uploads.jade
Normal 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
|
Loading…
Reference in a new issue