Skip to content

Node.js based forum software built for the modern web

tweaking admin panel integration

Julian Lam9166c82dc221
diff --git a/public/src/forum/admin/themes.js b/public/src/forum/admin/themes.js
index 1b4f0f8e4d..b783e03f95 100644
--- a/public/src/forum/admin/themes.js
+++ b/public/src/forum/admin/themes.js
@@ -16,20 +16,30 @@ define(function() {
cssEl = document.getElementById('base-theme');
cssEl.href = cssSrc;
- break;
+ break;
case 'use':
var parentEl = $(e.target).parents('li'),
+ themeType = parentEl.attr('data-type'),
cssSrc = parentEl.attr('data-css'),
cssName = parentEl.attr('data-theme');
+
socket.emit('api:config.set', {
- key: 'theme:id',
- value: 'bootswatch:' + cssName
+ key: 'theme:type',
+ value: themeType
});
+
socket.emit('api:config.set', {
- key: 'theme:src',
- value: cssSrc
+ key: 'theme:id',
+ value: cssName
});
- break;
+
+ if (themeType === 'bootswatch') {
+ socket.emit('api:config.set', {
+ key: 'theme:src',
+ value: cssSrc
+ });
+ }
+ break;
}
}
};
@@ -53,11 +63,11 @@ define(function() {
var instListEl = document.getElementById('installed_themes'),
themeFrag = document.createDocumentFragment(),
liEl = document.createElement('li');
+ liEl.setAttribute('data-type', 'local');
if (themes.length > 0) {
for (var x = 0, numThemes = themes.length; x < numThemes; x++) {
liEl.setAttribute('data-theme', themes[x].id);
- liEl.setAttribute('data-css', themes[x].src);
liEl.innerHTML = '<img src="' + themes[x].screenshot + '" />' +
'<div>' +
'<div class="pull-right">' +
@@ -91,6 +101,8 @@ define(function() {
themeContainer = document.querySelector('#bootstrap_themes'),
numThemes = bootswatch.themes.length;
+ themeEl.setAttribute('data-type', 'bootswatch');
+
for (var x = 0; x < numThemes; x++) {
var theme = bootswatch.themes[x];
themeEl.setAttribute('data-css', theme.cssMin);