From bf2300afa925e2915a0b1b906691a3f5fbe4186d Mon Sep 17 00:00:00 2001 From: Julie Lala Date: Wed, 13 Aug 2014 02:20:21 -0400 Subject: fix edit links on profile --- server/lib/middleware.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'server/lib') diff --git a/server/lib/middleware.js b/server/lib/middleware.js index aec54ad..27b9c04 100644 --- a/server/lib/middleware.js +++ b/server/lib/middleware.js @@ -36,7 +36,7 @@ var middleware = { ensureLocals: function (req, res, next) { res.locals.token = req.csrfToken(); res.locals.logged_in = req.isAuthenticated() - res.locals.user = req.user || {} + res.locals.user = req.user || { id: undefined } res.locals.config = config res.locals.profile = null res.locals.opt = {} -- cgit v1.2.3-70-g09d2 From 5d1bb038332c540d8abe459092648a7b5ddfe734 Mon Sep 17 00:00:00 2001 From: Julie Lala Date: Wed, 13 Aug 2014 02:24:38 -0400 Subject: noui --- server/lib/views.js | 2 ++ views/reader.ejs | 2 ++ 2 files changed, 4 insertions(+) (limited to 'server/lib') diff --git a/server/lib/views.js b/server/lib/views.js index 27b7446..d619d71 100644 --- a/server/lib/views.js +++ b/server/lib/views.js @@ -36,6 +36,7 @@ views.editor = function (req, res) { date: moment(req.project.updated_at).format("M/DD/YYYY"), author: user.displayName, authorlink: "/profile/" + user.username, + noui: !! (req.query.noui === 1), }) }) } @@ -60,6 +61,7 @@ views.reader = function (req, res) { date: moment(req.project.updated_at).format("M/DD/YYYY"), author: user.displayName, authorlink: "/profile/" + user.username, + noui: !! (req.query.noui === 1), }) }) } diff --git a/views/reader.ejs b/views/reader.ejs index 44fb2dd..7c31766 100644 --- a/views/reader.ejs +++ b/views/reader.ejs @@ -8,6 +8,7 @@
+ [[ if (! noui) { ]]
[[ include partials/header ]] @@ -16,6 +17,7 @@ [[ include controls/reader/media-player ]]
+ [[ } ]] [[ include partials/confirm-modal ]] [[ include projects/layouts-modal ]] -- cgit v1.2.3-70-g09d2 From 0d971464a2af8ec795664fb3e6f50b888dcccf53 Mon Sep 17 00:00:00 2001 From: Julie Lala Date: Wed, 13 Aug 2014 02:33:01 -0400 Subject: style fixes --- public/assets/stylesheets/app.css | 14 ++++++++------ server/lib/views.js | 4 ++-- 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'server/lib') diff --git a/public/assets/stylesheets/app.css b/public/assets/stylesheets/app.css index 36cccef..e15ba84 100755 --- a/public/assets/stylesheets/app.css +++ b/public/assets/stylesheets/app.css @@ -158,13 +158,15 @@ h5 { .page .profile { color:white; } -.page table{ - width:100%; - height:400px; - border-top:1px solid; - margin:40px 0 0 0; +.page table { + width: 100%; + border-top: 1px solid; + margin: 40px 0 0 0; border-spacing: 0; - clear:both; + clear:nboth; +} +.page tr { + height: 400px; } .page table.showcase { height:70vh; diff --git a/server/lib/views.js b/server/lib/views.js index d619d71..b776582 100644 --- a/server/lib/views.js +++ b/server/lib/views.js @@ -36,7 +36,7 @@ views.editor = function (req, res) { date: moment(req.project.updated_at).format("M/DD/YYYY"), author: user.displayName, authorlink: "/profile/" + user.username, - noui: !! (req.query.noui === 1), + noui: !! (req.query.noui === '1'), }) }) } @@ -61,7 +61,7 @@ views.reader = function (req, res) { date: moment(req.project.updated_at).format("M/DD/YYYY"), author: user.displayName, authorlink: "/profile/" + user.username, - noui: !! (req.query.noui === 1), + noui: !! (req.query.noui === '1'), }) }) } -- cgit v1.2.3-70-g09d2 From 63da3ba331aa3d9714151ba5f502e6e1851d75bb Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 14 Aug 2014 15:21:48 -0400 Subject: only clobber thumbnail if layout changed --- .../assets/javascripts/ui/editor/EditorSettings.js | 19 ++++++++++++++++-- server/lib/api/projects.js | 23 +++++++++++++--------- 2 files changed, 31 insertions(+), 11 deletions(-) (limited to 'server/lib') diff --git a/public/assets/javascripts/ui/editor/EditorSettings.js b/public/assets/javascripts/ui/editor/EditorSettings.js index 9d75f66..e9239e4 100644 --- a/public/assets/javascripts/ui/editor/EditorSettings.js +++ b/public/assets/javascripts/ui/editor/EditorSettings.js @@ -37,11 +37,12 @@ var EditorSettings = FormView.extend({ } else { // console.log(data) + this.thumbnailIsStale() this.$id.val( data._id ) this.$name.val( data.name ) this.$description.val( data.description ) - data.privacy && this.$privacy.find("[value=" + data.privacy + "]").prop('checked', "checked") + data.privacy && this.$privacy.find("[value=" + data.privacy + "]").prop("checked", "checked") data.media && Scenery.deserialize(data.media) } @@ -124,10 +125,24 @@ var EditorSettings = FormView.extend({ fd.append( "walls", JSON.stringify( Rooms.serializeWalls() ) ) fd.append( "media", JSON.stringify( Scenery.serialize() ) ) fd.append( "startPosition", JSON.stringify( app.position(scene.camera) ) ) - fd.append( "thumbnail", dataUriToBlob(map.canvas.toDataURL()) ) + + if (this.thumbnailIsStale()) { + fd.append( "thumbnail", dataUriToBlob(map.canvas.toDataURL()) ) + } return fd }, + thumbnailState: null, + thumbnailIsStale: function(){ + var newState = JSON.stringify( Rooms.serialize() ) + + if (newState !== this.thumbnailState) { + this.thumbnailState = newState + return true + } + return false + }, + success: function(data){ this.$id.val(data._id) this.$name.val(data.name) diff --git a/server/lib/api/projects.js b/server/lib/api/projects.js index fc54a5f..bd3cb81 100644 --- a/server/lib/api/projects.js +++ b/server/lib/api/projects.js @@ -72,15 +72,20 @@ var projects = { data.slug = util.slugify(data.name) data.description = util.sanitize(data.description) - upload.put("projects", req.files.thumbnail, { - unacceptable: function(err){ - res.json({ error: { errors: { thumbnail: { message: "Problem saving thumbnail: " + err } } } }) - }, - success: function(url){ - data.photo = url - done() - } - }) + if (req.files.thumbnail) { + upload.put("projects", req.files.thumbnail, { + unacceptable: function(err){ + res.json({ error: { errors: { thumbnail: { message: "Problem saving thumbnail: " + err } } } }) + }, + success: function(url){ + data.photo = url + done() + } + }) + } + else { + done() + } function done() { Project.findOne({ _id: _id }, function(err, doc){ -- cgit v1.2.3-70-g09d2