Baris Usakli
commit 3100bfcfd3

@ -1,5 +1,5 @@
{ {
"name": "NodeBB", "name": "nodebb",
"license": "GPLv3 or later", "license": "GPLv3 or later",
"description": "NodeBB Forum", "description": "NodeBB Forum",
"version": "0.0.3", "version": "0.0.3",
@ -31,7 +31,8 @@
"gravatar": "1.0.6", "gravatar": "1.0.6",
"nconf": "~0.6.7", "nconf": "~0.6.7",
"sitemap": "~0.6.0", "sitemap": "~0.6.0",
"cheerio": "~0.12.0" "cheerio": "~0.12.0",
"request": "~2.25.0"
}, },
"bugs": { "bugs": {
"url": "https://github.com/designcreateplay/NodeBB/issues" "url": "https://github.com/designcreateplay/NodeBB/issues"

@ -536,13 +536,14 @@ body .navbar .nodebb-inline-block {
} }
input { input {
width: 100%; width: 98%;
text-align: center; text-align: center;
border: none; border: none;
padding: 0.5em 0; padding: 0.5em 0;
-webkit-border-radius: 0px; -webkit-border-radius: 0px;
-moz-border-radius: 0px; -moz-border-radius: 0px;
border-radius: 0px; border-radius: 0px;
margin: 1% 1% 2% 1%;
} }
textarea { textarea {
@ -551,10 +552,10 @@ body .navbar .nodebb-inline-block {
padding: 0.5em; padding: 0.5em;
display: block; display: block;
width: 90%; width: 90%;
margin: 1em auto; margin: 0.5em auto;
resize: none; resize: none;
color: white; color: white;
height: 230px; height: 200px;
} }
#imagedrop { #imagedrop {

@ -1,7 +1,7 @@
define(['taskbar'], function(taskbar) { define(['taskbar'], function(taskbar) {
var composer = { var composer = {
initialized: false, initialized: false,
active: 0, active: undefined,
taskbar: taskbar, taskbar: taskbar,
posts: {}, posts: {},
postContainer: undefined, postContainer: undefined,
@ -95,17 +95,19 @@ define(['taskbar'], function(taskbar) {
'<span class="btn btn-link" tabindex="-1"><i class="icon-list"></i></span>' + '<span class="btn btn-link" tabindex="-1"><i class="icon-list"></i></span>' +
'<span class="btn btn-link" tabindex="-1"><i class="icon-link"></i></span>' + '<span class="btn btn-link" tabindex="-1"><i class="icon-link"></i></span>' +
'</div>' + '</div>' +
'<div class="btn-group action-bar" style="float: right; margin-right: -12px">' +
'<button data-action="post" class="btn" tabIndex="3"><i class="icon-ok"></i> Submit</button>' +
'<button data-action="minimize" class="btn hidden-phone" tabIndex="4"><i class="icon-download-alt"></i> Minimize</button>' +
'<button class="btn" data-action="discard" tabIndex="5"><i class="icon-remove"></i> Discard</button>' +
'</div>' +
'</div>' + '</div>' +
'<div style="position:relative;">'+ '<div style="position:relative;">'+
'<div id="imagedrop" class=""><div>Drag and Drop Images Here</div></div>'+ '<div id="imagedrop" class=""><div>Drag and Drop Images Here</div></div>'+
'<textarea tabIndex="2"></textarea>' + '<textarea tabIndex="2"></textarea>' +
'<div id="imagelist"></div>'+ '<div id="imagelist"></div>'+
'</div>'+ '</div>'+
'<div class="btn-toolbar">' +
'<div class="btn-group action-bar" style="float: right; margin-right: -8px">' +
'<button data-action="minimize" class="btn hidden-phone" tabIndex="4"><i class="icon-download-alt"></i> Minimize</button>' +
'<button class="btn" data-action="discard" tabIndex="5"><i class="icon-remove"></i> Discard</button>' +
'<button data-action="post" class="btn" tabIndex="3"><i class="icon-ok"></i> Submit</button>' +
'</div>' +
'</div>' +
'</div>'; '</div>';
document.body.insertBefore(composer.postContainer, taskbar); document.body.insertBefore(composer.postContainer, taskbar);
@ -220,6 +222,9 @@ define(['taskbar'], function(taskbar) {
break; break;
} }
}); });
window.addEventListener('resize', function() {
if (composer.active !== undefined) composer.reposition(composer.active);
});
composer.initialized = true; composer.initialized = true;
} }
@ -238,23 +243,15 @@ define(['taskbar'], function(taskbar) {
var post_data = composer.posts[post_uuid], var post_data = composer.posts[post_uuid],
titleEl = composer.postContainer.querySelector('input'), titleEl = composer.postContainer.querySelector('input'),
bodyEl = composer.postContainer.querySelector('textarea'), 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'), dropDiv = $(composer.postContainer).find('#imagedrop'),
imagelist = $(composer.postContainer).find('#imagelist'), imagelist = $(composer.postContainer).find('#imagelist');
windowRect, leftPos;
dropDiv.hide(); dropDiv.hide();
imagelist.empty(); imagelist.empty();
composer.reposition(post_uuid);
composer.active = post_uuid;
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.postContainer.setAttribute('data-uuid', post_uuid); composer.postContainer.setAttribute('data-uuid', post_uuid);
if (parseInt(post_data.tid) > 0) { if (parseInt(post_data.tid) > 0) {
titleEl.value = 'Replying to: ' + post_data.title; titleEl.value = 'Replying to: ' + post_data.title;
@ -269,8 +266,6 @@ define(['taskbar'], function(taskbar) {
} }
bodyEl.value = post_data.body bodyEl.value = post_data.body
// Direct user focus to the correct element // Direct user focus to the correct element
if ((parseInt(post_data.tid) || parseInt(post_data.pid)) > 0) { if ((parseInt(post_data.tid) || parseInt(post_data.pid)) > 0) {
bodyEl.focus(); bodyEl.focus();
@ -281,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) { composer.post = function(post_uuid) {
// Check title and post length // Check title and post length
var postData = composer.posts[post_uuid], var postData = composer.posts[post_uuid],
@ -347,6 +356,7 @@ define(['taskbar'], function(taskbar) {
composer.minimize = function(uuid) { composer.minimize = function(uuid) {
composer.postContainer.style.display = 'none'; composer.postContainer.style.display = 'none';
composer.active = undefined;
taskbar.minimize('composer', uuid); taskbar.minimize('composer', uuid);
} }

@ -84,13 +84,15 @@
Auth.create_routes = function(app) { Auth.create_routes = function(app) {
app.get('/logout', function(req, res) { app.get('/logout', function(req, res) {
console.log('info: [Auth] Session ' + req.sessionID + ' logout (uid: ' + global.uid + ')'); if (req.user && req.user.uid > 0) {
login_module.logout(req.sessionID, function(logout) { console.log('info: [Auth] Session ' + req.sessionID + ' logout (uid: ' + req.user.uid + ')');
req.logout(); login_module.logout(req.sessionID, function(logout) {
app.build_header({ req: req, res: res }, function(header) { req.logout();
res.send(header + templates['logout'] + templates['footer']); 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) { if (login_strategies.indexOf('twitter') !== -1) {
@ -123,13 +125,14 @@
app.get('/reset/:code', function(req, res) { 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']); res.send(header + templates['reset_code'].parse({ reset_code: req.params.code }) + templates['footer']);
}); });
}); });
app.get('/reset', function(req, res) { 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']); res.send(header + templates['reset'] + templates['footer']);
}); });
}); });

Loading…
Cancel
Save