Finalizing photo model updates #7
This commit is contained in:
parent
b9b4a68b11
commit
23265dce80
15 changed files with 294 additions and 161 deletions
54
app.js
54
app.js
|
@ -16,6 +16,7 @@ var MongoClient = require('mongodb').MongoClient;
|
|||
|
||||
// Include some other JS
|
||||
Post = require('./post.js');
|
||||
Photo = require('./photo.js');
|
||||
User = require('./user.js');
|
||||
Category = require('./category.js');
|
||||
Static = require('./static.js');
|
||||
|
@ -104,11 +105,12 @@ 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
|
||||
Photo.getNeedsUpload(function (err, photos) {
|
||||
res.render('admin-view-uploads', {
|
||||
successNotice: req.flash('successNotice'),
|
||||
failureNotice: req.flash('failureNotice'),
|
||||
user: req.user
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -119,16 +121,48 @@ 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
|
||||
Photo.getNeedsBuild(function (err, photos) {
|
||||
res.render('admin-view-builds', {
|
||||
successNotice: req.flash('successNotice'),
|
||||
failureNotice: req.flash('failureNotice'),
|
||||
user: req.user
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
// Admin page to build all unbuilt items
|
||||
app.get('/admin/build',
|
||||
function(req, res, next) {
|
||||
Post.getNeedsBuild(function (err, posts) {
|
||||
if (!err) {
|
||||
for (i=0; i<posts.length; i++) {
|
||||
posts[i].build(function (err) {
|
||||
if (err) console.log(err);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
Photo.getNeedsBuild(function(err, photos) {
|
||||
if (!err) {
|
||||
for (i=0; i<photos.length; i++) {
|
||||
photos[i].build(function (err) {
|
||||
if (err) console.log(err);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
req.flash('successNotice', 'All items built.');
|
||||
res.redirect(req.header('Referer') || '/admin');
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
// Admin dashboard page.
|
||||
app.get('/admin',
|
||||
function(req, res, next) {
|
||||
|
|
55
photo.js
55
photo.js
|
@ -52,7 +52,7 @@ Photo.prototype.save = function (date, callback) {
|
|||
|
||||
// Parse a string of tags
|
||||
// Returns a list of tags
|
||||
Post.prototype.tagPhoto = function(str) {
|
||||
Photo.prototype.tagPhoto = function(str) {
|
||||
this.set("tags", []);
|
||||
|
||||
// we don't need no stinking commas
|
||||
|
@ -170,7 +170,7 @@ Photo.prototype.build = function (callback) {
|
|||
for (var size in config.imageSizes) {
|
||||
console.log('Generating '+size+' for '+self.get("slug"));
|
||||
(function(size){
|
||||
gm(photo.path)
|
||||
gm(self.get('masterPath'))
|
||||
.autoOrient()
|
||||
.resize(config.imageSizes[size], config.imageSizes[size])
|
||||
.write(path.join(self.getDirectory(),size+'.'+self.get("extension")),
|
||||
|
@ -229,7 +229,7 @@ Photo.getLastUploadDate = function (callback) {
|
|||
// Inputs: UUID as String
|
||||
// Returns: Photo object
|
||||
Photo.getByUUID = function (uuid, callback) {
|
||||
db.collection("posts").findOne({uuid: uuid}, function(err, doc) {
|
||||
db.collection("photos").findOne({uuid: uuid}, function(err, doc) {
|
||||
callback(err, new Photo(doc));
|
||||
});
|
||||
}
|
||||
|
@ -247,7 +247,7 @@ Photo.countPhotos = function (callback) {
|
|||
// Function to get a list of posts of a certain count and starting at an offset
|
||||
// Count and start are optional, when start is specified count must be specified.
|
||||
// Returns a list of post objects
|
||||
Photos.getPhotos = function (count, start, callback) {
|
||||
Photo.getPhotos = function (count, start, callback) {
|
||||
if (typeof callback === undefined) {
|
||||
if (typeof start === undefined) {
|
||||
callback = count;
|
||||
|
@ -275,5 +275,50 @@ Photos.getPhotos = function (count, start, callback) {
|
|||
});
|
||||
}
|
||||
|
||||
// Export the Post object for external use.
|
||||
// Function to find photos that need to be built
|
||||
// Inputs: Callback function
|
||||
// Returns: list of Photo objects
|
||||
Photo.getNeedsBuild = function (callback) {
|
||||
db.collection("photos").find({
|
||||
$where: "(this.lastBuildDate < this.updatedDate) && this.published"
|
||||
}).toArray(
|
||||
function (err, docs) {
|
||||
if (err) console.log(err);
|
||||
photos = [];
|
||||
if (docs) {
|
||||
for (i=0; i<docs.length; i++) {
|
||||
photos.push(new Photo(docs[i]));
|
||||
}
|
||||
callback(null, photos);
|
||||
} else {
|
||||
callback('No photos need to be built.', null);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// Function to find photos that need to be uploaded
|
||||
// Inputs: Callback function
|
||||
// Returns: List of Photo objects
|
||||
Photo.getNeedsUpload = function (callback) {
|
||||
db.collection("photos").find({
|
||||
$where: '(this.lastUploadDate < this.updatedDate) && \
|
||||
(this.lastBuildDate >= this.updatedDate) && \
|
||||
this.published'
|
||||
}).toArray( function (err, docs) {
|
||||
if (err) console.log(err);
|
||||
photos = [];
|
||||
if (docs) {
|
||||
for (i=0; i<docs.length; i++) {
|
||||
photos.push(new Photo(docs[i]));
|
||||
}
|
||||
callback(null, photos);
|
||||
} else {
|
||||
callback("No photos require upload.", null);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// Export the Photo object for external use.
|
||||
module.exports = Photo;
|
||||
|
|
213
routes-photo.js
213
routes-photo.js
|
@ -4,7 +4,7 @@ var multer = require('multer');
|
|||
var upload = multer({ dest: config.uploadDir });
|
||||
|
||||
module.exports = function(app) {
|
||||
// Photo management Routing
|
||||
|
||||
app.get('/admin/photo/list/:start?',
|
||||
function(req, res, next) {
|
||||
var count = 25;
|
||||
|
@ -13,156 +13,167 @@ module.exports = function(app) {
|
|||
} else {
|
||||
var start = 0;
|
||||
}
|
||||
database.listPhotos(count, start, function(photos){
|
||||
for (photo in photos) {
|
||||
var date = new Date(photos[photo].photoDate);
|
||||
photos[photo].dateString = date.getFullYear() + '-' +
|
||||
("0" + (date.getMonth()+1)).slice(-2) + '-' +
|
||||
("0" + date.getDate()).slice(-2);
|
||||
}
|
||||
res.render('admin-photo-list', {photos, user: req.user});
|
||||
|
||||
Photo.getPhotos(count, start, function(err, photos) {
|
||||
res.render('admin-photo-list', {
|
||||
successNotice: req.flash('successNotice'),
|
||||
failureNotice: req.flash('failureNotice'),
|
||||
photos,
|
||||
user: req.user
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
app.get('/admin/photo/view/:id?',
|
||||
app.get('/admin/photo/view/:uuid?',
|
||||
function (req, res, next) {
|
||||
if (req.params.id) {
|
||||
database.getPhotoById(req.params.id, function(row) {
|
||||
if (req.params.uuid) {
|
||||
Photo.getByUUID(req.params.uuid, function(err, photo) {
|
||||
res.render('admin-photo-view', {
|
||||
successNotice: req.flash('successNotice'),
|
||||
failureNotice: req.flash('failureNotice'),
|
||||
photo: row,
|
||||
srcPath: '/'+row.path,
|
||||
photo,
|
||||
user: req.user
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
||||
}
|
||||
else {
|
||||
res.redirect('/admin/photo/list');
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
app.get('/admin/photo/new',
|
||||
function(req, res, next) {
|
||||
res.render('admin-photo-new', { user: req.user });
|
||||
}
|
||||
res.render('admin-photo-new', {
|
||||
successNotice: req.flash('successNotice'),
|
||||
failureNotice: req.flash('failureNotice'),
|
||||
user: req.user
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
app.post('/admin/photo/new',
|
||||
upload.single('photo'),
|
||||
function(req, res, next) {
|
||||
console.log(req.file);
|
||||
if ( req.body.title != "") {
|
||||
var title = req.body.title;
|
||||
photo = new Photo();
|
||||
if (req.body.title != '') {
|
||||
photo.set('title', req.body.title);
|
||||
} else {
|
||||
photo.set('title', req.file.originalname.split('.').slice(0,-1).join(' '));
|
||||
}
|
||||
else {
|
||||
var title = req.file.originalname.split('.').slice(0,-1).join(' ');
|
||||
}
|
||||
var extension = req.file.originalname.split('.').slice(-1);
|
||||
photo.set('extension', req.file.originalname.split('.').slice(-1));
|
||||
if (req.body.photoDate != "") {
|
||||
var photoDate = helper.dateToEpoch(new Date(req.body.photoDate));
|
||||
}
|
||||
else {
|
||||
var photoDate = helper.dateToEpoch(new Date());
|
||||
photo.set('photoDate', new Date(req.body.photoDate));
|
||||
} else {
|
||||
photo.set('photoDate', new Date());
|
||||
}
|
||||
if (req.body.slug != "") {
|
||||
var slug = req.body.slug;
|
||||
photo.set('slug', req.body.slug);
|
||||
} else {
|
||||
photo.set('slug', photo.makeSlug());
|
||||
}
|
||||
else if ( req.body.title != "" ){
|
||||
var slug = helper.makeSlug(title+'-'+photoDate);
|
||||
photo.set('mimetype', req.file.mimetype);
|
||||
photo.set('markdown', req.body.markdown);
|
||||
photo.set('createdDate', new Date());
|
||||
photo.set('masterPath', req.file.path);
|
||||
photo.tagPhoto(req.body.tags);
|
||||
if (req.body.published) {
|
||||
photo.set("published", true);
|
||||
} else {
|
||||
photo.set("published", false);
|
||||
}
|
||||
else {
|
||||
var cleanFileName = req.file.originalname.split('.').slice(0,-1).join('-');
|
||||
var slug = helper.makeSlug(cleanFileName+'-'+photoDate);
|
||||
}
|
||||
var mimetype = req.file.mimetype;
|
||||
var tags = helper.parseTags(req.body.tags);
|
||||
var markdown = req.body.markdown;
|
||||
var updatedDate = photoDate;
|
||||
var createDate = helper.dateToEpoch(new Date());
|
||||
var categoryName = req.body.category;
|
||||
var path = req.file.path;
|
||||
|
||||
database.createPhoto(title, slug, markdown, extension, mimetype, photoDate, updatedDate, createDate, path, function(err, row) {
|
||||
if (err) console.log(err);
|
||||
console.log(row);
|
||||
database.tagPhoto(row.id, tags);
|
||||
req.flash('successNotice', 'Photo created.');
|
||||
res.redirect('/admin/photo/view/'+row.id);
|
||||
photo.save(null, function (err) {
|
||||
if (!err) {
|
||||
req.flash('successNotice', 'Photo created.');
|
||||
res.redirect('/admin/photo/view/'+photo.get('uuid'));
|
||||
} else {
|
||||
console.log(err);
|
||||
req.flash('failureNotice', 'Photo failed to be created');
|
||||
res.redirect('/admin/photo/new');
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
app.get('/admin/photo/edit/:id',
|
||||
app.get('/admin/photo/edit/:uuid',
|
||||
function(req, res, next) {
|
||||
var id = req.params.id;
|
||||
async.parallel({
|
||||
photoTags: function(callback) {
|
||||
database.getPhotoTagsAsString(id, function(tagString) {
|
||||
callback(null, tagString);
|
||||
})
|
||||
},
|
||||
photo: function(callback) {
|
||||
database.getPhotoById(id, function(photo) {
|
||||
callback(null, photo);
|
||||
})
|
||||
Photo.getByUUID(req.params.uuid, function (err, photo) {
|
||||
var tags = ""
|
||||
for (i=0; i<photo.get("tags").length; i++) {
|
||||
tags += photo.get("tags")[i].name + " ";
|
||||
}
|
||||
},
|
||||
function(err, results) {
|
||||
res.render('admin-photo-edit', {
|
||||
successNotice: req.flash('successNotice'),
|
||||
failureNotice: req.flash('failureNotice'),
|
||||
photo: results.photo,
|
||||
srcPath: '/'+results.photo.path,
|
||||
photoTags: results.photoTags,
|
||||
formattedDate: helper.epochToDateString(results.photo.photoDate),
|
||||
photo: photo,
|
||||
tags: tags,
|
||||
user: req.user
|
||||
});
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
);
|
||||
|
||||
app.post('/admin/photo/edit/:id',
|
||||
app.post('/admin/photo/edit/:uuid',
|
||||
function(req, res, next) {
|
||||
var id = req.params.id;
|
||||
var title = req.body.title;
|
||||
var slug = req.body.slug;
|
||||
var markdown = req.body.markdown;
|
||||
var photoDate = helper.dateToEpoch(new Date(req.body.photoDate));
|
||||
var tags = helper.parseTags(req.body.tags);
|
||||
console.log('Post '+id+' update request received');
|
||||
database.tagPhoto(id, tags);
|
||||
database.updatePhoto(id, title, slug, markdown, photoDate, function(err, row) {
|
||||
req.flash('successNotice', 'Photo updated.');
|
||||
res.redirect('/admin/photo/view/'+id);
|
||||
Photo.getByUUID(req.params.uuid, function (err, photo) {
|
||||
photo.set('title', req.body.title);
|
||||
if (req.body.slug != '') {
|
||||
photo.set('slug', req.body.slug);
|
||||
} else {
|
||||
photo.set('slug', photo.makeSlug());
|
||||
}
|
||||
photo.set('markdown', req.body.markdown);
|
||||
photo.set('photoDate', new Date(req.body.photoDate));
|
||||
photo.tagPhoto(req.body.tags);
|
||||
if (req.body.published) {
|
||||
photo.set("published", true);
|
||||
} else {
|
||||
photo.set("published", false);
|
||||
}
|
||||
console.log('Updating photo: '+photo.get('title'));
|
||||
photo.save(null, function (err) {
|
||||
if (!err) {
|
||||
console.log('Photo updated.');
|
||||
req.flash('successNotice', 'Photo updated.');
|
||||
res.redirect('/admin/photo/edit/'+photo.get('uuid'));
|
||||
} else {
|
||||
console.log(err);
|
||||
req.flash('failureNotice', 'Photo failed to update.');
|
||||
res.redirect('/admin/photo/edit/'+photo.get('uuid'));
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
app.get('/admin/photo/regenerate/:id',
|
||||
app.get('/admin/photo/build/:uuid',
|
||||
function(req, res, next) {
|
||||
console.log('Generating resized images for: '+req.params.id);
|
||||
genStatic.generateStatic(function(err){ if (err) console.log(err) });
|
||||
genPhotos.generatePhotoSizesById(req.params.id, function(err) {
|
||||
if (!err) {
|
||||
genPhotos.generatePhotoPage(req.params.id, function(err) {
|
||||
if (req.params.uuid) {
|
||||
Static.updateBuildFolder(function (err) {
|
||||
if (err) console.log(err);
|
||||
});
|
||||
Photo.getByUUID(req.params.uuid, function (err, photo) {
|
||||
console.log('Building '+photo.get('title'));
|
||||
photo.build(function (err) {
|
||||
if (!err) {
|
||||
req.flash("successNotice", "Photo regenerated");
|
||||
res.redirect('/admin/photo/view/'+req.params.id);
|
||||
console.log(photo.get('title') + ' built.');
|
||||
req.flash("successNotice", 'Photo "'+photo.get('title')+'" built');
|
||||
res.redirect(req.header('Referer') || '/admin');
|
||||
}
|
||||
else {
|
||||
req.flash('failureNotice', 'Photo was unable to be resized.');
|
||||
res.redirect('/admin/photo/view/'+req.params.id);
|
||||
console.log(err);
|
||||
req.flash('failureNotice', 'Unable to build photo.');
|
||||
res.redirect(req.header('Referer') || '/admin');
|
||||
}
|
||||
})
|
||||
}
|
||||
else {
|
||||
req.flash('failureNotice', 'Photo was unable to be resized.');
|
||||
res.redirect('/admin/photo/view/'+req.params.id);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
res.redirect('/admin/photos/list');
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
var config = require('./config.js').config;
|
||||
|
||||
var fs = require('fs');
|
||||
|
||||
module.exports = function (app) {
|
||||
|
||||
|
|
2
run.sh
2
run.sh
|
@ -2,5 +2,5 @@
|
|||
|
||||
supervisor \
|
||||
-e 'jade|js' \
|
||||
-i './generated' \
|
||||
-i './build' \
|
||||
node app.js
|
||||
|
|
|
@ -36,15 +36,17 @@ schemas = {
|
|||
title: null,
|
||||
slug: null,
|
||||
markdown: null,
|
||||
masterPath: null,
|
||||
extension: null,
|
||||
mimetype: null,
|
||||
createdDate: new Date(),
|
||||
photoDate: new Date(),
|
||||
updatedDate: new Date(),
|
||||
deleted: false,
|
||||
published: false,
|
||||
category: null,
|
||||
tags: [],
|
||||
metadata: {},
|
||||
lastGenerateDate: new Date("Mon Jan 1 1900 00:00:00 GMT-0500"),
|
||||
exif: {},
|
||||
lastBuildDate: new Date("Mon Jan 1 1900 00:00:00 GMT-0500"),
|
||||
lastUploadDate: new Date("Mon Jan 1 1900 00:00:00 GMT-0500")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,23 +11,28 @@ block content
|
|||
|
||||
div(class='page-header row')
|
||||
div(class="col-sm-6 col-sm-offset-3")
|
||||
img(class="img-responsive", src='#{srcPath}')
|
||||
img(class="img-responsive", src="/#{photo.get('masterPath')}")
|
||||
|
||||
form(method="post", action="/admin/photo/edit/#{photo.id}")
|
||||
form(method="post", action="/admin/photo/edit/#{photo.get('uuid')}")
|
||||
div(class="row page-header")
|
||||
div(class="input-group input-group-lg col-xs-10 col-xs-offset-1 col-md-10 col-md-offset-1")
|
||||
input(class="form-control", type="text", name="title", placeholder="Enter title", value="#{photo.title}")
|
||||
input(class="form-control", type="text", name="title", placeholder="Enter title", value="#{photo.get('title')}")
|
||||
div(class="input-group col-xs-10 col-xs-offset-1 col-md-10 col-md-offset-1")
|
||||
input(class="form-control", type="text", name="slug", placeholder="Enter slug (optional)", value="#{photo.slug}")
|
||||
input(class="form-control", type="text", name="slug", placeholder="Enter slug (optional)", value="#{photo.get('slug')}")
|
||||
div(class="row page-header")
|
||||
div(class="input-group col-xs-10 col-xs-offset-1 col-md-10 col-md-offset-1")
|
||||
input(type="text", class="form-control", placeholder="Publish Date", name="photoDate", value="#{formattedDate}")
|
||||
input(type="text", class="form-control", placeholder="Publish Date", name="photoDate", value="#{photo.get('photoDate')}")
|
||||
div(class="input-group col-xs-10 col-xs-offset-1 col-md-10 col-md-offset-1")
|
||||
input(type="text", class="form-control", placeholder="Tags", name="tags" value="#{photoTags}")
|
||||
input(type="text", class="form-control", placeholder="Tags", name="tags" value="#{tags}")
|
||||
div(class="row page-header")
|
||||
div(class="input-group col-xs-10 col-xs-offset-1 col-md-10 col-md-offset-1")
|
||||
span(class="input-group-addon")
|
||||
input(type="checkbox", name="published", checked=(photo.get('published')))
|
||||
input(type="text", class="form-control" placeholder="Published")
|
||||
div(class="row page-header")
|
||||
div(class="input-group col-xs-10 col-xs-offset-1 col-md-10 col-md-offset-1")
|
||||
textarea(class="form-control", rows="12", name="markdown", placeholder="Markdown formatted description")
|
||||
| #{photo.description}
|
||||
| #{photo.get('markdown')}
|
||||
div(class="row")
|
||||
div(class="input-group col-xs-10 col-xs-offset-1 col-md-10 col-md-offset-1")
|
||||
div(class="pull-left")
|
||||
|
|
|
@ -12,14 +12,14 @@ block content
|
|||
table(class="table table-striped")
|
||||
each photo in photos
|
||||
tr
|
||||
td #{photo.id}
|
||||
td: a(href="/admin/photo/view/#{photo.id}") #{photo.title}
|
||||
td #{photo.dateString}
|
||||
td: a(href="/admin/photo/view/#{photo.get('uuid')}") #{photo.get('title')}
|
||||
td #{photo.getShortDate()}
|
||||
td #{photo.get('uuid')}
|
||||
td
|
||||
a(href="/admin/photo/edit/#{photo.id}") Edit
|
||||
| -
|
||||
a(href="/admin/photo/delete/#{photo.id}") Delete
|
||||
| -
|
||||
a(href="/admin/photo/rebuild/#{photo.id}") Rebuild
|
||||
| -
|
||||
a(href="/admin/photo/publish/#{photo.id}") Publish
|
||||
a(href="/admin/photo/edit/#{photo.get('uuid')}") Edit
|
||||
| -
|
||||
a(href="/admin/photo/delete/#{photo.get('uuid')}") Delete
|
||||
| -
|
||||
a(href="/admin/photo/build/#{photo.get('uuid')}") Build
|
||||
| -
|
||||
a(href="/admin/photo/upload/#{photo.get('uuid')}") Upload
|
||||
|
|
|
@ -22,6 +22,11 @@ block content
|
|||
input(type="text", class="form-control", placeholder="Publish Date", name="photoDate")
|
||||
div(class="input-group col-xs-10 col-xs-offset-1 col-md-10 col-md-offset-1")
|
||||
input(type="text", class="form-control", placeholder="Tags", name="tags")
|
||||
div(class="row page-header")
|
||||
div(class="input-group col-xs-10 col-xs-offset-1 col-md-10 col-md-offset-1")
|
||||
span(class="input-group-addon")
|
||||
input(type="checkbox", name="published", checked, value='true')
|
||||
input(type="text", class="form-control" placeholder="Published")
|
||||
div(class="row page-header")
|
||||
div(class="input-group col-xs-10 col-xs-offset-1 col-md-10 col-md-offset-1")
|
||||
textarea(class="form-control", rows="12", name="markdown", placeholder="Markdown formatted description")
|
||||
|
|
|
@ -10,9 +10,16 @@ block content
|
|||
|
||||
div(class='page-header row')
|
||||
div(class="col-sm-6 col-sm-offset-3")
|
||||
img(class="img-responsive", src='#{srcPath}')
|
||||
img(class="img-responsive", src="/#{photo.get('masterPath')}")
|
||||
|
||||
div
|
||||
h3 #{photo.title}
|
||||
p #{photo.date}
|
||||
p #{photo.description}
|
||||
div(class='row')
|
||||
h3 #{photo.get('title')}
|
||||
|
||||
div(class='row')
|
||||
| #{photo.getShortDate()} --
|
||||
a(href="/admin/photo/edit/#{photo.get('uuid')}") Edit
|
||||
| -
|
||||
a(href="/admin/photo/build/#{photo.get('uuid')}") Build
|
||||
|
||||
div(class='row')
|
||||
p #{photo.get('markdown')}
|
||||
|
|
|
@ -17,12 +17,12 @@ block content
|
|||
td #{post.getShortDate()}
|
||||
td #{post.get("uuid")}
|
||||
td
|
||||
a(href="/admin/post/edit/#{post.get('uuid')}") Edit
|
||||
| -
|
||||
a(href="/admin/post/delete/#{post.get('uuid')}") Delete
|
||||
| -
|
||||
a(href="/admin/post/build/#{post.get('uuid')}") Build
|
||||
| -
|
||||
a(href="/admin/post/upload/#{post.get('uuid')}") Upload
|
||||
a(href="/admin/post/edit/#{post.get('uuid')}") Edit
|
||||
| -
|
||||
a(href="/admin/post/delete/#{post.get('uuid')}") Delete
|
||||
| -
|
||||
a(href="/admin/post/build/#{post.get('uuid')}") Build
|
||||
| -
|
||||
a(href="/admin/post/upload/#{post.get('uuid')}") Upload
|
||||
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ block content
|
|||
div(class="row page-header")
|
||||
div(class="input-group col-xs-10 col-xs-offset-1 col-md-10 col-md-offset-1")
|
||||
span(class="input-group-addon")
|
||||
input(type="checkbox", name="published", checked=false, value='true')
|
||||
input(type="checkbox", name="published", checked, value='true')
|
||||
input(type="text", class="form-control" placeholder="Published")
|
||||
div(class="row page-header")
|
||||
div(class="input-group col-xs-10 col-xs-offset-1 col-md-10 col-md-offset-1")
|
||||
|
|
|
@ -14,7 +14,7 @@ block content
|
|||
div(class='row')
|
||||
| #{post.getShortDate()} --
|
||||
a(href="/admin/post/edit/#{post.get('uuid')}") Edit
|
||||
| -
|
||||
| -
|
||||
a(href="/admin/post/build/#{post.get('uuid')}") Build
|
||||
|
||||
div(class='row') !{content}
|
||||
|
|
|
@ -9,7 +9,7 @@ block content
|
|||
|
||||
include ./admin-messages.jade
|
||||
|
||||
if Posts
|
||||
if posts.length > 0
|
||||
h2 Posts
|
||||
table(class="table table-striped")
|
||||
each post in posts
|
||||
|
@ -18,6 +18,19 @@ block content
|
|||
td #{post.getShortDate()}
|
||||
td #{post.get("uuid")}
|
||||
td
|
||||
a(href="/admin/post/edit/#{post.get('uuid')}") Edit
|
||||
| -
|
||||
a(href="/admin/post/build/#{post.get('uuid')}") Build
|
||||
a(href="/admin/post/edit/#{post.get('uuid')}") Edit
|
||||
| -
|
||||
a(href="/admin/post/build/#{post.get('uuid')}") Build
|
||||
|
||||
if photos.length > 0
|
||||
h2 Photos
|
||||
table(class="table table-striped")
|
||||
each photo in photos
|
||||
tr
|
||||
td: a(href="/admin/photo/view/#{photo.get('uuid')}") #{photo.get("title")}
|
||||
td #{photo.getShortDate()}
|
||||
td #{photo.get("uuid")}
|
||||
td
|
||||
a(href="/admin/photo/edit/#{photo.get('uuid')}") Edit
|
||||
| -
|
||||
a(href="/admin/photo/build/#{photo.get('uuid')}") Build
|
||||
|
|
|
@ -9,7 +9,7 @@ block content
|
|||
|
||||
include ./admin-messages.jade
|
||||
|
||||
if posts
|
||||
if posts.length > 0
|
||||
h2 Posts
|
||||
table(class="table table-striped")
|
||||
each post in posts
|
||||
|
@ -18,4 +18,15 @@ block content
|
|||
td #{post.getShortDate()}
|
||||
td #{post.get("uuid")}
|
||||
td
|
||||
a(href="/admin/post/edit/#{post.get('uuid')}") Edit
|
||||
a(href="/admin/post/edit/#{post.get('uuid')}") Edit
|
||||
|
||||
if photos.length > 0
|
||||
h2 Photos
|
||||
table(class="table table-striped")
|
||||
each photo in photos
|
||||
tr
|
||||
td: a(href="/admin/photo/view/#{photo.get('uuid')}") #{photo.get('title')}
|
||||
td #{photo.getShortDate()}
|
||||
td #{photo.get('uuid')}
|
||||
td
|
||||
a(href="/admin/photo/edit/#{photo.get('uuid')}") Edit
|
||||
|
|
Loading…
Reference in a new issue