Update logic for a-color-picker
@@ -7,12 +7,16 @@ django.jQuery(function($) {
var $colorInput = $(checkboxInput).siblings('input[type="color"]');
if (checkboxInput.checked || checkboxInput.disabled) {
$rgbaInput.addClass('disabled');
+ if (!AColorPicker) {
$colorInput.addClass('disabled');
+ }
} else {
$rgbaInput.removeClass('disabled');
+ if (!AColorPicker) {
$colorInput.removeClass('disabled');
}
}
+ }
if (AColorPicker) {
$('.cascade-colorpicker > input.cascade-rgba').on('click', function(evt) {
@@ -21,12 +25,12 @@ django.jQuery(function($) {
var options = {color: $this.val(), showAlpha: $this.data('with_alpha')};
if (picker) {
picker.destroy();
- picker = null;
}
if ($this.hasClass('disabled')) {
$this.blur();
} else {
picker = AColorPicker.createPicker($this.parent(), options);
+ $('input[type="number"]').css("cssText", "padding: 2px 0 !important;");
picker.on('change', function(picker, color) {
$colorInput.val(AColorPicker.parseColor(color, 'hex'));
$this.val(color);
@@ -34,6 +38,9 @@ django.jQuery(function($) {
}
evt.preventDefault();
});
+ $('.cascade-colorpicker > input[type="color"]').on('click', function(evt) {
+ evt.preventDefault();
+ });
} else {
$('.cascade-colorpicker > input.cascade-rgba').on('focus', function(evt) {
var $this = $(this);
