Skip to content

Commit

Permalink
add image details page for bigger view
Browse files Browse the repository at this point in the history
  • Loading branch information
bolducp committed Feb 6, 2016
1 parent c281d15 commit 5cf4ce5
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 3 deletions.
1 change: 0 additions & 1 deletion config/auth.js
Expand Up @@ -4,7 +4,6 @@ var jwt = require('jwt-simple');
var JWT_SECRET = process.env.JWT_SECRET;

var authMiddleware = function(req, res, next) {

try {
var payload = jwt.decode(req.cookies.mytoken, JWT_SECRET);
} catch(err) {
Expand Down
2 changes: 1 addition & 1 deletion models/photo.js
Expand Up @@ -30,7 +30,7 @@ photoSchema.statics.addPhotos = function(albumId, files, callback) {
Body: file.buffer
};
s3.putObject(params, function(err, data){
if (err) return res.status(400).send(err);
if (err) return callback(err);
var url = process.env.AWS_URL + "/" + process.env.AWS_BUCKET + "/" + key;
var photo = new Photo({
filename: filename,
Expand Down
9 changes: 9 additions & 0 deletions public/css/loggedInNavbar.css
Expand Up @@ -11,6 +11,15 @@ th {
display: none;
}

#photoWrapper {
text-align: center;
padding-bottom: 100px;
}

#photoWrapper img {
height: 400px;
}

.imageIcon {
height: 80px;
}
Expand Down
8 changes: 8 additions & 0 deletions routes/profile.js
Expand Up @@ -53,4 +53,12 @@ router.get('/albums/:albumId', function(req, res) {
});
});


router.get('/:photoId', function(req, res) {
Photo.findById(req.params.photoId, function(err, photo) {
if (err) return res.status(400).send(err);
res.render('photo', {photo: photo});
});
});

module.exports = router;
3 changes: 2 additions & 1 deletion views/albumDetails.jade
Expand Up @@ -24,6 +24,7 @@ block content
tr.dataRow(data-album = photo.id)
td.name.searchable #{photo.filename}
td
img.imageIcon(src=photo.url)
a(href=`/profile/${photo._id}`)
img.imageIcon(src=photo.url)

block scripts
10 changes: 10 additions & 0 deletions views/photo.jade
@@ -0,0 +1,10 @@
extends layout

block links
link(rel='stylesheet', href='/css/loggedInNavbar.css')

block content
#photoWrapper
h1 Photo
img(src=photo.url)
h2 #{photo.filename}

0 comments on commit 5cf4ce5

Please sign in to comment.