diff --git a/.eslintrc.js b/.eslintrc.js index c060c6965..fb06c26fd 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -25,7 +25,7 @@ module.exports = { 'vue/no-confusing-v-for-v-if': 'off', 'vue/no-use-v-if-with-v-for': 'off', 'vue/multi-word-component-names': 'off', - 'vue/require-default-prop': 'off' // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/require-default-prop.md + 'vue/require-default-prop': 'off' }, globals: { 'tainacan_plugin': true, diff --git a/src/views/admin/components/edition/filter-edition-form.vue b/src/views/admin/components/edition/filter-edition-form.vue index 3f4769c7b..206b99186 100644 --- a/src/views/admin/components/edition/filter-edition-form.vue +++ b/src/views/admin/components/edition/filter-edition-form.vue @@ -162,8 +162,9 @@ size="is-small" @input="clearErrors('begin_with_filter_collapsed')" v-model="form.begin_with_filter_collapsed" - true-value="yes" - false-value="no" + :true-value="'yes'" + :false-value="'no'" + :native-value="form.begin_with_filter_collapsed == 'yes' ? 'yes' : 'no'" name="begin_with_filter_collapsed"> { this.form = {}; this.formErrors = {}; @@ -299,17 +306,19 @@ export default { let formElement = document.getElementById('filterEditForm'); let formData = new FormData(formElement); let formObj = {}; - + for (let [key, value] of formData.entries()) { if (key === 'begin_with_filter_collapsed') - formObj[key] = value ? 'yes' : 'no'; + formObj[key] = (value == 'yes' || value == true) ? 'yes' : 'no'; else formObj[key] = value; } - + if (formObj['begin_with_filter_collapsed'] === undefined) + formObj['begin_with_filter_collapsed'] = 'no'; + this.fillExtraFormData(formObj); this.isLoading = true; - this.updateFilter({ filterId: filter.id, index: this.index, options: formObj}) + this.updateFilter({ filterId: filter.id, index: this.index, options: formObj }) .then(() => { this.form = {}; this.formErrors = {}; diff --git a/src/views/admin/components/edition/item-edition-form.vue b/src/views/admin/components/edition/item-edition-form.vue index e69a7655d..b028fa340 100644 --- a/src/views/admin/components/edition/item-edition-form.vue +++ b/src/views/admin/components/edition/item-edition-form.vue @@ -382,7 +382,7 @@ :item="item" :is-editable="true" :is-loading="isLoadingAttachments" - @isLoadingAttachments="(isLoading) => isLoadingAttachments = isLoading" + @isLoadingAttachments="(isLoadingState) => isLoadingAttachments = isLoadingState" @onDeleteAttachment="deleteAttachment($event)"/> diff --git a/src/views/admin/components/filter-types/checkbox/Checkbox.vue b/src/views/admin/components/filter-types/checkbox/Checkbox.vue index a4f64148f..57097b9a3 100644 --- a/src/views/admin/components/filter-types/checkbox/Checkbox.vue +++ b/src/views/admin/components/filter-types/checkbox/Checkbox.vue @@ -186,6 +186,13 @@ events: { appliedCheckBoxModal: () => { this.loadOptions(); + }, + input: (newSelected) => { + const existingValue = this.selected.indexOf(newSelected); + if (existingValue >= 0) + this.selected.splice(existingValue, 1); + else + this.selected.push(newSelected); } }, trapFocus: true, diff --git a/src/views/admin/components/filter-types/taxonomy/Checkbox.vue b/src/views/admin/components/filter-types/taxonomy/Checkbox.vue index 8fe344ac3..5bfee3561 100644 --- a/src/views/admin/components/filter-types/taxonomy/Checkbox.vue +++ b/src/views/admin/components/filter-types/taxonomy/Checkbox.vue @@ -254,6 +254,13 @@ events: { appliedCheckBoxModal: () => { this.loadOptions(); + }, + input: (newSelected) => { + const existingValue = this.selected.indexOf(newSelected); + if (existingValue >= 0) + this.selected.splice(existingValue, 1); + else + this.selected.push(newSelected); } }, width: 'calc(100% - (4 * var(--tainacan-one-column)))', diff --git a/src/views/admin/components/lists/items-list.vue b/src/views/admin/components/lists/items-list.vue index 025378519..06897e16f 100644 --- a/src/views/admin/components/lists/items-list.vue +++ b/src/views/admin/components/lists/items-list.vue @@ -1557,7 +1557,7 @@ export default { title: this.$i18n.get('label_warning'), message: this.$i18n.get('info_warning_remove_item_from_trash'), onConfirm: () => { - this.$emit('updateIsLoading', this.isLoading); + this.$emit('updateIsLoading', true); this.createEditGroup({ collectionId: this.collectionId, @@ -1588,7 +1588,7 @@ export default { title: this.$i18n.get('label_warning'), message: this.isOnTrash ? this.$i18n.get('info_warning_item_delete') : this.$i18n.get('info_warning_item_trash'), onConfirm: () => { - this.$emit('updateIsLoading', this.isLoading); + this.$emit('updateIsLoading', true); this.deleteItem({ itemId: itemId, @@ -1613,7 +1613,7 @@ export default { title: this.$i18n.get('label_warning'), message: this.$i18n.get('info_warning_selected_items_remove_from_trash'), onConfirm: () => { - this.$emit('updateIsLoading', this.isLoading); + this.$emit('updateIsLoading', true); this.createEditGroup({ collectionId: this.collectionId, @@ -1645,7 +1645,7 @@ export default { title: this.$i18n.get('label_warning'), message: this.isOnTrash ? this.$i18n.get('info_warning_selected_items_delete') : this.$i18n.get('info_warning_selected_items_trash'), onConfirm: () => { - this.$emit('updateIsLoading', this.isLoading); + this.$emit('updateIsLoading', true); this.createEditGroup({ collectionId: this.collectionId, diff --git a/src/views/admin/components/metadata-types/compound/Compound.vue b/src/views/admin/components/metadata-types/compound/Compound.vue index fb9aae4e0..dc797859f 100644 --- a/src/views/admin/components/metadata-types/compound/Compound.vue +++ b/src/views/admin/components/metadata-types/compound/Compound.vue @@ -175,12 +175,12 @@ } }, created() { - eventBusItemMetadata.$on('hasRemovedItemMetadataGroup', () => { this.$nextTick(() => this.isRemovingGroup = false) }); + eventBusItemMetadata.$on('hasRemovedItemMetadataGroup', this.laterUpdateIsRemovingGroup); eventBusItemMetadata.$on('focusPreviousChildMetadatum', this.focusPreviousChildMetadatum); eventBusItemMetadata.$on('focusNextChildMetadatum', this.focusNextChildMetadatum); }, beforeDestroy() { - eventBusItemMetadata.$off('hasRemovedItemMetadataGroup', () => { this.$nextTick(() => this.isRemovingGroup = false) }); + eventBusItemMetadata.$off('hasRemovedItemMetadataGroup', this.laterUpdateIsRemovingGroup); eventBusItemMetadata.$off('focusPreviousChildMetadatum', this.focusPreviousChildMetadatum); eventBusItemMetadata.$off('focusNextChildMetadatum', this.focusNextChildMetadatum); }, @@ -436,6 +436,11 @@ }, 100); } } + }, + laterUpdateIsRemovingGroup() { + this.$nextTick(() => { + this.isRemovingGroup = false; + }); } } } diff --git a/src/views/admin/components/other/checkbox-radio-filter-input.vue b/src/views/admin/components/other/checkbox-radio-filter-input.vue index 8148fcd3e..743a4e506 100644 --- a/src/views/admin/components/other/checkbox-radio-filter-input.vue +++ b/src/views/admin/components/other/checkbox-radio-filter-input.vue @@ -251,7 +251,7 @@ - + diff --git a/src/views/admin/components/other/checkbox-radio-metadata-input.vue b/src/views/admin/components/other/checkbox-radio-metadata-input.vue index 13158300c..65b6e8304 100644 --- a/src/views/admin/components/other/checkbox-radio-metadata-input.vue +++ b/src/views/admin/components/other/checkbox-radio-metadata-input.vue @@ -67,29 +67,24 @@ v-for="(option, key) in searchResults" :key="key"> - - - +