From 1752be237bb9dfe19843372eeaa858245d84408e Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 25 Jul 2013 12:36:43 -0400 Subject: [PATCH 1/4] minor style changes to the composer (moved buttons to the bottom as well) --- public/css/style.less | 7 ++++--- public/src/modules/composer.js | 12 +++++++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/public/css/style.less b/public/css/style.less index af5fb49f18..484ea34e1c 100644 --- a/public/css/style.less +++ b/public/css/style.less @@ -536,13 +536,14 @@ body .navbar .nodebb-inline-block { } input { - width: 100%; + width: 98%; text-align: center; border: none; padding: 0.5em 0; -webkit-border-radius: 0px; -moz-border-radius: 0px; border-radius: 0px; + margin: 1% 1% 2% 1%; } textarea { @@ -551,10 +552,10 @@ body .navbar .nodebb-inline-block { padding: 0.5em; display: block; width: 90%; - margin: 1em auto; + margin: 0.5em auto; resize: none; color: white; - height: 230px; + height: 200px; } #imagedrop { diff --git a/public/src/modules/composer.js b/public/src/modules/composer.js index 3e97fdb92d..fec1ce41c5 100644 --- a/public/src/modules/composer.js +++ b/public/src/modules/composer.js @@ -95,17 +95,19 @@ define(['taskbar'], function(taskbar) { '' + '' + '' + - '
' + - '' + - '' + - '' + - '
' + '' + '
'+ '
Drag and Drop Images Here
'+ '' + '
'+ '
'+ + '
' + + '
' + + '' + + '' + + '' + + '
' + + '
' + ''; document.body.insertBefore(composer.postContainer, taskbar); From a2f46b9e5954526940b44a9a7d79a0f83c062f66 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 25 Jul 2013 13:09:11 -0400 Subject: [PATCH 2/4] updated app name (lowercase only) and added missing dep request --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 7e60c3a9c5..d968191c09 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "NodeBB", + "name": "nodebb", "license": "GPLv3 or later", "description": "NodeBB Forum", "version": "0.0.3", @@ -31,7 +31,8 @@ "gravatar": "1.0.6", "nconf": "~0.6.7", "sitemap": "~0.6.0", - "cheerio": "~0.12.0" + "cheerio": "~0.12.0", + "request": "~2.25.0" }, "bugs": { "url": "https://github.com/designcreateplay/NodeBB/issues" From 336345ee83131931fd7883ee5ae17cae89d0ca6f Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 25 Jul 2013 13:18:55 -0400 Subject: [PATCH 3/4] closed #137 --- public/src/modules/composer.js | 38 ++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/public/src/modules/composer.js b/public/src/modules/composer.js index fec1ce41c5..1d00f68172 100644 --- a/public/src/modules/composer.js +++ b/public/src/modules/composer.js @@ -1,7 +1,7 @@ define(['taskbar'], function(taskbar) { var composer = { initialized: false, - active: 0, + active: undefined, taskbar: taskbar, posts: {}, postContainer: undefined, @@ -222,6 +222,9 @@ define(['taskbar'], function(taskbar) { break; } }); + window.addEventListener('resize', function() { + if (composer.active !== undefined) composer.reposition(composer.active); + }); composer.initialized = true; } @@ -240,23 +243,15 @@ define(['taskbar'], function(taskbar) { var post_data = composer.posts[post_uuid], titleEl = composer.postContainer.querySelector('input'), bodyEl = composer.postContainer.querySelector('textarea'), - postWindowEl = composer.postContainer.querySelector('.span5'), - taskbarBtn = document.querySelector('#taskbar [data-uuid="' + post_uuid + '"]'), - btnRect = taskbarBtn.getBoundingClientRect(), - taskbarRect = document.getElementById('taskbar').getBoundingClientRect(), dropDiv = $(composer.postContainer).find('#imagedrop'), - imagelist = $(composer.postContainer).find('#imagelist'), - windowRect, leftPos; + imagelist = $(composer.postContainer).find('#imagelist'); dropDiv.hide(); imagelist.empty(); - - composer.postContainer.style.display = 'block'; - windowRect = postWindowEl.getBoundingClientRect(); - leftPos = btnRect.left + btnRect.width - windowRect.width; - postWindowEl.style.left = (leftPos > 0 ? leftPos : 0) + 'px'; - composer.postContainer.style.bottom = taskbarRect.height + "px"; + composer.reposition(post_uuid); + composer.active = post_uuid; + composer.postContainer.setAttribute('data-uuid', post_uuid); if (parseInt(post_data.tid) > 0) { titleEl.value = 'Replying to: ' + post_data.title; @@ -271,8 +266,6 @@ define(['taskbar'], function(taskbar) { } bodyEl.value = post_data.body - - // Direct user focus to the correct element if ((parseInt(post_data.tid) || parseInt(post_data.pid)) > 0) { bodyEl.focus(); @@ -283,6 +276,20 @@ define(['taskbar'], function(taskbar) { } } + composer.reposition = function(post_uuid) { + var postWindowEl = composer.postContainer.querySelector('.span5'), + taskbarBtn = document.querySelector('#taskbar [data-uuid="' + post_uuid + '"]'), + btnRect = taskbarBtn.getBoundingClientRect(), + taskbarRect = document.getElementById('taskbar').getBoundingClientRect(), + windowRect, leftPos; + + composer.postContainer.style.display = 'block'; + windowRect = postWindowEl.getBoundingClientRect(); + leftPos = btnRect.left + btnRect.width - windowRect.width; + postWindowEl.style.left = (leftPos > 0 ? leftPos : 0) + 'px'; + composer.postContainer.style.bottom = taskbarRect.height + "px"; + } + composer.post = function(post_uuid) { // Check title and post length var postData = composer.posts[post_uuid], @@ -349,6 +356,7 @@ define(['taskbar'], function(taskbar) { composer.minimize = function(uuid) { composer.postContainer.style.display = 'none'; + composer.active = undefined; taskbar.minimize('composer', uuid); } From 12e8423a2464624bcddad3ddf3030f7ea7c12b78 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 25 Jul 2013 14:04:00 -0400 Subject: [PATCH 4/4] closed #132 - issue where all auth routes were not rendering the header properly --- src/routes/authentication.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/routes/authentication.js b/src/routes/authentication.js index 19ac5345df..ecdf8972fe 100644 --- a/src/routes/authentication.js +++ b/src/routes/authentication.js @@ -84,13 +84,15 @@ Auth.create_routes = function(app) { app.get('/logout', function(req, res) { - console.log('info: [Auth] Session ' + req.sessionID + ' logout (uid: ' + global.uid + ')'); - login_module.logout(req.sessionID, function(logout) { - req.logout(); - app.build_header({ req: req, res: res }, function(header) { - res.send(header + templates['logout'] + templates['footer']); + if (req.user && req.user.uid > 0) { + console.log('info: [Auth] Session ' + req.sessionID + ' logout (uid: ' + req.user.uid + ')'); + login_module.logout(req.sessionID, function(logout) { + req.logout(); + app.build_header({ req: req, res: res }, function(err, header) { + res.send(header + templates['logout'] + templates['footer']); + }); }); - }); + } else res.redirect('/'); }); if (login_strategies.indexOf('twitter') !== -1) { @@ -123,13 +125,14 @@ app.get('/reset/:code', function(req, res) { - app.build_header({ req: req, res: res }, function(header) { + app.build_header({ req: req, res: res }, function(err, header) { res.send(header + templates['reset_code'].parse({ reset_code: req.params.code }) + templates['footer']); }); }); app.get('/reset', function(req, res) { - app.build_header({ req: req, res: res }, function(header) { + app.build_header({ req: req, res: res }, function(err, header) { + console.log(header); res.send(header + templates['reset'] + templates['footer']); }); });