2020-11-27 23:02:59 +01:00
|
|
|
<template>
|
|
|
|
<article class="card minicard">
|
|
|
|
<header>
|
|
|
|
<h1>{{ item.title }}</h1>
|
2021-01-20 12:09:22 +01:00
|
|
|
<span class="ref">{{ item.reference }}</span>
|
2020-11-27 23:02:59 +01:00
|
|
|
</header>
|
|
|
|
<nav class="tools">
|
|
|
|
<section class="tool flags">
|
2020-12-01 20:40:37 +01:00
|
|
|
<span
|
|
|
|
class="mdi unflag"
|
|
|
|
:class="[
|
|
|
|
itemIsLoading() ? 'mdi-loading mdi-spin' : 'mdi-folder-remove'
|
|
|
|
]"
|
|
|
|
@click.prevent="onUnFlagCard"
|
|
|
|
/>
|
2020-11-27 23:02:59 +01:00
|
|
|
</section>
|
|
|
|
</nav>
|
|
|
|
<section class="images" v-switcher>
|
|
|
|
<figure
|
|
|
|
v-for="(img, index) in item.images"
|
|
|
|
:key="img.url"
|
|
|
|
>
|
|
|
|
<img
|
|
|
|
class="lazy"
|
|
|
|
v-lazy="index"
|
2020-12-23 18:05:25 +01:00
|
|
|
:data-src="img.style_minicard.url"
|
2020-11-27 23:02:59 +01:00
|
|
|
:title="img.title"
|
|
|
|
/>
|
|
|
|
<img class="blank" :src="blanksrc">
|
|
|
|
</figure>
|
|
|
|
</section>
|
|
|
|
</article>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { mapState, mapActions } from 'vuex'
|
|
|
|
import cardMixins from 'vuejs/components/cardMixins'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: "MiniCard",
|
2020-12-01 20:40:37 +01:00
|
|
|
props: ['item', 'collid'],
|
2020-11-27 23:02:59 +01:00
|
|
|
mixins: [cardMixins],
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
blanksrc:`${drupalSettings.path.themePath}/assets/img/blank.gif`,
|
2020-12-01 20:40:37 +01:00
|
|
|
loadingItem: false
|
2020-11-27 23:02:59 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
},
|
|
|
|
methods: {
|
2020-12-01 20:40:37 +01:00
|
|
|
...mapActions({
|
|
|
|
flagUnflag: 'User/flagUnflag'
|
|
|
|
}),
|
|
|
|
itemIsLoading(id) {
|
|
|
|
return this.loadingItem
|
|
|
|
},
|
|
|
|
onUnFlagCard (e) {
|
2020-12-23 18:05:25 +01:00
|
|
|
console.log("Card onFlagActionCard", e, this.item);
|
2020-12-01 20:40:37 +01:00
|
|
|
if (!this.loadingItem) {
|
|
|
|
this.loadingItem = true;
|
|
|
|
this.flagUnflag({
|
|
|
|
action: 'unflag',
|
2020-12-23 18:05:25 +01:00
|
|
|
id: this.item.id,
|
2020-12-01 20:40:37 +01:00
|
|
|
collid: this.collid
|
|
|
|
})
|
|
|
|
.then(data => {
|
|
|
|
console.log("onUnFlagCard then", data);
|
|
|
|
this.loadingItem = false;
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
2020-11-27 23:02:59 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
|
|
</style>
|