From 272806a25d35204e5989cdb9f2707c4502343813 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Sun, 11 Aug 2013 13:09:27 -0400 Subject: [PATCH] closed #159 - issue where theme listing would hang if a theme folder did not contain theme.json Also refactored theme socket event a bit --- public/src/forum/admin/themes.js | 5 ++--- src/meta.js | 5 +---- src/websockets.js | 4 ++-- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/public/src/forum/admin/themes.js b/public/src/forum/admin/themes.js index 66b04a9de2..9328c85678 100644 --- a/public/src/forum/admin/themes.js +++ b/public/src/forum/admin/themes.js @@ -39,7 +39,7 @@ var nodebb_admin = (function(nodebb_admin) { (function() { 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); var bootstrapThemeContainer = document.querySelector('#bootstrap_themes'), @@ -81,7 +81,7 @@ var nodebb_admin = (function(nodebb_admin) { }, false); // Installed Themes - socket.once('api:admin:themes.getInstalled', function(themes) { + socket.emit('api:admin.themes.getInstalled', function(themes) { var instListEl = document.getElementById('installed_themes'), themeFrag = document.createDocumentFragment(), liEl = document.createElement('li'); @@ -108,5 +108,4 @@ var nodebb_admin = (function(nodebb_admin) { instListEl.innerHTML = ''; instListEl.appendChild(themeFrag); }); - socket.emit('api:admin:themes.getInstalled'); })(); \ No newline at end of file diff --git a/src/meta.js b/src/meta.js index 47ea895c4e..3ea054e314 100644 --- a/src/meta.js +++ b/src/meta.js @@ -49,7 +49,7 @@ var utils = require('./../public/src/utils.js'), themeArr.push(conf); next(); }); - } + } else next(); }); } else next(); }); @@ -57,9 +57,6 @@ var utils = require('./../public/src/utils.js'), callback(err, themeArr); }); }); - }, - saveViaGithub: function(repo_url, callback) { - // ... } } diff --git a/src/websockets.js b/src/websockets.js index 57b6e1973f..b3eb71850d 100644 --- a/src/websockets.js +++ b/src/websockets.js @@ -701,9 +701,9 @@ var SocketIO = require('socket.io').listen(global.server, { log:false }), 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) { - socket.emit('api:admin:themes.getInstalled', themeArr); + callback(themeArr); }); });