diff --git a/app.js b/app.js
index 7142c368ed..66b2c5116a 100644
--- a/app.js
+++ b/app.js
@@ -49,7 +49,9 @@ fs.readFile(path.join(__dirname, 'config.json'), function(err, data) {
templates.init([
'header', 'footer', 'logout', 'admin/header', 'admin/footer', 'admin/index',
'emails/reset', 'emails/reset_plaintext', 'emails/email_confirm', 'emails/email_confirm_plaintext',
- 'emails/header', 'emails/footer', 'install/header', 'install/footer', 'install/redis'
+ 'emails/header', 'emails/footer', 'install/header', 'install/footer', 'install/redis',
+
+ 'noscript/topic'
]);
templates.ready(function() {
diff --git a/public/css/admin.less b/public/css/admin.less
index 946a2233af..97615c5f24 100644
--- a/public/css/admin.less
+++ b/public/css/admin.less
@@ -1,13 +1,4 @@
-.inline-block {
- display: inline-block;
- *display: inline;
- zoom: 1;
-}
-
-.pointer {
- cursor: pointer;
- *cursor: hand;
-}
+@import "mixins";
.entry-row {
border-radius: 10px;
@@ -58,7 +49,7 @@
li {
padding: 10px 16px;
margin: 0.25em 1em;
- .inline-block;
+ list-style-type: none;
.pointer;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
@@ -69,6 +60,19 @@
-o-transition: background-color 250ms linear;
transition: background-color 250ms linear;
+ img {
+ max-width: 150px;
+ float: left;
+ }
+
+ h4, p {
+ margin-left: 170px;
+ }
+
+ p {
+ font-size: 0.9em;
+ }
+
&:hover {
background-color: rgba(128, 128, 128, 0.2);
}
diff --git a/public/css/mixins.less b/public/css/mixins.less
new file mode 100644
index 0000000000..fec0b45add
--- /dev/null
+++ b/public/css/mixins.less
@@ -0,0 +1,23 @@
+.no-select {
+ -webkit-touch-callout: none;
+ -webkit-user-select: none;
+ -khtml-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+}
+
+.pointer {
+ cursor: pointer;
+ *cursor: hand;
+}
+
+.inline-block {
+ display: inline-block;
+ *display: inline;
+ zoom: 1;
+}
+
+.clear {
+ clear: both;
+}
\ No newline at end of file
diff --git a/public/css/style.less b/public/css/style.less
index 5903c56a7d..7a0e1b1fd6 100644
--- a/public/css/style.less
+++ b/public/css/style.less
@@ -1,22 +1,4 @@
-.no-select {
- -webkit-touch-callout: none;
- -webkit-user-select: none;
- -khtml-user-select: none;
- -moz-user-select: none;
- -ms-user-select: none;
- user-select: none;
-}
-
-.pointer {
- cursor: pointer;
- *cursor: hand;
-}
-
-.inline-block {
- display: inline-block;
- *display: inline;
- zoom: 1;
-}
+@import "mixins";
body {
/*background: #fdfdfd;*/ // port to default theme when it is implemented.
diff --git a/public/src/forum/admin/themes.js b/public/src/forum/admin/themes.js
new file mode 100644
index 0000000000..770d6e8452
--- /dev/null
+++ b/public/src/forum/admin/themes.js
@@ -0,0 +1,64 @@
+nodebb_admin.themes = {
+ render: function(bootswatch) {
+ var themeFrag = document.createDocumentFragment(),
+ themeEl = document.createElement('li'),
+ themeContainer = document.querySelector('#content .themes'),
+ numThemes = bootswatch.themes.length;
+
+ for(var x=0;x ' +
+ '
' +
+ '
' +
+ 'Use ' +
+ 'Preview ' +
+ '
' +
+ '
' + theme.name + ' ' +
+ '
' + theme.description + '
' +
+ '
' +
+ '';
+ themeFrag.appendChild(themeEl.cloneNode(true));
+ }
+ themeContainer.innerHTML = '';
+ themeContainer.appendChild(themeFrag);
+ }
+};
+
+(function() {
+ var scriptEl = document.createElement('script');
+ scriptEl.src = 'http://api.bootswatch.com?callback=nodebb_admin.themes.render';
+ document.body.appendChild(scriptEl);
+
+ var themeContainer = document.querySelector('#content .themes');
+ themeContainer.addEventListener('click', function(e) {
+ if (e.target.hasAttribute('data-action')) {
+ switch(e.target.getAttribute('data-action')) {
+ case 'preview':
+ var cssSrc = $(e.target).parents('li').attr('data-css'),
+ cssEl = document.getElementById('base-theme');
+
+ cssEl.href = cssSrc;
+ break;
+ case 'use':
+ var parentEl = $(e.target).parents('li'),
+ cssSrc = parentEl.attr('data-css'),
+ cssName = parentEl.attr('data-theme');
+ socket.emit('api:config.set', {
+ key: 'theme:id', value: 'bootswatch:' + cssName
+ });
+ socket.emit('api:config.set', {
+ key: 'theme:src', value: cssSrc
+ });
+ break;
+ }
+ }
+ }, false);
+
+ var revertEl = document.getElementById('revert_theme');
+ revertEl.addEventListener('click', function() {
+ nodebb_admin.remove('theme:id');
+ nodebb_admin.remove('theme:src');
+ }, false);
+})();
\ No newline at end of file
diff --git a/public/templates/admin/footer.tpl b/public/templates/admin/footer.tpl
index 6add320169..f780eb6fe2 100644
--- a/public/templates/admin/footer.tpl
+++ b/public/templates/admin/footer.tpl
@@ -7,71 +7,77 @@
+
+
diff --git a/public/templates/admin/themes.tpl b/public/templates/admin/themes.tpl
index 6bb6cedb3c..76994f6453 100644
--- a/public/templates/admin/themes.tpl
+++ b/public/templates/admin/themes.tpl
@@ -1,71 +1,18 @@
Themes
+
Bootswatch Themes
- NodeBB Themes are powered by Bootswatch, a repository containing hundreds of themes built
+ NodeBB Themes are powered by Bootswatch, a repository containing themes built
with Bootstrap as a base theme.
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/public/templates/noscript/topic.tpl b/public/templates/noscript/topic.tpl
new file mode 100644
index 0000000000..a0b4445589
--- /dev/null
+++ b/public/templates/noscript/topic.tpl
@@ -0,0 +1,15 @@
+
+
+ Your browser does not seem to support javascript. As a result, your viewing experience will be diminished.
+
+
+ Please download a browser that supports javascript, or enable it, if it disabled (i.e. NoScript).
+
+
+
\ No newline at end of file
diff --git a/src/meta.js b/src/meta.js
index 294f3d1fdd..70b7d11ee9 100644
--- a/src/meta.js
+++ b/src/meta.js
@@ -37,6 +37,9 @@ var utils = require('./../public/src/utils.js'),
RDB.hset('config', field, value, function(err, res) {
callback(err);
});
+ },
+ remove: function(field) {
+ RDB.hdel('config', field);
}
}
}(exports));
\ No newline at end of file
diff --git a/src/topics.js b/src/topics.js
index 3ec79478be..a90e41f4ae 100644
--- a/src/topics.js
+++ b/src/topics.js
@@ -184,6 +184,16 @@ marked.setOptions({
});
}
+ Topics.get_posts_noscript = function(tid, current_user, callback) {
+ // Topics.get_topic(tid, current_user, function() {
+ callback([
+ {
+ foo: 'bar'
+ }
+ ]);
+ // });
+ }
+
Topics.get_cid_by_tid = function(tid, callback) {
RDB.get(schema.topics(tid).cid, function(err, cid) {
if (cid && parseInt(cid) > 0) {
diff --git a/src/webserver.js b/src/webserver.js
index 1c23af81bb..e97779c534 100644
--- a/src/webserver.js
+++ b/src/webserver.js
@@ -114,10 +114,11 @@ var express = require('express'),
var topic_url = tid + (req.params.slug ? '/' + req.params.slug : '');
- topics.get_cid_by_tid(tid, function(cid) {
+ topics.get_posts_noscript(tid, ((req.user) ? req.user.uid : 0), function(posts) {
res.send(
build_header() +
- '' +
+ '\n\t
\n\t\t' + templates['noscript/topic'] + '\n\t ' +
+ '\n\t' +
templates['footer']
);
});
diff --git a/src/websockets.js b/src/websockets.js
index 78283703f9..916ab20255 100644
--- a/src/websockets.js
+++ b/src/websockets.js
@@ -307,6 +307,10 @@ var SocketIO = require('socket.io').listen(global.server, { log:false }),
});
});
+ socket.on('api:config.remove', function(key) {
+ meta.config.remove(key);
+ });
+
socket.on('api:composer.push', function(data) {
if (uid > 0) {
if (parseInt(data.tid) > 0) {