list attachments of item, see #11

This commit is contained in:
eduardohumberto 2018-05-03 21:37:26 -03:00
parent d4e550aadc
commit eb25f187cd
1 changed files with 28 additions and 5 deletions

View File

@ -5,13 +5,13 @@
:can-cancel="false"/> :can-cancel="false"/>
<div class="card"> <div class="card">
<div class="card-content"> <div class="card-content">
<router-link <router-link
class="card-footer-item" class="card-footer-item"
:to="{ path: $routerHelper.getItemEditPath(collectionId, itemId)}"> :to="{ path: $routerHelper.getItemEditPath(collectionId, itemId)}">
{{ $i18n.get('edit') + ' ' + $i18n.get('item') }} {{ $i18n.get('edit') + ' ' + $i18n.get('item') }}
</router-link> </router-link>
<div <div
class="card-image" class="card-image"
v-if="item.document"> v-if="item.document">
@ -56,7 +56,20 @@
<div <div
class="box"> class="box">
<p>--</p>
<div
v-if="attachments && attachments.length > 0">
<span
v-for="(attachment, index) in attachments"
:key="index"
>
<a
target="blank"
:href="attachment.guid.rendered">{{ attachment.guid.rendered }}</a>
</span>
</div>
<p v-else>--</p>
<p> <p>
<i> <i>
{{ $i18n.get('label_attachments') }} {{ $i18n.get('label_attachments') }}
@ -83,15 +96,20 @@ export default {
}, },
methods: { methods: {
...mapActions('item', [ ...mapActions('item', [
'fetchItem' 'fetchItem',
'fetchAttachments'
]), ]),
...mapGetters('item', [ ...mapGetters('item', [
'getItem' 'getItem',
'getAttachments'
]), ]),
}, },
computed: { computed: {
item(){ item(){
return this.getItem(); return this.getItem();
},
attachments(){
return this.getAttachments();
} }
}, },
created(){ created(){
@ -107,6 +125,11 @@ export default {
this.fetchItem(this.itemId).then(() => { this.fetchItem(this.itemId).then(() => {
loadingInstance.isLoading = false; loadingInstance.isLoading = false;
}); });
// Get attachments
this.fetchAttachments(this.itemId).then((result) => {
this.$console.log( result, 'attachments' );
});
} }
} }