closed #159 - issue where theme listing would hang if a theme folder did

not contain theme.json

Also refactored theme socket event a bit
v1.18.x
Julian Lam 12 years ago
parent 27f874759e
commit 272806a25d

@ -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,7 +81,7 @@ 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');
@ -108,5 +108,4 @@ var nodebb_admin = (function(nodebb_admin) {
instListEl.innerHTML = ''; instListEl.innerHTML = '';
instListEl.appendChild(themeFrag); instListEl.appendChild(themeFrag);
}); });
socket.emit('api:admin:themes.getInstalled');
})(); })();

@ -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) {
// ...
} }
} }

@ -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