diff options
| author | Jules Laplace <jules@okfoc.us> | 2014-09-04 15:30:07 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2014-09-04 15:30:07 -0400 |
| commit | 01eaa246c7aebcea616eccf7989c63ac6f54fdf0 (patch) | |
| tree | 2f42a3e650f874ec7a54bc42eb5a953661c4571e /server/lib/views | |
| parent | b2164f9f6001dcac952a3d2b301f1425fdb3cbe9 (diff) | |
project view
Diffstat (limited to 'server/lib/views')
| -rw-r--r-- | server/lib/views/staff.js | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/server/lib/views/staff.js b/server/lib/views/staff.js index cf43081..ae414d7 100644 --- a/server/lib/views/staff.js +++ b/server/lib/views/staff.js @@ -14,7 +14,7 @@ var User = require('../schemas/User'), var staff = module.exports = { fields: { - user: "_id username displayName created_at updated_at last_seen created_ip last_ip", + user: "_id username displayName photo created_at updated_at last_seen created_ip last_ip", project: "_id name slug user_id privacy created_at updated_at", }, @@ -170,8 +170,8 @@ var staff = module.exports = { ensureProjectUser: function(req, res, next){ if (! res.locals.project) { return next() } - User.findOne({ user_id: res.locals.project.user_id }, staff.fields.user, function(err, user){ - res.locals.project.user = user || staff.defaults.user + User.findOne({ _id: res.locals.project.user_id }, staff.fields.user, function(err, user){ + res.locals.projectUser = staff.helpers.user(user) || staff.defaults.user next() }) }, @@ -247,7 +247,7 @@ var staff = module.exports = { staff.projects.index ); - app.get('/staff/projects/:name', + app.get('/staff/projects/:slug', middleware.ensureAuthenticated, middleware.ensureIsStaff, @@ -304,7 +304,9 @@ var staff = module.exports = { show: function(req, res){ if (res.locals.project) { res.render('staff/projects/show', { - projectJSON: util.escape( JSON.stringify( res.locals.profile ) ) + projectJSON: util.escape( JSON.stringify( res.locals.project ) ), + projectUserJSON: util.escape( JSON.stringify( res.locals.projectUser ) ), + collaboratorsJSON: util.escape( JSON.stringify( res.locals.collaborators ) ) }) } else { |
