Baris Soner Usakli 12 years ago
commit 149e8ac78e

@ -1,4 +1,6 @@
#!/bin/bash #!/bin/bash
clear clear
echo "Launching NodeBB in \"development\" mode" echo "Launching NodeBB in \"development\" mode."
echo "To run the production build of NodeBB, please use \"forever\"."
echo "More Information: https://github.com/designcreateplay/NodeBB/wiki/How-to-run-NodeBB"
NODE_ENV=development supervisor --extensions 'node|js|tpl' -- app $1 NODE_ENV=development supervisor --extensions 'node|js|tpl' -- app $1

@ -85,6 +85,10 @@
&:hover { &:hover {
background-color: rgba(128, 128, 128, 0.2); background-color: rgba(128, 128, 128, 0.2);
} }
&.no-themes {
font-style: italic;
}
} }
} }

@ -39,7 +39,7 @@ var nodebb_admin = (function(nodebb_admin) {
(function() { (function() {
var scriptEl = document.createElement('script'); var scriptEl = document.createElement('script');
scriptEl.src = 'http://api.bootswatch.com?callback=nodebb_admin.themes.render'; scriptEl.src = 'http://api.bootswatch.com/2/?callback=nodebb_admin.themes.render';
document.body.appendChild(scriptEl); document.body.appendChild(scriptEl);
var bootstrapThemeContainer = document.querySelector('#bootstrap_themes'), var bootstrapThemeContainer = document.querySelector('#bootstrap_themes'),
@ -81,32 +81,38 @@ var nodebb_admin = (function(nodebb_admin) {
}, false); }, false);
// Installed Themes // Installed Themes
socket.once('api:admin:themes.getInstalled', function(themes) { socket.emit('api:admin.themes.getInstalled', function(themes) {
var instListEl = document.getElementById('installed_themes'), var instListEl = document.getElementById('installed_themes'),
themeFrag = document.createDocumentFragment(), themeFrag = document.createDocumentFragment(),
liEl = document.createElement('li'); liEl = document.createElement('li');
for(var x=0,numThemes=themes.length;x<numThemes;x++) { if (themes.length > 0) {
liEl.setAttribute('data-theme', themes[x].id); for(var x=0,numThemes=themes.length;x<numThemes;x++) {
liEl.setAttribute('data-css', themes[x].src); liEl.setAttribute('data-theme', themes[x].id);
liEl.innerHTML = '<img src="' + themes[x].screenshot + '" />' + liEl.setAttribute('data-css', themes[x].src);
'<div>' + liEl.innerHTML = '<img src="' + themes[x].screenshot + '" />' +
'<div class="pull-right">' + '<div>' +
'<button class="btn btn-primary" data-action="use">Use</button> ' + '<div class="pull-right">' +
'<button class="btn" data-action="preview">Preview</button>' + '<button class="btn btn-primary" data-action="use">Use</button> ' +
'<button class="btn" data-action="preview">Preview</button>' +
'</div>' +
'<h4>' + themes[x].name + '</h4>' +
'<p>' +
themes[x].description +
(themes[x].url ? ' (<a href="' + themes[x].url + '">Homepage</a>)' : '') +
'</p>' +
'</div>' + '</div>' +
'<h4>' + themes[x].name + '</h4>' + '<div class="clear">';
'<p>' + themeFrag.appendChild(liEl.cloneNode(true));
themes[x].description + }
(themes[x].url ? ' (<a href="' + themes[x].url + '">Homepage</a>)' : '') + } else {
'</p>' + // No themes found
'</div>' + liEl.className = 'no-themes';
'<div class="clear">'; liEl.innerHTML = 'No installed themes found';
themeFrag.appendChild(liEl.cloneNode(true)); themeFrag.appendChild(liEl);
} }
instListEl.innerHTML = ''; instListEl.innerHTML = '';
instListEl.appendChild(themeFrag); instListEl.appendChild(themeFrag);
}); });
socket.emit('api:admin:themes.getInstalled');
})(); })();

