From 2868eff56ad6b315eac0900182c7a91c40c1a8ff Mon Sep 17 00:00:00 2001 From: Mateus Machado Luna Date: Wed, 17 Oct 2018 10:34:29 -0300 Subject: [PATCH] Removes item from collection breadcrumb to avoid clicking on link that doesn't redirects to any route. --- .../navigation/tainacan-collection-subheader.vue | 7 ++++++- src/js/event-bus-search.js | 1 - 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/admin/components/navigation/tainacan-collection-subheader.vue b/src/admin/components/navigation/tainacan-collection-subheader.vue index 0a621c77f..208e72ba0 100644 --- a/src/admin/components/navigation/tainacan-collection-subheader.vue +++ b/src/admin/components/navigation/tainacan-collection-subheader.vue @@ -205,7 +205,7 @@ export default { switch(this.arrayRealPath[i-1]) { case 'collections': this.fetchCollectionNameAndURL(this.arrayRealPath[i]) - .then(collection => this.arrayViewPath.splice(i, 1, collection.name)) + .then(collection => { this.arrayViewPath.splice(i, 1, collection.name); }) .catch((error) => this.$console.error(error)); break; @@ -240,6 +240,11 @@ export default { } } + + let itemsIndex = this.arrayViewPath.findIndex(viewItem => viewItem == this.$i18n.get('items')); + if (itemsIndex >= 0 && itemsIndex == this.arrayRealPath.length - 1) { + this.arrayViewPath.splice(itemsIndex, 1); + } } }, created() { diff --git a/src/js/event-bus-search.js b/src/js/event-bus-search.js index 73059a755..d15823f8b 100644 --- a/src/js/event-bus-search.js +++ b/src/js/event-bus-search.js @@ -316,7 +316,6 @@ export default { 'termId': this.termId, 'taxonomy': this.taxonomy }).then((resp) => { - // The actual fetch item request resp.request.then((res) => { this.$emit( 'isLoadingItems', false);