From 0ef39e2c357e300b827f01594cddce589d2f94ad Mon Sep 17 00:00:00 2001 From: mateuswetah Date: Fri, 7 Jul 2023 19:58:26 -0300 Subject: [PATCH] First patch of refactor to avoid v-if and v-for in the same tag. #794 --- .eslintrc.js | 2 +- .../edition/collection-edition-form.vue | 8 +- .../edition/importer-edition-form.vue | 5 +- .../edition/importer-mapping-form.vue | 27 +- .../filter-types/checkbox/Checkbox.vue | 67 +-- .../filter-types/taxonomy/Checkbox.vue | 75 ++- .../lists/collections-home-list.vue | 1 - .../admin/components/lists/items-list.vue | 536 +++++++++--------- 8 files changed, 373 insertions(+), 348 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 202a3f642..436951c26 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -23,7 +23,7 @@ module.exports = { 'vue/multiline-html-element-content-newline': 'off', 'vue/prop-name-casing': 'off', 'vue/no-confusing-v-for-v-if': 'off', - 'vue/no-use-v-if-with-v-for': 'off', + 'vue/no-use-v-if-with-v-for': 'warn', 'vue/multi-word-component-names': 'off', 'vue/require-default-prop': 'off', 'vue/no-v-text-v-html-on-component': 'off' diff --git a/src/views/admin/components/edition/collection-edition-form.vue b/src/views/admin/components/edition/collection-edition-form.vue index 00ba85781..833b0ae40 100644 --- a/src/views/admin/components/edition/collection-edition-form.vue +++ b/src/views/admin/components/edition/collection-edition-form.vue @@ -196,8 +196,7 @@ v-model="form.default_view_mode" @focus="clearErrors('default_view_mode')"> @@ -437,7 +436,9 @@ export default { this.fetchAllCollectionNames() .then((resp) => { resp.request.then((collections) => { - this.collections = collections; + this.collections = Array.isArray(collections)? collections.filter((collection) => { + return collection.current_user_can_edit_items; + }) : []; this.isFetchingCollections = false; }) .catch((error) => { diff --git a/src/views/admin/components/edition/importer-mapping-form.vue b/src/views/admin/components/edition/importer-mapping-form.vue index e90efc2d9..dcdd88bc5 100644 --- a/src/views/admin/components/edition/importer-mapping-form.vue +++ b/src/views/admin/components/edition/importer-mapping-form.vue @@ -109,10 +109,9 @@ {{ $i18n.get('label_create_repository_metadata') }}