@ -32,6 +32,23 @@ $(document).ready(function() {
socket.emit('api:admin.topics.getMore', { socket.emit('api:admin.topics.getMore', {
limit: 10, limit: 10,
after: lastTid after: lastTid
}, function(topics) {
var btnEl = document.getElementById('topics_loadmore');
topics = JSON.parse(topics);
if (topics.length > 0) {
var html = templates.prepare(templates['admin/topics'].blocks['topics']).parse({
topics: topics
}),
topicsListEl = document.querySelector('.topics');
topicsListEl.innerHTML += html;
btnEl.innerHTML = 'Load More Topics';
} else {
// Exhausted all topics
btnEl.className += ' disabled';
btnEl.innerHTML = 'No more topics';
}
}); });
} }
}, false); }, false);
@ -40,9 +57,9 @@ $(document).ready(function() {
var topicEls = topicsListEl.querySelectorAll('li'), var topicEls = topicsListEl.querySelectorAll('li'),
numTopics = topicEls.length; numTopics = topicEls.length;
for(var x=0;x<numTopics;x++) { for(var x=0;x<numTopics;x++) {
if (topicEls[x].getAttribute('data-pinned')) topicEls[x].querySelector('[data-action="pin"]').className += ' active'; if (topicEls[x].getAttribute('data-pinned') === '1') topicEls[x].querySelector('[data-action="pin"]').className += ' active';
if (topicEls[x].getAttribute('data-locked')) topicEls[x].querySelector('[data-action="lock"]').className += ' active'; if (topicEls[x].getAttribute('data-locked') === '1') topicEls[x].querySelector('[data-action="lock"]').className += ' active';
if (topicEls[x].getAttribute('data-deleted')) topicEls[x].querySelector('[data-action="delete"]').className += ' active'; if (topicEls[x].getAttribute('data-deleted') === '1') topicEls[x].querySelector('[data-action="delete"]').className += ' active';
topicEls[x].removeAttribute('data-pinned'); topicEls[x].removeAttribute('data-pinned');
topicEls[x].removeAttribute('data-locked'); topicEls[x].removeAttribute('data-locked');
topicEls[x].removeAttribute('data-deleted'); topicEls[x].removeAttribute('data-deleted');
@ -95,24 +112,4 @@ socket.on('api:topic.restore', function(response) {
$(btnEl).removeClass('active'); $(btnEl).removeClass('active');
} }
});
socket.on('api:admin.topics.getMore', function(topics) {
var btnEl = document.getElementById('topics_loadmore');
topics = JSON.parse(topics);
console.log(topics);
if (topics.length > 0) {
var html = templates.prepare(templates['admin/topics'].blocks['topics']).parse({
topics: topics
}),
topicsListEl = document.querySelector('.topics');
topicsListEl.innerHTML += html;
btnEl.innerHTML = 'Load More Topics';
} else {
// Exhausted all topics
btnEl.className += ' disabled';
btnEl.innerHTML = 'No more topics';
}
}); });

@ -49,7 +49,7 @@ var utils = require('./../public/src/utils.js'),
themeArr.push(conf); themeArr.push(conf);
next(); next();
}); });
} } else next();
}); });
} else next(); } else next();
}); });
@ -57,9 +57,6 @@ var utils = require('./../public/src/utils.js'),
callback(err, themeArr); callback(err, themeArr);
}); });
}); });
},
saveViaGithub: function(repo_url, callback) {
// ...
} }
} }

@ -663,9 +663,9 @@ var SocketIO = require('socket.io').listen(global.server, { log:false }),
}); });
}); });
socket.on('api:admin.topics.getMore', function(data) { socket.on('api:admin.topics.getMore', function(data, callback) {
topics.getAllTopics(data.limit, data.after, function(topics) { topics.getAllTopics(data.limit, data.after, function(topics) {
socket.emit('api:admin.topics.getMore', JSON.stringify(topics)); callback(JSON.stringify(topics));
}); });
}); });
@ -701,9 +701,9 @@ var SocketIO = require('socket.io').listen(global.server, { log:false }),
socket.emit('api:admin.user.search', null); socket.emit('api:admin.user.search', null);
}); });
socket.on('api:admin:themes.getInstalled', function() { socket.on('api:admin.themes.getInstalled', function(callback) {
meta.themes.get(function(err, themeArr) { meta.themes.get(function(err, themeArr) {
socket.emit('api:admin:themes.getInstalled', themeArr); callback(themeArr);
}); });
}); });

Loading…
Cancel
Save