if (!in_array($store_in, $this->translatable)) {
$this->translatable[] = $store_in;
}
- if (!in_array($name, $this->translatable)) {
- $this->translatable[] = $name;
- }
}
if (!in_array($store_in, $this->fakeColumns)) {
{
}
+
+ public function getDecodedAttributes(){
+ $res=new \stdClass();
+ foreach ($this->attributes as $key=>$value) {
+ $res->$key=Json::decodeRecursive($this->getAttribute($key),Json::TYPE_OBJECT);
+ }
+ $res->entity=$this;
+ return $res;
+ }
+
}
this.initSort();
- this.element.on('change', 'input,select,textarea', function () {
+ this.element.on('change', 'input,select,textarea,.dropzone', function () {
$this.update();
return true;
});
initItem: function (values) {
var collapsed = true;
+ var isNew = false;
if (values === undefined) {
values = [];
collapsed = false;
+ isNew = true;
}
var item = this.element.find('.sample').clone(false);
+ if (isNew) {
+ $(item).find('[data-reset-value]').val('');
+ }
$(item).removeClass('sample');
if (collapsed) {
$(item).addClass('collapsed');
font-weight: 700;
font-size: 24px;
line-height: 1em;
- z-index:11;
+ z-index: 11;
transform: rotate(45deg);
cursor: pointer;
}
jQuery(document).ready(function () {
+ var uniqid = function () {
+ return (new Date().getTime() + Math.floor((Math.random() * 10000) + 1)).toString(16);
+ };
+
Dropzone.autoDiscover = false;
var f_{{$filesrand}} = @json($files);
function initAllDropzones() {
- $(".dropzone").each(function () {
- if ($(this).data('dropzone') === undefined) {
- $(this).attr('id', 'dz-' + Math.round(Math.random() * 10000000));
- $(this).data('dropzone', initOneDropzone(this));
+ $(".dropzone").each(function (){
+ if($(this).closest('.sample').length===0) {
+ var collectionInput = $(this).prev('input');
+ if (collectionInput.val() === '_TBD_') {
+ collectionInput.val(uniqid());
+ }
+ if ($(this).data('dropzone') === undefined) {
+ $(this).attr('id', 'dz-' + Math.round(Math.random() * 10000000));
+ $(this).data('dropzone', initOneDropzone(this));
+ }
}
});
}
var dOptions = {
url: base_url,
previewTemplate: $("#dz-template-container").html(),
+
+
init: function () {
var files = f_{{$filesrand}}[collection];
if (files === undefined) {
}
},
sending: function (file, xhr, formData) {
+ console.log(this);
formData.append('_token', $('meta[name="csrf-token"]').attr('content'));
if (collection !== undefined && collection !== null && collection !== '') {
formData.append('collection', collection);
file.previewElement.setAttribute('data-id', response.media.id);
file.previewElement.setAttribute('data-position', response.media.order_column);
}
-
+$(this.element).trigger('change');
if (file.previewElement) {
return file.previewElement.classList.add("dz-success");
}
icon: false
});
});
-
+ $(this.element).trigger('change');
return this._updateMaxFilesReachedClass();
}
if (file.previewElement != null && file.previewElement.parentNode != null) {
file.previewElement.parentNode.removeChild(file.previewElement);
}
-
+ $(this.element).trigger('change');
return this._updateMaxFilesReachedClass();
},
};