diff --git a/public/src/admin/appearance/skins.js b/public/src/admin/appearance/skins.js index 861757c130..8a926f674d 100644 --- a/public/src/admin/appearance/skins.js +++ b/public/src/admin/appearance/skins.js @@ -59,16 +59,30 @@ define('admin/appearance/skins', function() { showRevert: true }, function(html) { themeContainer.html(html); + + var skin = config['theme:src'] + .match(/latest\/(\S+)\/bootstrap.min.css/)[1] + .replace(/(^|\s)([a-z])/g , function(m,p1,p2){return p1+p2.toUpperCase();}); + + highlightSelectedTheme(skin); }); }; function highlightSelectedTheme(themeId) { $('[data-theme]') .removeClass('selected') - .find('[data-action="use"]') - .html('Select Theme') - .removeClass('btn-success') - .addClass('btn-primary'); + .find('[data-action="use"]').each(function() { + if ($(this).parents('[data-theme]').attr('data-theme')) { + $(this) + .html('Select Theme') + .removeClass('btn-success') + .addClass('btn-primary'); + } + }); + + if (!themeId) { + return; + } $('[data-theme="' + themeId + '"]') .addClass('selected')