Prevents breaking form hooks when theme is not updated. Bulk edition second select now automatically selects when only one option is available.
This commit is contained in:
parent
94144763ed
commit
f6ad2f3275
|
@ -25,11 +25,13 @@
|
||||||
<template
|
<template
|
||||||
v-for="(metadatum, index) in metadata">
|
v-for="(metadatum, index) in metadata">
|
||||||
<option
|
<option
|
||||||
|
:key="index"
|
||||||
v-if="metadatum.id"
|
v-if="metadatum.id"
|
||||||
:value="metadatum.id">
|
:value="metadatum.id">
|
||||||
{{ metadatum.name }}
|
{{ metadatum.name }}
|
||||||
</option>
|
</option>
|
||||||
<option
|
<option
|
||||||
|
:key="index"
|
||||||
v-if="index === Object.keys(metadata).length-1"
|
v-if="index === Object.keys(metadata).length-1"
|
||||||
value="status">
|
value="status">
|
||||||
{{ $i18n.get('label_status') }}
|
{{ $i18n.get('label_status') }}
|
||||||
|
@ -42,6 +44,7 @@
|
||||||
v-if="bulkEditionProcedures[criterion] &&
|
v-if="bulkEditionProcedures[criterion] &&
|
||||||
bulkEditionProcedures[criterion].metadatumID"
|
bulkEditionProcedures[criterion].metadatumID"
|
||||||
:disabled="!!bulkEditionProcedures[criterion].action"
|
:disabled="!!bulkEditionProcedures[criterion].action"
|
||||||
|
:value="bulkEditionProcedures[criterion].action ? bulkEditionProcedures[criterion].action : undefined"
|
||||||
class="tainacan-bulk-edition-field tainacan-bulk-edition-field-not-last"
|
class="tainacan-bulk-edition-field tainacan-bulk-edition-field-not-last"
|
||||||
:placeholder="$i18n.get('instruction_select_a_action')"
|
:placeholder="$i18n.get('instruction_select_a_action')"
|
||||||
@input="addToBulkEditionProcedures($event, 'action', criterion)">
|
@input="addToBulkEditionProcedures($event, 'action', criterion)">
|
||||||
|
@ -57,7 +60,6 @@
|
||||||
<option
|
<option
|
||||||
v-for="(edtAct, key) in editionActionsForNotMultiple"
|
v-for="(edtAct, key) in editionActionsForNotMultiple"
|
||||||
:value="edtAct"
|
:value="edtAct"
|
||||||
:selected="Object.keys(editionActionsForNotMultiple).length === 1"
|
|
||||||
:key="key">
|
:key="key">
|
||||||
{{ edtAct }}
|
{{ edtAct }}
|
||||||
</option>
|
</option>
|
||||||
|
@ -533,11 +535,19 @@
|
||||||
return found ? found : {};
|
return found ? found : {};
|
||||||
},
|
},
|
||||||
addToBulkEditionProcedures(value, key, criterion){
|
addToBulkEditionProcedures(value, key, criterion){
|
||||||
|
|
||||||
if(Array.isArray(value)){
|
if(Array.isArray(value)){
|
||||||
value = value[0];
|
value = value[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$set(this.bulkEditionProcedures[criterion], `${key}`, value);
|
this.$set(this.bulkEditionProcedures[criterion], `${key}`, value);
|
||||||
|
|
||||||
|
if (key == 'metadatumID') {
|
||||||
|
if (this.getMetadataByID(this.bulkEditionProcedures[criterion].metadatumID).multiple != 'yes') {
|
||||||
|
let value = Object.values(this.editionActionsForNotMultiple)[0];
|
||||||
|
this.addToBulkEditionProcedures(value, 'action', criterion);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ export const formHooks = {
|
||||||
];
|
];
|
||||||
// Gets data from existing extra form hooks
|
// Gets data from existing extra form hooks
|
||||||
for (let position of positions) {
|
for (let position of positions) {
|
||||||
if (this.formHooks[entity][position] && this.formHooks[entity][position] != undefined) {
|
if (this.formHooks[entity] && this.formHooks[entity][position] && this.formHooks[entity][position] != undefined) {
|
||||||
let formElement = document.getElementById('form-' + entity + '-' + position);
|
let formElement = document.getElementById('form-' + entity + '-' + position);
|
||||||
if (formElement) {
|
if (formElement) {
|
||||||
for (let element of formElement.elements) {
|
for (let element of formElement.elements) {
|
||||||
|
@ -95,7 +95,7 @@ export const formHooks = {
|
||||||
];
|
];
|
||||||
// Gets data from existing extra form hooks
|
// Gets data from existing extra form hooks
|
||||||
for (let position of positions) {
|
for (let position of positions) {
|
||||||
if (this.formHooks[entity][position] && this.formHooks[entity][position] != undefined) {
|
if (this.formHooks[entity] && this.formHooks[entity][position] && this.formHooks[entity][position] != undefined) {
|
||||||
let formElement = document.getElementById('form-' + entity + '-' + position);
|
let formElement = document.getElementById('form-' + entity + '-' + position);
|
||||||
|
|
||||||
if (formElement) {
|
if (formElement) {
|
||||||
|
|
|
@ -110,9 +110,8 @@ export const ThemeItemsListing = new Vue({
|
||||||
},
|
},
|
||||||
render: h => h(ThemeItemsList),
|
render: h => h(ThemeItemsList),
|
||||||
beforeMount () {
|
beforeMount () {
|
||||||
console.log("oie")
|
if (this.$el.attributes['collection-id'] != undefined)
|
||||||
//if (this.$el.attributes['collection-id'] != undefined)
|
this.collectionId = this.$el.attributes['collection-id'].value;
|
||||||
this.collectionId = this.$el.attributes['collection-id'].value;
|
|
||||||
if (this.$el.attributes['default-view-mode'] != undefined)
|
if (this.$el.attributes['default-view-mode'] != undefined)
|
||||||
this.defaultViewMode = this.$el.attributes['default-view-mode'].value;
|
this.defaultViewMode = this.$el.attributes['default-view-mode'].value;
|
||||||
if (this.$el.attributes['enabled-view-modes'] != undefined)
|
if (this.$el.attributes['enabled-view-modes'] != undefined)
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
export default {
|
export default {
|
||||||
name: "ThemeItemsList",
|
name: "ThemeItemsList",
|
||||||
created() {
|
created() {
|
||||||
console.log("oi")
|
|
||||||
this.$userPrefs.init();
|
this.$userPrefs.init();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue