diff options
Diffstat (limited to 'server/lib/views/staff.js')
| -rw-r--r-- | server/lib/views/staff.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/server/lib/views/staff.js b/server/lib/views/staff.js index b9fe78a..a9d85ba 100644 --- a/server/lib/views/staff.js +++ b/server/lib/views/staff.js @@ -164,7 +164,7 @@ var staff = module.exports = { ensureSingleMedia: function(req, res, next){ var id = req.params.id if (id) { - Media.findOne({ _id: id }, function (err, id) { + Media.findOne({ _id: id }, function (err, media) { if (media) { res.locals.media = req.method == "GET" ? staff.helpers.media(media) : media } @@ -270,6 +270,7 @@ var staff = module.exports = { media = media.toObject() media.date = moment( media.updated_at || media.created_at ).format("M/DD/YYYY H:MM") media.user = {} + media.shortUrl = media.url.replace(/^http.:\/\//,"") return media } }, @@ -422,7 +423,7 @@ var staff = module.exports = { res.render('staff/media/index') }, show: function(req, res){ - if (res.locals.project) { + if (res.locals.media) { res.render('staff/media/show', { mediaJSON: util.escape( JSON.stringify( res.locals.media ) ), mediaUserJSON: util.escape( JSON.stringify( res.locals.mediaUser ) ), |
