Fixes View Collection button not always getting proper url.

This commit is contained in:
Mateus Machado Luna 2018-08-02 11:15:12 -03:00
parent 06df10b8c1
commit fb63dc9c27
2 changed files with 92 additions and 92 deletions

View File

@ -13,94 +13,94 @@
</button> </button>
</div> </div>
<div class="level"> <div class="level">
<div class="level-left"> <div class="level-left">
<div class="level-item"> <div class="level-item">
<nav class="breadcrumbs"> <nav class="breadcrumbs">
<router-link
tag="a"
:to="$routerHelper.getCollectionsPath()">{{ $i18n.get('repository') }}</router-link> >
<span
v-for="(pathItem, index) in arrayRealPath"
:key="index">
<router-link
v-if="index < arrayRealPath.length - 1"
tag="a"
:to="'/' + arrayRealPath.slice(0, index + 1).join('/')">
{{ arrayViewPath[index] }}
</router-link>
<span v-if="index == arrayRealPath.length - 1">{{ arrayViewPath[index] }}</span>
<span v-if="index != arrayRealPath.length - 1 && arrayViewPath[index]"> > </span>
</span>
</nav>
</div>
</div>
<ul class="menu-list level-right">
<li
:class="activeRoute == 'ItemPage' || activeRoute == 'CollectionItemsPage' || activeRoute == 'ItemEditionForm' || activeRoute == 'ItemCreatePage' ? 'is-active':''"
class="level-item">
<router-link
tag="a"
:to="{ path: $routerHelper.getCollectionItemsPath(id, '') }"
:aria-label="$i18n.get('label_collection_items')">
<span class="icon">
<i class="mdi mdi-file-multiple"/>
</span>
<span class="menu-text">{{ $i18n.get('items') }}</span>
</router-link>
</li>
<li
:class="activeRoute == 'CollectionEditionForm' ? 'is-active':''"
class="level-item">
<router-link
tag="a"
:to="{ path: $routerHelper.getCollectionEditPath(id) }"
:aria-label="$i18n.get('label_settings')">
<span class="icon">
<i class="mdi mdi-settings"/>
</span>
<span class="menu-text">{{ $i18n.get('label_settings') }}</span>
</router-link>
</li>
<li
:class="activeRoute == 'MetadataList' ? 'is-active':''"
class="level-item">
<router-link <router-link
tag="a" tag="a"
:to="$routerHelper.getCollectionsPath()">{{ $i18n.get('repository') }}</router-link> > :to="{ path: $routerHelper.getCollectionMetadataPath(id) }"
<span :aria-label="$i18n.get('label_collection_metadata')">
v-for="(pathItem, index) in arrayRealPath" <span class="icon">
:key="index"> <i class="mdi mdi-format-list-bulleted-type"/>
<router-link </span>
v-if="index < arrayRealPath.length - 1" <span class="menu-text">{{ $i18n.getFrom('metadata', 'name') }}</span>
tag="a" </router-link>
:to="'/' + arrayRealPath.slice(0, index + 1).join('/')"> </li>
{{ arrayViewPath[index] }} <li
</router-link> :class="activeRoute == 'FiltersList' ? 'is-active':''"
<span v-if="index == arrayRealPath.length - 1">{{ arrayViewPath[index] }}</span> class="level-item">
<span v-if="index != arrayRealPath.length - 1 && arrayViewPath[index]"> > </span> <router-link
</span> tag="a"
</nav> :to="{ path: $routerHelper.getCollectionFiltersPath(id) }"
</div> :aria-label="$i18n.get('label_collection_filters')">
</div> <span class="icon">
<i class="mdi mdi-filter"/>
<ul class="menu-list level-right"> </span>
<li <span class="menu-text">{{ $i18n.getFrom('filters', 'name') }}</span>
:class="activeRoute == 'ItemPage' || activeRoute == 'CollectionItemsPage' || activeRoute == 'ItemEditionForm' || activeRoute == 'ItemCreatePage' ? 'is-active':''" </router-link>
class="level-item"> </li>
<router-link <li
tag="a" :class="activeRoute == 'CollectionEventsPage' ? 'is-active':''"
:to="{ path: $routerHelper.getCollectionItemsPath(id, '') }" class="level-item">
:aria-label="$i18n.get('label_collection_items')"> <router-link
<span class="icon"> tag="a"
<i class="mdi mdi-file-multiple"/> :to="{ path: $routerHelper.getCollectionEventsPath(id) }"
</span> :aria-label="$i18n.get('label_collection_events')">
<span class="menu-text">{{ $i18n.get('items') }}</span> <activities-icon />
</router-link> <span class="menu-text">{{ $i18n.get('events') }}</span>
</li> </router-link>
<li </li>
:class="activeRoute == 'CollectionEditionForm' ? 'is-active':''"
class="level-item"> </ul>
<router-link
tag="a"
:to="{ path: $routerHelper.getCollectionEditPath(id) }"
:aria-label="$i18n.get('label_settings')">
<span class="icon">
<i class="mdi mdi-settings"/>
</span>
<span class="menu-text">{{ $i18n.get('label_settings') }}</span>
</router-link>
</li>
<li
:class="activeRoute == 'MetadataList' ? 'is-active':''"
class="level-item">
<router-link
tag="a"
:to="{ path: $routerHelper.getCollectionMetadataPath(id) }"
:aria-label="$i18n.get('label_collection_metadata')">
<span class="icon">
<i class="mdi mdi-format-list-bulleted-type"/>
</span>
<span class="menu-text">{{ $i18n.getFrom('metadata', 'name') }}</span>
</router-link>
</li>
<li
:class="activeRoute == 'FiltersList' ? 'is-active':''"
class="level-item">
<router-link
tag="a"
:to="{ path: $routerHelper.getCollectionFiltersPath(id) }"
:aria-label="$i18n.get('label_collection_filters')">
<span class="icon">
<i class="mdi mdi-filter"/>
</span>
<span class="menu-text">{{ $i18n.getFrom('filters', 'name') }}</span>
</router-link>
</li>
<li
:class="activeRoute == 'CollectionEventsPage' ? 'is-active':''"
class="level-item">
<router-link
tag="a"
:to="{ path: $routerHelper.getCollectionEventsPath(id) }"
:aria-label="$i18n.get('label_collection_events')">
<activities-icon />
<span class="menu-text">{{ $i18n.get('events') }}</span>
</router-link>
</li>
</ul>
</div> </div>
</div> </div>
</template> </template>
@ -141,7 +141,7 @@ export default {
}, },
methods: { methods: {
...mapActions('collection', [ ...mapActions('collection', [
'fetchCollectionName' 'fetchCollectionNameAndURL'
]), ]),
...mapGetters('collection', [ ...mapGetters('collection', [
'getCollectionName', 'getCollectionName',
@ -172,8 +172,8 @@ export default {
switch(this.arrayRealPath[i-1]) { switch(this.arrayRealPath[i-1]) {
case 'collections': case 'collections':
this.fetchCollectionName(this.arrayRealPath[i]) this.fetchCollectionNameAndURL(this.arrayRealPath[i])
.then(collectionName => this.arrayViewPath.splice(i, 1, collectionName)) .then(collection => this.arrayViewPath.splice(i, 1, collection.name))
.catch((error) => this.$console.error(error)); .catch((error) => this.$console.error(error));
break; break;

View File

@ -46,7 +46,7 @@ export default {
}, },
methods: { methods: {
...mapActions('collection', [ ...mapActions('collection', [
'fetchCollectionName' 'fetchCollectionNameAndURL'
]), ]),
...mapGetters('collection', [ ...mapGetters('collection', [
'getCollectionName' 'getCollectionName'
@ -79,8 +79,8 @@ export default {
switch(this.arrayRealPath[i-1]) { switch(this.arrayRealPath[i-1]) {
case 'collections': case 'collections':
this.fetchCollectionName(this.arrayRealPath[i]) this.fetchCollectionNameAndURL(this.arrayRealPath[i])
.then(collectionName => { this.arrayViewPath.splice(i, 1, collectionName); this.entityName = collectionName; }) .then(collection => { this.arrayViewPath.splice(i, 1, collection.name); this.entityName = collection.name; })
.catch((error) => this.$console.error(error)); .catch((error) => this.$console.error(error));
break; break;
case 'items': case 'items':