diff --git a/app.js b/app.js
index 66b2c5116a..7d4f854087 100644
--- a/app.js
+++ b/app.js
@@ -157,7 +157,7 @@ fs.readFile(path.join(__dirname, 'config.json'), function(err, data) {
address: base_url,
port: port
},
- api_url: base_url + ':' + port + '/api/'
+ api_url: base_url + (use_port ? ':' + port : '') + '/api/'
}, null, 4))
});
});
diff --git a/package.json b/package.json
index 6dd89d58ee..6ce01eec26 100644
--- a/package.json
+++ b/package.json
@@ -23,7 +23,7 @@
"passport-twitter": "0.1.4",
"passport-google-oauth": "0.1.5",
"passport-facebook": "0.1.5",
- "less-middleware": "0.1.11",
+ "less-middleware": "0.1.12",
"marked": "0.2.8",
"bcrypt": "0.7.5",
"node-gyp": "0.9.5",
diff --git a/public/css/nodebb.less b/public/css/nodebb.less
index c9423a17b8..78c464f8b4 100644
--- a/public/css/nodebb.less
+++ b/public/css/nodebb.less
@@ -2,3 +2,4 @@
@import "topic";
@import "category";
+@import "noscript";
\ No newline at end of file
diff --git a/public/css/noscript.less b/public/css/noscript.less
new file mode 100644
index 0000000000..0c9ddd3ebb
--- /dev/null
+++ b/public/css/noscript.less
@@ -0,0 +1,15 @@
+@import "mixins";
+
+noscript {
+ .posts {
+ li {
+ list-style-type: none;
+ padding: 1em;
+ margin-bottom: 1em;
+
+ &:nth-child(even) {
+ background: rgba(192,192,192,0.2);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/public/src/forum/admin/themes.js b/public/src/forum/admin/themes.js
index 770d6e8452..76c50c2900 100644
--- a/public/src/forum/admin/themes.js
+++ b/public/src/forum/admin/themes.js
@@ -58,7 +58,11 @@ nodebb_admin.themes = {
var revertEl = document.getElementById('revert_theme');
revertEl.addEventListener('click', function() {
- nodebb_admin.remove('theme:id');
- nodebb_admin.remove('theme:src');
+ bootbox.confirm('Are you sure you wish to remove the custom theme and restore the NodeBB default theme?', function(confirm) {
+ if (confirm) {
+ nodebb_admin.remove('theme:id');
+ nodebb_admin.remove('theme:src');
+ }
+ });
}, false);
})();
\ No newline at end of file
diff --git a/public/src/forum/category.js b/public/src/forum/category.js
index 620ba2eae9..4388198e5b 100644
--- a/public/src/forum/category.js
+++ b/public/src/forum/category.js
@@ -15,11 +15,6 @@
'event:new_topic'
]);
- if (jQuery('.category-item').length == 0) {
- jQuery('#topics-container, .category-sidebar').hide();
- jQuery('#category-no-topics').show();
- }
-
socket.on('event:new_topic', function(data) {
var html = templates.prepare(templates['category'].blocks['topics']).parse({ topics: [data] }),
topic = document.createElement('div'),
@@ -28,8 +23,8 @@
numTopics = topics.length,
x;
- jQuery('#topics-container, .category-sidebar').show();
- jQuery('#category-no-topics').hide();
+ jQuery('#topics-container, .category-sidebar').removeClass('hidden');
+ jQuery('#category-no-topics').remove();
topic.innerHTML = html;
if (numTopics > 0) {
diff --git a/public/src/forum/topic.js b/public/src/forum/topic.js
index 64e536ce21..d62834b7e9 100644
--- a/public/src/forum/topic.js
+++ b/public/src/forum/topic.js
@@ -43,13 +43,13 @@
deleteThreadEl.addEventListener('click', function(e) {
e.preventDefault();
if (thread_state.deleted !== '1') {
- if (confirm('really delete thread? (THIS DIALOG TO BE REPLACED WITH BOOTBOX)')) {
- socket.emit('api:topic.delete', { tid: tid });
- }
+ bootbox.confirm('Are you sure you want to delete this thread?', function(confirm) {
+ if (confirm) socket.emit('api:topic.delete', { tid: tid });
+ });
} else {
- if (confirm('really restore thread? (THIS DIALOG TO BE REPLACED WITH BOOTBOX)')) {
- socket.emit('api:topic.restore', { tid: tid });
- }
+ bootbox.confirm('Are you sure you want to restore this thread?', function(confirm) {
+ if (confirm) socket.emit('api:topic.restore', { tid: tid });
+ });
}
}, false);
@@ -372,6 +372,7 @@
});
socket.on('event:new_post', function(data) {
+ data.posts[0].display_moderator_tools = 'none';
var html = templates.prepare(templates['topic'].blocks['posts']).parse(data),
uniqueid = new Date().getTime();
@@ -381,6 +382,11 @@
.append(html)
.fadeIn('slow');
+ socket.once('api:post.privileges', function(privileges) {
+ if (privileges.editable) toggle_mod_tools(data.posts[0].pid, true);
+ });
+ socket.emit('api:post.privileges', data.posts[0].pid);
+
set_up_posts(uniqueid);
addCommasToNumbers();
@@ -528,7 +534,7 @@
quoteBtns = document.querySelectorAll('#post-container .quote'),
editBtns = document.querySelectorAll('#post-container .edit'),
deleteBtns = document.querySelectorAll('#post-container .delete'),
- numReplyBtns = postReplyBtns.length,
+ numPosts = document.querySelectorAll('#post_container li[data-pid]').length,
lockThreadEl = document.getElementById('lock_thread'),
x;
@@ -536,7 +542,7 @@
lockThreadEl.innerHTML = ' Unlock Thread';
threadReplyBtn.disabled = true;
threadReplyBtn.innerHTML = 'Locked ';
- for(x=0;x';
quoteBtns[x].style.display = 'none';
editBtns[x].style.display = 'none';
@@ -558,7 +564,7 @@
lockThreadEl.innerHTML = ' Lock Thread';
threadReplyBtn.disabled = false;
threadReplyBtn.innerHTML = 'Reply';
- for(x=0;x';
quoteBtns[x].style.display = 'inline-block';
editBtns[x].style.display = 'inline-block';
@@ -680,4 +686,18 @@
replyEl.addClass('none');
}
}
+
+ function toggle_mod_tools(pid, state) {
+ var postEl = $(document.querySelector('#post-container li[data-pid="' + pid + '"]')),
+ editEl = postEl.find('.edit'),
+ deleteEl = postEl.find('.delete');
+
+ if (state) {
+ editEl.removeClass('none');
+ deleteEl.removeClass('none');
+ } else {
+ editEl.addClass('none');
+ deleteEl.addClass('none');
+ }
+ }
})();
\ No newline at end of file
diff --git a/public/src/templates.js b/public/src/templates.js
index 4a39277c2b..4151d8f823 100644
--- a/public/src/templates.js
+++ b/public/src/templates.js
@@ -210,7 +210,7 @@
data = template.match(regex);
if (data == null) return;
- if (block !== undefined) self.blocks[block] = data[0];
+ if (self.blocks && block !== undefined) self.blocks[block] = data[0];
data = data[0]
.replace("", "")
diff --git a/public/templates/admin/footer.tpl b/public/templates/admin/footer.tpl
index f780eb6fe2..3b10c74e8e 100644
--- a/public/templates/admin/footer.tpl
+++ b/public/templates/admin/footer.tpl
@@ -11,7 +11,6 @@
prepare: function() {
// Come back in 500ms if the config isn't ready yet
if (nodebb_admin.config === undefined) {
- console.log('Config not ready...');
setTimeout(function() {
nodebb_admin.prepare();
}, 500);
@@ -71,9 +70,6 @@
}
});
},
- // save: function(key, value) {
- // socket.emit('api:config.set', { key: key, value: value });
- // },
remove: function(key) {
socket.emit('api:config.remove', key);
}
diff --git a/public/templates/admin/header.tpl b/public/templates/admin/header.tpl
index 528c81f503..2a586dad4a 100644
--- a/public/templates/admin/header.tpl
+++ b/public/templates/admin/header.tpl
@@ -13,6 +13,7 @@
+
+
' +
templates['footer']
);
diff --git a/src/websockets.js b/src/websockets.js
index 95b613e97a..1a18bb316f 100644
--- a/src/websockets.js
+++ b/src/websockets.js
@@ -336,7 +336,7 @@ var SocketIO = require('socket.io').listen(global.server, { log:false }),
});
},
function(next) {
- topics.getTitle(data.pid, function(title) {
+ topics.getTitleByPid(data.pid, function(title) {
next(null, title);
});
}