diff --git a/app.js b/app.js
index 7a6f68dc7a..a081cd4fa3 100644
--- a/app.js
+++ b/app.js
@@ -66,6 +66,7 @@
nconf.set('upload_url', nconf.get('url') + 'uploads/');
winston.info('Initializing NodeBB v' + pkg.version + ', on port ' + nconf.get('port') + ', using Redis store at ' + nconf.get('redis:host') + ':' + nconf.get('redis:port') + '.');
+ winston.info('NodeBB instance bound to: ' + (nconf.get('bind_address') || 'Any address'));
if (process.env.NODE_ENV === 'development') {
winston.info('Base Configuration OK.');
diff --git a/public/language/en/footer.json b/public/language/en/footer.json
index 2655ac2795..91cb43fb42 100644
--- a/public/language/en/footer.json
+++ b/public/language/en/footer.json
@@ -1,7 +1,4 @@
{
- "disconnect.title": "Socket Disconnect",
- "disconnect.message": "Looks like you disconnected, try reloading the page.",
- "disconnect.reload_button": "Reload",
"chat.chatting_with": "Chat with ",
"chat.placeholder": "type chat message, here press enter to send",
"chat.send": "Send",
diff --git a/public/language/en/topic.json b/public/language/en/topic.json
index a00c1e6f60..d7a4581ad6 100644
--- a/public/language/en/topic.json
+++ b/public/language/en/topic.json
@@ -1,5 +1,6 @@
{
"profile": "Profile",
+ "posted_by": "Posted by",
"chat": "Chat",
"notify_me": "Be notified of new replies in this topic",
"favourite": "Favourite",
diff --git a/public/src/ajaxify.js b/public/src/ajaxify.js
index 95619b4ffb..497823e3c7 100644
--- a/public/src/ajaxify.js
+++ b/public/src/ajaxify.js
@@ -38,8 +38,8 @@ var ajaxify = {};
window.onscroll = null;
// end
-
- var url = url.replace(/\/$/, "");
+ // Remove trailing slash
+ url = url.replace(/\/$/, "");
var hash = window.location.hash;
diff --git a/public/src/app.js b/public/src/app.js
index c3376caf65..5b9918afed 100644
--- a/public/src/app.js
+++ b/public/src/app.js
@@ -1,8 +1,6 @@
var socket,
config,
- app = {},
- API_URL = null;
-
+ app = {};
(function () {
var showWelcomeMessage = false;
@@ -12,8 +10,6 @@ var socket,
$.ajax({
url: RELATIVE_PATH + '/api/config',
success: function (data) {
- API_URL = data.api_url;
-
config = data;
if(socket) {
socket.disconnect();
@@ -23,8 +19,8 @@ var socket,
} else {
socket = io.connect(config.socket.address);
- var reconnecting = false;
- var reconnectTries = 0;
+ var reconnecting = false,
+ reconnectEl, reconnectTimer;
socket.on('event:connect', function (data) {
app.username = data.username;
@@ -40,17 +36,12 @@ var socket,
socket.on('connect', function (data) {
if (reconnecting) {
- setTimeout(function () {
- app.alert({
- alert_id: 'connection_alert',
- title: 'Connected',
- message: 'Connection successful.',
- type: 'success',
- timeout: 5000
- });
- }, 1000);
+ reconnectEl.html(' Connected!');
reconnecting = false;
- reconnectTries = 0;
+
+ setTimeout(function() {
+ reconnectEl.removeClass('active');
+ }, 3000);
}
socket.emit('api:updateHeader', {
@@ -63,33 +54,11 @@ var socket,
});
socket.on('reconnecting', function (data) {
- function showDisconnectModal() {
- $('#disconnect-modal').modal({
- backdrop: 'static',
- show: true
- });
-
- $('#reload-button').on('click', function () {
- $('#disconnect-modal').modal('hide');
- window.location.reload();
- });
- }
-
+ if (!reconnectEl) reconnectEl = $('#reconnect');
reconnecting = true;
- reconnectTries++;
-
- if (reconnectTries > 4) {
- showDisconnectModal();
- return;
- }
- app.alert({
- alert_id: 'connection_alert',
- title: 'Reconnecting',
- message: 'You have disconnected from NodeBB, we will try to reconnect you.
',
- type: 'warning',
- timeout: 5000
- });
+ reconnectEl.addClass('active');
+ reconnectEl.html(' Reconnecting...');
});
socket.on('api:user.get_online_users', function (users) {
diff --git a/public/src/forum/admin/footer.js b/public/src/forum/admin/footer.js
index 9d1d3acd44..ee9062af9d 100644
--- a/public/src/forum/admin/footer.js
+++ b/public/src/forum/admin/footer.js
@@ -102,7 +102,7 @@ var nodebb_admin = (function(nodebb_admin) {
alert_id: 'config_status',
timeout: 2500,
title: 'Changes Saved',
- message: 'Your changes to the NodeBB configuration have been saved. You may have to restart NodeBB to see the changes.',
+ message: 'Your changes to the NodeBB configuration have been saved.',
type: 'success'
});
} else {
diff --git a/public/src/forum/admin/users.js b/public/src/forum/admin/users.js
index a83d424964..289adafa3c 100644
--- a/public/src/forum/admin/users.js
+++ b/public/src/forum/admin/users.js
@@ -83,23 +83,6 @@
return false;
});
- $('#users-container').on('click', '.delete-btn', function() {
- var deleteBtn = $(this);
- var isAdmin = isUserAdmin(deleteBtn);
- var parent = deleteBtn.parents('.users-box');
- var uid = getUID(deleteBtn);
-
- if (!isAdmin) {
- bootbox.confirm('Do you really want to delete "' + parent.attr('data-username') + '"?', function(confirm) {
- if (confirm) {
- socket.emit('api:admin.user.deleteUser', uid);
- }
- });
- }
-
- return false;
- });
-
$('#users-container').on('click', '.ban-btn', function() {
var banBtn = $(this);
var isAdmin = isUserAdmin(banBtn);
diff --git a/public/src/forum/topic.js b/public/src/forum/topic.js
index 246d25a409..159fb970bc 100644
--- a/public/src/forum/topic.js
+++ b/public/src/forum/topic.js
@@ -234,7 +234,6 @@
if ($(window).scrollTop() > bottom && !app.infiniteLoaderActive && $('#post-container').children().length) {
app.loadMorePosts(tid);
- console.log('window scrolling');
}
});
}
diff --git a/public/src/modules/composer.js b/public/src/modules/composer.js
index 8326ec0245..924cf94fec 100644
--- a/public/src/modules/composer.js
+++ b/public/src/modules/composer.js
@@ -187,7 +187,15 @@ define(['taskbar'], function(taskbar) {
switch(action) {
case 'post': composer.post(uuid); break;
case 'minimize': composer.minimize(uuid); break;
- case 'discard': composer.discard(uuid); break;
+ case 'discard':
+ if (postContentEl.value.length > 0) {
+ bootbox.confirm('Are you sure you wish to discard this post?', function(discard) {
+ if (discard) composer.discard(uuid);
+ });
+ } else {
+ composer.discard(uuid);
+ }
+ break;
}
});
diff --git a/public/src/templates.js b/public/src/templates.js
index 25ed9a5d94..2e4faffc21 100644
--- a/public/src/templates.js
+++ b/public/src/templates.js
@@ -114,13 +114,9 @@
templates.load_template = function (callback, url, template) {
var location = document.location || window.location,
- rootUrl = location.protocol + '//' + (location.hostname || location.host) + (location.port ? ':' + location.port : '');
-
- var api_url = (url === '' || url === '/') ? 'home' : url;
-
- var tpl_url = templates.get_custom_map(api_url.split('?')[0]);
-
- var trimmed = api_url;
+ api_url = (url === '' || url === '/') ? 'home' : url,
+ tpl_url = templates.get_custom_map(api_url.split('?')[0]),
+ trimmed = api_url;
if (!tpl_url) {
tpl_url = templates.getTemplateNameFromUrl(api_url);
@@ -128,7 +124,6 @@
var template_data = null;
-
(function () {
var timestamp = new Date().getTime(); //debug
@@ -155,8 +150,7 @@
}());
(function () {
-
- jQuery.get(API_URL + api_url, function (data) {
+ jQuery.get(RELATIVE_PATH + '/api/' + api_url, function (data) {
if (!data) {
ajaxify.go('404');
diff --git a/public/templates/admin/header.tpl b/public/templates/admin/header.tpl
index 3a2c7b4768..72469a018a 100644
--- a/public/templates/admin/header.tpl
+++ b/public/templates/admin/header.tpl
@@ -58,6 +58,9 @@