barisusakli 11 years ago
commit 822cf56af1

@ -0,0 +1,23 @@
"use strict";
var admin = {};
(function() {
admin.enableColorPicker = function(inputEl, callback) {
(inputEl instanceof jQuery ? inputEl : $(inputEl)).each(function() {
var $this = $(this);
$this.ColorPicker({
color: $this.val() || '#000',
onChange: function(hsb, hex) {
$this.val('#' + hex);
if (typeof callback === 'function') {
callback(hsb, hex);
}
}
});
});
};
}());

@ -139,21 +139,17 @@ define(['uploader'], function(uploader) {
}
function enableColorPicker(idx, inputEl) {
var $inputEl = $(inputEl),
var $inputEl = $(inputEl),
previewEl = $inputEl.parents('[data-cid]').find('.preview-box');
$inputEl.ColorPicker({
color: $inputEl.val() || '#000',
onChange: function(hsb, hex) {
$inputEl.val('#' + hex);
if ($inputEl.attr('data-name') === 'bgColor') {
previewEl.css('background', '#' + hex);
} else if ($inputEl.attr('data-name') === 'color') {
previewEl.css('color', '#' + hex);
}
modified($inputEl[0]);
admin.enableColorPicker($inputEl, function(hsb, hex) {
if ($inputEl.attr('data-name') === 'bgColor') {
previewEl.css('background', '#' + hex);
} else if ($inputEl.attr('data-name') === 'color') {
previewEl.css('color', '#' + hex);
}
modified($inputEl[0]);
});
}

@ -120,6 +120,8 @@ define(['forum/admin/settings'], function(Settings) {
Themes.prepareWidgets();
populateBranding();
admin.enableColorPicker($('.branding'));
Settings.prepare();
};
@ -320,19 +322,21 @@ define(['forum/admin/settings'], function(Settings) {
});
};
require(['settings'], function (settings) {
var wrapper = $('#branding');
function populateBranding() {
require(['settings'], function (settings) {
var wrapper = $('#branding');
settings.sync('branding', wrapper);
settings.sync('branding', wrapper);
$('#save-branding').click(function(event) {
settings.persist('branding', $('#branding'), function() {
socket.emit('admin.themes.updateBranding');
});
$('#save-branding').click(function(event) {
settings.persist('branding', $('#branding'), function() {
socket.emit('admin.themes.updateBranding');
});
event.preventDefault();
event.preventDefault();
});
});
});
}
return Themes;
});

@ -155,15 +155,14 @@ var fs = require('fs'),
db.setObject('config', themeData, next);
}
], callback);
Meta.restartRequired = true;
break;
case 'bootswatch':
db.setObjectField('config', 'theme:src', data.src, callback);
Meta.configs.set('theme:src', data.src, callback);
break;
}
// Restart Required flag
Meta.restartRequired = true;
}
};

Loading…
Cancel
Save