From 415dad29407362a76fde6d07d8b100285a84518d Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 4 Sep 2014 17:52:48 -0400 Subject: media api --- views/staff/media/index.ejs | 16 ++++++++++++++++ views/staff/media/show.ejs | 14 ++++++++++++++ views/staff/media/show_404.ejs | 14 ++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 views/staff/media/index.ejs create mode 100644 views/staff/media/show.ejs create mode 100644 views/staff/media/show_404.ejs (limited to 'views/staff/media') diff --git a/views/staff/media/index.ejs b/views/staff/media/index.ejs new file mode 100644 index 0000000..76aaafb --- /dev/null +++ b/views/staff/media/index.ejs @@ -0,0 +1,16 @@ +[[ include ../_header ]] + +

Media

+ + + +
+ +[[ include ../_media ]] + +[[ include ../_footer ]] diff --git a/views/staff/media/show.ejs b/views/staff/media/show.ejs new file mode 100644 index 0000000..43afe14 --- /dev/null +++ b/views/staff/media/show.ejs @@ -0,0 +1,14 @@ +[[ include ../_header ]] + +

Media [[- media.type ]]

+ + + +
+ +[[ include ../_footer ]] diff --git a/views/staff/media/show_404.ejs b/views/staff/media/show_404.ejs new file mode 100644 index 0000000..f07cef2 --- /dev/null +++ b/views/staff/media/show_404.ejs @@ -0,0 +1,14 @@ +[[ include ../_header ]] + +

Media not found

+ + + +
+ +[[ include ../_footer ]] -- cgit v1.2.3-70-g09d2 From cccacd39a49f48a9aefe39e0e0bb33529ca80410 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 4 Sep 2014 18:03:07 -0400 Subject: media list --- server/lib/views/staff.js | 5 +++-- views/staff/_media.ejs | 38 +++++++++++++++++++++++++++++++++++++- views/staff/media/show.ejs | 2 +- 3 files changed, 41 insertions(+), 4 deletions(-) (limited to 'views/staff/media') 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 ) ), diff --git a/views/staff/_media.ejs b/views/staff/_media.ejs index 27949aa..19e9d0b 100644 --- a/views/staff/_media.ejs +++ b/views/staff/_media.ejs @@ -1 +1,37 @@ -media \ No newline at end of file + +[[ media.forEach(function(media){ ]] + + + + + + + + + +[[ }) ]] +
+ [[- media.user.username ]] + + [[- media.date ]] + + [[- media.width ]]x[[- media.height ]] + + [[- media.type ]] + + [[- media.token ]] + + [[- media.shortUrl ]] +
+ + \ No newline at end of file diff --git a/views/staff/media/show.ejs b/views/staff/media/show.ejs index 43afe14..8257307 100644 --- a/views/staff/media/show.ejs +++ b/views/staff/media/show.ejs @@ -1,6 +1,6 @@ [[ include ../_header ]] -

Media [[- media.type ]]

+

Media: [[- media.type ]]


- + [[ include _users_recent ]] [[ include _stats ]] diff --git a/views/staff/media/index.ejs b/views/staff/media/index.ejs index 76aaafb..516af2d 100644 --- a/views/staff/media/index.ejs +++ b/views/staff/media/index.ejs @@ -11,6 +11,8 @@
+[[ include ../_pagination ]] [[ include ../_media ]] +[[ include ../_pagination ]] [[ include ../_footer ]] diff --git a/views/staff/projects/index.ejs b/views/staff/projects/index.ejs index a6fad6b..482ea25 100644 --- a/views/staff/projects/index.ejs +++ b/views/staff/projects/index.ejs @@ -11,6 +11,8 @@
+[[ include ../_pagination ]] [[ include ../_projects ]] +[[ include ../_pagination ]] [[ include ../_footer ]] diff --git a/views/staff/users/index.ejs b/views/staff/users/index.ejs index 8c56565..f14d666 100644 --- a/views/staff/users/index.ejs +++ b/views/staff/users/index.ejs @@ -11,6 +11,8 @@
+[[ include ../_pagination ]] [[ include ../_users ]] +[[ include ../_pagination ]] [[ include ../_footer ]] diff --git a/views/staff/users/media.ejs b/views/staff/users/media.ejs index 6ea2668..b13e5fb 100644 --- a/views/staff/users/media.ejs +++ b/views/staff/users/media.ejs @@ -11,6 +11,8 @@
+[[ include ../_pagination ]] [[ include ../_media ]] +[[ include ../_pagination ]] [[ include ../_footer ]] diff --git a/views/staff/users/show.ejs b/views/staff/users/show.ejs index 127ca8c..8e9b447 100644 --- a/views/staff/users/show.ejs +++ b/views/staff/users/show.ejs @@ -80,17 +80,14 @@ [[- profile.isStaff ? "yes" : "no" ]] - - - - - - [[ if (String(user._id) != String(profile._id)) { ]] - - [[ } ]] - - + +

+
+ [[ if (String(user._id) != String(profile._id)) { ]] + + [[ } ]] +

Projects

-- cgit v1.2.3-70-g09d2