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
|
// Include some other JS
|
||||||
Post = require('./post.js');
|
Post = require('./post.js');
|
||||||
|
Photo = require('./photo.js');
|
||||||
User = require('./user.js');
|
User = require('./user.js');
|
||||||
Category = require('./category.js');
|
Category = require('./category.js');
|
||||||
Static = require('./static.js');
|
Static = require('./static.js');
|
||||||
|
@ -104,11 +105,12 @@ app.get('/admin/view/uploads',
|
||||||
function(req, res, next) {
|
function(req, res, next) {
|
||||||
Post.getNeedsUpload(function (err, posts) {
|
Post.getNeedsUpload(function (err, posts) {
|
||||||
if (err) console.log(err);
|
if (err) console.log(err);
|
||||||
res.render('admin-view-uploads', {
|
Photo.getNeedsUpload(function (err, photos) {
|
||||||
successNotice: req.flash('successNotice'),
|
res.render('admin-view-uploads', {
|
||||||
failureNotice: req.flash('failureNotice'),
|
successNotice: req.flash('successNotice'),
|
||||||
posts: posts,
|
failureNotice: req.flash('failureNotice'),
|
||||||
user: req.user
|
user: req.user
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -119,16 +121,48 @@ app.get('/admin/view/builds',
|
||||||
function(req, res, next) {
|
function(req, res, next) {
|
||||||
Post.getNeedsBuild(function (err, posts) {
|
Post.getNeedsBuild(function (err, posts) {
|
||||||
if (err) console.log(err);
|
if (err) console.log(err);
|
||||||
res.render('admin-view-builds', {
|
Photo.getNeedsBuild(function (err, photos) {
|
||||||
successNotice: req.flash('successNotice'),
|
res.render('admin-view-builds', {
|
||||||
failureNotice: req.flash('failureNotice'),
|
successNotice: req.flash('successNotice'),
|
||||||
posts: posts,
|
failureNotice: req.flash('failureNotice'),
|
||||||
user: req.user
|
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.
|
// Admin dashboard page.
|
||||||
app.get('/admin',
|
app.get('/admin',
|
||||||
function(req, res, next) {
|
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
|
// Parse a string of tags
|
||||||
// Returns a list of tags
|
// Returns a list of tags
|
||||||
Post.prototype.tagPhoto = function(str) {
|
Photo.prototype.tagPhoto = function(str) {
|
||||||
this.set("tags", []);
|
this.set("tags", []);
|
||||||
|
|
||||||
// we don't need no stinking commas
|
// we don't need no stinking commas
|
||||||
|
@ -170,7 +170,7 @@ Photo.prototype.build = function (callback) {
|
||||||
for (var size in config.imageSizes) {
|
for (var size in config.imageSizes) {
|
||||||
console.log('Generating '+size+' for '+self.get("slug"));
|
console.log('Generating '+size+' for '+self.get("slug"));
|
||||||
(function(size){
|
(function(size){
|
||||||
gm(photo.path)
|
gm(self.get('masterPath'))
|
||||||
.autoOrient()
|
.autoOrient()
|
||||||
.resize(config.imageSizes[size], config.imageSizes[size])
|
.resize(config.imageSizes[size], config.imageSizes[size])
|
||||||
.write(path.join(self.getDirectory(),size+'.'+self.get("extension")),
|
.write(path.join(self.getDirectory(),size+'.'+self.get("extension")),
|
||||||
|
@ -229,7 +229,7 @@ Photo.getLastUploadDate = function (callback) {
|
||||||
// Inputs: UUID as String
|
// Inputs: UUID as String
|
||||||
// Returns: Photo object
|
// Returns: Photo object
|
||||||
Photo.getByUUID = function (uuid, callback) {
|
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));
|
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
|
// 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.
|
// Count and start are optional, when start is specified count must be specified.
|
||||||
// Returns a list of post objects
|
// Returns a list of post objects
|
||||||
Photos.getPhotos = function (count, start, callback) {
|
Photo.getPhotos = function (count, start, callback) {
|
||||||
if (typeof callback === undefined) {
|
if (typeof callback === undefined) {
|
||||||
if (typeof start === undefined) {
|
if (typeof start === undefined) {
|
||||||
callback = count;
|
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;
|
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 });
|
var upload = multer({ dest: config.uploadDir });
|
||||||
|
|
||||||
module.exports = function(app) {
|
module.exports = function(app) {
|
||||||
// Photo management Routing
|
|
||||||
app.get('/admin/photo/list/:start?',
|
app.get('/admin/photo/list/:start?',
|
||||||
function(req, res, next) {
|
function(req, res, next) {
|
||||||
var count = 25;
|
var count = 25;
|
||||||
|
@ -13,156 +13,167 @@ module.exports = function(app) {
|
||||||
} else {
|
} else {
|
||||||
var start = 0;
|
var start = 0;
|
||||||
}
|
}
|
||||||
database.listPhotos(count, start, function(photos){
|
|
||||||
for (photo in photos) {
|
Photo.getPhotos(count, start, function(err, photos) {
|
||||||
var date = new Date(photos[photo].photoDate);
|
res.render('admin-photo-list', {
|
||||||
photos[photo].dateString = date.getFullYear() + '-' +
|
successNotice: req.flash('successNotice'),
|
||||||
("0" + (date.getMonth()+1)).slice(-2) + '-' +
|
failureNotice: req.flash('failureNotice'),
|
||||||
("0" + date.getDate()).slice(-2);
|
photos,
|
||||||
}
|
user: req.user
|
||||||
res.render('admin-photo-list', {photos, user: req.user});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
app.get('/admin/photo/view/:id?',
|
app.get('/admin/photo/view/:uuid?',
|
||||||
function (req, res, next) {
|
function (req, res, next) {
|
||||||
if (req.params.id) {
|
if (req.params.uuid) {
|
||||||
database.getPhotoById(req.params.id, function(row) {
|
Photo.getByUUID(req.params.uuid, function(err, photo) {
|
||||||
res.render('admin-photo-view', {
|
res.render('admin-photo-view', {
|
||||||
successNotice: req.flash('successNotice'),
|
successNotice: req.flash('successNotice'),
|
||||||
failureNotice: req.flash('failureNotice'),
|
failureNotice: req.flash('failureNotice'),
|
||||||
photo: row,
|
photo,
|
||||||
srcPath: '/'+row.path,
|
|
||||||
user: req.user
|
user: req.user
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
res.redirect('/admin/photo/list');
|
res.redirect('/admin/photo/list');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
app.get('/admin/photo/new',
|
app.get('/admin/photo/new',
|
||||||
function(req, res, next) {
|
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',
|
app.post('/admin/photo/new',
|
||||||
upload.single('photo'),
|
upload.single('photo'),
|
||||||
function(req, res, next) {
|
function(req, res, next) {
|
||||||
console.log(req.file);
|
console.log(req.file);
|
||||||
if ( req.body.title != "") {
|
photo = new Photo();
|
||||||
var title = req.body.title;
|
if (req.body.title != '') {
|
||||||
|
photo.set('title', req.body.title);
|
||||||
|
} else {
|
||||||
|
photo.set('title', req.file.originalname.split('.').slice(0,-1).join(' '));
|
||||||
}
|
}
|
||||||
else {
|
photo.set('extension', req.file.originalname.split('.').slice(-1));
|
||||||
var title = req.file.originalname.split('.').slice(0,-1).join(' ');
|
|
||||||
}
|
|
||||||
var extension = req.file.originalname.split('.').slice(-1);
|
|
||||||
if (req.body.photoDate != "") {
|
if (req.body.photoDate != "") {
|
||||||
var photoDate = helper.dateToEpoch(new Date(req.body.photoDate));
|
photo.set('photoDate', new Date(req.body.photoDate));
|
||||||
}
|
} else {
|
||||||
else {
|
photo.set('photoDate', new Date());
|
||||||
var photoDate = helper.dateToEpoch(new Date());
|
|
||||||
}
|
}
|
||||||
if (req.body.slug != "") {
|
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 != "" ){
|
photo.set('mimetype', req.file.mimetype);
|
||||||
var slug = helper.makeSlug(title+'-'+photoDate);
|
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) {
|
photo.save(null, function (err) {
|
||||||
if (err) console.log(err);
|
if (!err) {
|
||||||
console.log(row);
|
req.flash('successNotice', 'Photo created.');
|
||||||
database.tagPhoto(row.id, tags);
|
res.redirect('/admin/photo/view/'+photo.get('uuid'));
|
||||||
req.flash('successNotice', 'Photo created.');
|
} else {
|
||||||
res.redirect('/admin/photo/view/'+row.id);
|
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) {
|
function(req, res, next) {
|
||||||
var id = req.params.id;
|
Photo.getByUUID(req.params.uuid, function (err, photo) {
|
||||||
async.parallel({
|
var tags = ""
|
||||||
photoTags: function(callback) {
|
for (i=0; i<photo.get("tags").length; i++) {
|
||||||
database.getPhotoTagsAsString(id, function(tagString) {
|
tags += photo.get("tags")[i].name + " ";
|
||||||
callback(null, tagString);
|
|
||||||
})
|
|
||||||
},
|
|
||||||
photo: function(callback) {
|
|
||||||
database.getPhotoById(id, function(photo) {
|
|
||||||
callback(null, photo);
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
},
|
|
||||||
function(err, results) {
|
|
||||||
res.render('admin-photo-edit', {
|
res.render('admin-photo-edit', {
|
||||||
successNotice: req.flash('successNotice'),
|
successNotice: req.flash('successNotice'),
|
||||||
failureNotice: req.flash('failureNotice'),
|
failureNotice: req.flash('failureNotice'),
|
||||||
photo: results.photo,
|
photo: photo,
|
||||||
srcPath: '/'+results.photo.path,
|
tags: tags,
|
||||||
photoTags: results.photoTags,
|
|
||||||
formattedDate: helper.epochToDateString(results.photo.photoDate),
|
|
||||||
user: req.user
|
user: req.user
|
||||||
});
|
});
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
app.post('/admin/photo/edit/:id',
|
app.post('/admin/photo/edit/:uuid',
|
||||||
function(req, res, next) {
|
function(req, res, next) {
|
||||||
var id = req.params.id;
|
Photo.getByUUID(req.params.uuid, function (err, photo) {
|
||||||
var title = req.body.title;
|
photo.set('title', req.body.title);
|
||||||
var slug = req.body.slug;
|
if (req.body.slug != '') {
|
||||||
var markdown = req.body.markdown;
|
photo.set('slug', req.body.slug);
|
||||||
var photoDate = helper.dateToEpoch(new Date(req.body.photoDate));
|
} else {
|
||||||
var tags = helper.parseTags(req.body.tags);
|
photo.set('slug', photo.makeSlug());
|
||||||
console.log('Post '+id+' update request received');
|
}
|
||||||
database.tagPhoto(id, tags);
|
photo.set('markdown', req.body.markdown);
|
||||||
database.updatePhoto(id, title, slug, markdown, photoDate, function(err, row) {
|
photo.set('photoDate', new Date(req.body.photoDate));
|
||||||
req.flash('successNotice', 'Photo updated.');
|
photo.tagPhoto(req.body.tags);
|
||||||
res.redirect('/admin/photo/view/'+id);
|
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) {
|
function(req, res, next) {
|
||||||
console.log('Generating resized images for: '+req.params.id);
|
if (req.params.uuid) {
|
||||||
genStatic.generateStatic(function(err){ if (err) console.log(err) });
|
Static.updateBuildFolder(function (err) {
|
||||||
genPhotos.generatePhotoSizesById(req.params.id, function(err) {
|
if (err) console.log(err);
|
||||||
if (!err) {
|
});
|
||||||
genPhotos.generatePhotoPage(req.params.id, function(err) {
|
Photo.getByUUID(req.params.uuid, function (err, photo) {
|
||||||
|
console.log('Building '+photo.get('title'));
|
||||||
|
photo.build(function (err) {
|
||||||
if (!err) {
|
if (!err) {
|
||||||
req.flash("successNotice", "Photo regenerated");
|
console.log(photo.get('title') + ' built.');
|
||||||
res.redirect('/admin/photo/view/'+req.params.id);
|
req.flash("successNotice", 'Photo "'+photo.get('title')+'" built');
|
||||||
|
res.redirect(req.header('Referer') || '/admin');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
req.flash('failureNotice', 'Photo was unable to be resized.');
|
console.log(err);
|
||||||
res.redirect('/admin/photo/view/'+req.params.id);
|
req.flash('failureNotice', 'Unable to build photo.');
|
||||||
|
res.redirect(req.header('Referer') || '/admin');
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
});
|
||||||
else {
|
} else {
|
||||||
req.flash('failureNotice', 'Photo was unable to be resized.');
|
res.redirect('/admin/photos/list');
|
||||||
res.redirect('/admin/photo/view/'+req.params.id);
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
var config = require('./config.js').config;
|
var config = require('./config.js').config;
|
||||||
|
var fs = require('fs');
|
||||||
|
|
||||||
module.exports = function (app) {
|
module.exports = function (app) {
|
||||||
|
|
||||||
|
|
2
run.sh
2
run.sh
|
@ -2,5 +2,5 @@
|
||||||
|
|
||||||
supervisor \
|
supervisor \
|
||||||
-e 'jade|js' \
|
-e 'jade|js' \
|
||||||
-i './generated' \
|
-i './build' \
|
||||||
node app.js
|
node app.js
|
||||||
|
|
|
@ -36,15 +36,17 @@ schemas = {
|
||||||
title: null,
|
title: null,
|
||||||
slug: null,
|
slug: null,
|
||||||
markdown: null,
|
markdown: null,
|
||||||
|
masterPath: null,
|
||||||
|
extension: null,
|
||||||
|
mimetype: null,
|
||||||
createdDate: new Date(),
|
createdDate: new Date(),
|
||||||
photoDate: new Date(),
|
photoDate: new Date(),
|
||||||
updatedDate: new Date(),
|
updatedDate: new Date(),
|
||||||
deleted: false,
|
deleted: false,
|
||||||
published: false,
|
published: false,
|
||||||
category: null,
|
|
||||||
tags: [],
|
tags: [],
|
||||||
metadata: {},
|
exif: {},
|
||||||
lastGenerateDate: new Date("Mon Jan 1 1900 00:00:00 GMT-0500"),
|
lastBuildDate: new Date("Mon Jan 1 1900 00:00:00 GMT-0500"),
|
||||||
lastUploadDate: 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='page-header row')
|
||||||
div(class="col-sm-6 col-sm-offset-3")
|
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="row page-header")
|
||||||
div(class="input-group input-group-lg col-xs-10 col-xs-offset-1 col-md-10 col-md-offset-1")
|
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")
|
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="row page-header")
|
||||||
div(class="input-group col-xs-10 col-xs-offset-1 col-md-10 col-md-offset-1")
|
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")
|
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="row page-header")
|
||||||
div(class="input-group col-xs-10 col-xs-offset-1 col-md-10 col-md-offset-1")
|
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")
|
textarea(class="form-control", rows="12", name="markdown", placeholder="Markdown formatted description")
|
||||||
| #{photo.description}
|
| #{photo.get('markdown')}
|
||||||
div(class="row")
|
div(class="row")
|
||||||
div(class="input-group col-xs-10 col-xs-offset-1 col-md-10 col-md-offset-1")
|
div(class="input-group col-xs-10 col-xs-offset-1 col-md-10 col-md-offset-1")
|
||||||
div(class="pull-left")
|
div(class="pull-left")
|
||||||
|
|
|
@ -12,14 +12,14 @@ block content
|
||||||
table(class="table table-striped")
|
table(class="table table-striped")
|
||||||
each photo in photos
|
each photo in photos
|
||||||
tr
|
tr
|
||||||
td #{photo.id}
|
td: a(href="/admin/photo/view/#{photo.get('uuid')}") #{photo.get('title')}
|
||||||
td: a(href="/admin/photo/view/#{photo.id}") #{photo.title}
|
td #{photo.getShortDate()}
|
||||||
td #{photo.dateString}
|
td #{photo.get('uuid')}
|
||||||
td
|
td
|
||||||
a(href="/admin/photo/edit/#{photo.id}") Edit
|
a(href="/admin/photo/edit/#{photo.get('uuid')}") Edit
|
||||||
| -
|
| -
|
||||||
a(href="/admin/photo/delete/#{photo.id}") Delete
|
a(href="/admin/photo/delete/#{photo.get('uuid')}") Delete
|
||||||
| -
|
| -
|
||||||
a(href="/admin/photo/rebuild/#{photo.id}") Rebuild
|
a(href="/admin/photo/build/#{photo.get('uuid')}") Build
|
||||||
| -
|
| -
|
||||||
a(href="/admin/photo/publish/#{photo.id}") Publish
|
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")
|
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")
|
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")
|
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="row page-header")
|
||||||
div(class="input-group col-xs-10 col-xs-offset-1 col-md-10 col-md-offset-1")
|
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")
|
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='page-header row')
|
||||||
div(class="col-sm-6 col-sm-offset-3")
|
div(class="col-sm-6 col-sm-offset-3")
|
||||||
img(class="img-responsive", src='#{srcPath}')
|
img(class="img-responsive", src="/#{photo.get('masterPath')}")
|
||||||
|
|
||||||
div
|
div(class='row')
|
||||||
h3 #{photo.title}
|
h3 #{photo.get('title')}
|
||||||
p #{photo.date}
|
|
||||||
p #{photo.description}
|
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.getShortDate()}
|
||||||
td #{post.get("uuid")}
|
td #{post.get("uuid")}
|
||||||
td
|
td
|
||||||
a(href="/admin/post/edit/#{post.get('uuid')}") Edit
|
a(href="/admin/post/edit/#{post.get('uuid')}") Edit
|
||||||
| -
|
| -
|
||||||
a(href="/admin/post/delete/#{post.get('uuid')}") Delete
|
a(href="/admin/post/delete/#{post.get('uuid')}") Delete
|
||||||
| -
|
| -
|
||||||
a(href="/admin/post/build/#{post.get('uuid')}") Build
|
a(href="/admin/post/build/#{post.get('uuid')}") Build
|
||||||
| -
|
| -
|
||||||
a(href="/admin/post/upload/#{post.get('uuid')}") Upload
|
a(href="/admin/post/upload/#{post.get('uuid')}") Upload
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ block content
|
||||||
div(class="row page-header")
|
div(class="row page-header")
|
||||||
div(class="input-group col-xs-10 col-xs-offset-1 col-md-10 col-md-offset-1")
|
div(class="input-group col-xs-10 col-xs-offset-1 col-md-10 col-md-offset-1")
|
||||||
span(class="input-group-addon")
|
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")
|
input(type="text", class="form-control" placeholder="Published")
|
||||||
div(class="row page-header")
|
div(class="row page-header")
|
||||||
div(class="input-group col-xs-10 col-xs-offset-1 col-md-10 col-md-offset-1")
|
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')
|
div(class='row')
|
||||||
| #{post.getShortDate()} --
|
| #{post.getShortDate()} --
|
||||||
a(href="/admin/post/edit/#{post.get('uuid')}") Edit
|
a(href="/admin/post/edit/#{post.get('uuid')}") Edit
|
||||||
| -
|
| -
|
||||||
a(href="/admin/post/build/#{post.get('uuid')}") Build
|
a(href="/admin/post/build/#{post.get('uuid')}") Build
|
||||||
|
|
||||||
div(class='row') !{content}
|
div(class='row') !{content}
|
||||||
|
|
|
@ -9,7 +9,7 @@ block content
|
||||||
|
|
||||||
include ./admin-messages.jade
|
include ./admin-messages.jade
|
||||||
|
|
||||||
if Posts
|
if posts.length > 0
|
||||||
h2 Posts
|
h2 Posts
|
||||||
table(class="table table-striped")
|
table(class="table table-striped")
|
||||||
each post in posts
|
each post in posts
|
||||||
|
@ -18,6 +18,19 @@ block content
|
||||||
td #{post.getShortDate()}
|
td #{post.getShortDate()}
|
||||||
td #{post.get("uuid")}
|
td #{post.get("uuid")}
|
||||||
td
|
td
|
||||||
a(href="/admin/post/edit/#{post.get('uuid')}") Edit
|
a(href="/admin/post/edit/#{post.get('uuid')}") Edit
|
||||||
| -
|
| -
|
||||||
a(href="/admin/post/build/#{post.get('uuid')}") Build
|
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
|
include ./admin-messages.jade
|
||||||
|
|
||||||
if posts
|
if posts.length > 0
|
||||||
h2 Posts
|
h2 Posts
|
||||||
table(class="table table-striped")
|
table(class="table table-striped")
|
||||||
each post in posts
|
each post in posts
|
||||||
|
@ -18,4 +18,15 @@ block content
|
||||||
td #{post.getShortDate()}
|
td #{post.getShortDate()}
|
||||||
td #{post.get("uuid")}
|
td #{post.get("uuid")}
|
||||||
td
|
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