Unverified Commit 6c771cf5 authored by Nicolas Widart's avatar Nicolas Widart Committed by GitHub

Merge pull request #644 from mikemand/feature/media-deeply-nested-objects

Allow deeply nested objects to have media
parents 9c5b5d71 773f160a
......@@ -10,5 +10,6 @@ yarn-error.log
.env
composer.lock
package-lock.json
yarn.lock
.phpunit.result.cache
.php_cs.cache
import t from 'typy';
export default {
methods: {
selectMultipleFile(event, model) {
if (typeof this[model].medias_multi === 'undefined') {
this.$set(model, 'medias_multi', {});
const entity = t(this, model).safeObject;
if (typeof entity.medias_multi === 'undefined') {
this.$set(entity, 'medias_multi', {});
}
if (typeof this[model].medias_multi[event.zone] === 'undefined') {
this.$set(this[model].medias_multi, event.zone, { files: [], orders: '' });
if (typeof entity.medias_multi[event.zone] === 'undefined') {
this.$set(entity.medias_multi, event.zone, { files: [], orders: '' });
}
if (event.id !== null && event.id !== undefined) {
const medias = new Set(this[model].medias_multi[event.zone].files);
const medias = new Set(entity.medias_multi[event.zone].files);
medias.add(event.id);
this.$set(this[model].medias_multi[event.zone], 'files', [...medias]);
this.$set(entity.medias_multi[event.zone], 'files', [...medias]);
}
},
unselectFile(event, model) {
const entity = t(this, model).safeObject;
if (event.id !== null && event.id !== undefined) {
const medias = new Set(this[model].medias_multi[event.zone].files);
const medias = new Set(entity.medias_multi[event.zone].files);
medias.delete(event.id);
this.$set(this[model].medias_multi[event.zone], 'files', [...medias]);
this.$set(entity.medias_multi[event.zone], 'files', [...medias]);
}
if (this[model].medias_multi[event.zone].files.length === 0) {
this.$delete(this[model].medias_multi, event.zone);
if (entity.medias_multi[event.zone].files.length === 0) {
this.$delete(entity.medias_multi, event.zone);
}
},
},
......
import t from 'typy';
export default {
methods: {
selectSingleFile(event, model) {
if (typeof this[model].medias_single === 'undefined') {
this.$set(this[model], 'medias_single', {});
const entity = t(this, model).safeObject;
if (typeof entity.medias_single === 'undefined') {
this.$set(entity, 'medias_single', {});
}
if (typeof this[model].medias_single[event.zone] === 'undefined') {
this.$set(this[model].medias_single, event.zone, null);
if (typeof entity.medias_single[event.zone] === 'undefined') {
this.$set(entity.medias_single, event.zone, null);
}
if (event.id !== null && event.id !== undefined) {
this.$set(this[model].medias_single, event.zone, event.id);
this.$set(entity.medias_single, event.zone, event.id);
} else {
this.$delete(this[model].medias_single, event.zone);
this.$delete(entity.medias_single, event.zone);
}
},
},
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"/js/app.js": "/js/app.js",
"/css/app.css": "/css/app.css"
}
\ No newline at end of file
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment