$this.setValues(item, values, false);
$(document).trigger('cubist.bunchmultiple.added');
$($this).trigger('change');
- }, 500);
+ }, 10);
},
setValues(item, values) {
cb.prop('checked', v === true || v === '1' || v === 1);
} else if ($(input).is('.select2_from_array')) {
try {
- if ($(input).data('ajax')!==null && $(input).find('option[value="' + k + '"]').length === 0) {
+ if ($(input).data('ajax') !== null && $(input).find('option[value="' + k + '"]').length === 0) {
var options = $(input).data('options');
var newOption = new Option(options[v], v, false, false);
$(input).append(newOption).trigger('change');
@push('crud_fields_styles')
<link rel="stylesheet" type="text/css"
href="{{ vendor_asset('vendor/cubist/cms-back/spectrum/spectrum.css') }}">
+ <style>
+ input.spectrum {
+ opacity: 0;
+ }
+
+ .sp-replacer {
+ border-color: #ced3da;
+ border-radius: 3px;
+ padding: 6px;
+ background-color: #fff;
+ }
+
+ .sp-container {
+ border-color: rgba(0, 40, 100, .12);
+ border-radius: 3px;
+ }
+
+ .sp-replacer:hover, .sp-replacer.sp-active {
+ border-color: #2f66b3;
+ }
+ </style>
@endpush
{{-- FIELD JS - will be loaded in the after_scripts section --}}
@push('crud_fields_scripts')
<script src="{{ vendor_asset('vendor/cubist/cms-back/spectrum/spectrum.js') }}"></script>
<script>
- $("input.spectrum").spectrum({
- preferredFormat: "hex6",
- showInput: true,
- showInitial: true,
+ $(function () {
+ makeSpectrumColorPickers();
+
+ function makeSpectrumColorPickers() {
+ $("input.spectrum:not(.spectrum-ok)").each(function () {
+ if ($(this).closest('.sample').length > 0) {
+ return;
+ }
+ $(this).spectrum({
+ preferredFormat: "hex6",
+ showInput: true,
+ showInitial: true,
+ }).addClass('spectrum-ok');
+ });
+ }
+
+ $(document).on('cubist.bunchmultiple.added', function () {
+ makeSpectrumColorPickers();
+ });
});
</script>
@endpush