@include('crud::fields.inc.translatable_icon')
<input
type="text"
- class="spectrum"
+ class="colorpicker"
data-show-alpha="{{$field['allows_alpha']?'true':'false'}}"
data-allow-empty="{{$field['allows_empty']?'true':'false'}}"
name="{{ $field['name'] }}"
makeSpectrumColorPickers();
function makeSpectrumColorPickers() {
- $("input.spectrum:not(.spectrum-ok)").each(function () {
+ $("input.colorpicker:not(.spectrum-ok)").each(function () {
if ($(this).closest('.sample').length > 0) {
return;
}
- $(this).spectrum({
+ var e=$(this);
+ var options={
preferredFormat: "hex3",
- showInput: true,
showInitial: true,
+ showInput: true,
+ allowEmpty: true,
showAlpha: $(this).attr('data-show-alpha') === 'true',
- }).addClass('spectrum-ok');
+ move:function(color){
+ e.val(color.toString());
+ e.trigger('change');
+ },
+ dragend:function(color){
+ e.val(color.toString());
+ e.trigger('change');
+ }
+ };
+ $(this).spectrum(options).addClass('spectrum-ok');
});
}