2021-01-20 12:09:22 +01:00
|
|
|
<template>
|
|
|
|
<article class="card linkedmaterialcard">
|
|
|
|
<header
|
|
|
|
@click.prevent="openModalCard"
|
|
|
|
>
|
|
|
|
<h1>{{ item.title }}</h1>
|
|
|
|
<h4>{{ item.short_description }}</h4>
|
|
|
|
<span v-if="isloggedin" class="ref">{{ item.reference }}</span>
|
|
|
|
</header>
|
|
|
|
<nav class="tools">
|
|
|
|
|
|
|
|
</nav>
|
|
|
|
<section class="images" v-switcher>
|
|
|
|
<figure
|
|
|
|
v-for="(img, index) in item.images"
|
|
|
|
:key="img.url"
|
2021-08-04 18:26:50 +02:00
|
|
|
class="lazy"
|
|
|
|
v-lazy="index"
|
2021-01-20 12:09:22 +01:00
|
|
|
>
|
|
|
|
<img
|
|
|
|
:data-src="img.style_linkedmaterialcard.url"
|
|
|
|
:title="img.title"
|
|
|
|
/>
|
|
|
|
<img
|
|
|
|
class="blank"
|
|
|
|
:src="blanksrc"
|
|
|
|
@click.prevent="openModalCard"
|
|
|
|
/>
|
|
|
|
</figure>
|
|
|
|
</section>
|
|
|
|
</article>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { mapState, mapActions } from 'vuex'
|
|
|
|
import cardMixins from 'vuejs/components/cardMixins'
|
2022-03-08 14:28:37 +01:00
|
|
|
// import ModalCard from 'vuejs/components/Content/ModalCard'
|
|
|
|
const ModalCard = () => import(
|
|
|
|
/* webpackChunkName: "module-base" */
|
|
|
|
/* webpackMode: "lazy" */
|
|
|
|
/* webpackPrefetch: true */
|
|
|
|
/* webpackPreload: true */
|
|
|
|
'vuejs/components/Content/ModalCard')
|
2021-01-20 12:09:22 +01:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: "LinkedMaterialCard",
|
|
|
|
props: ['item'],
|
|
|
|
mixins: [cardMixins],
|
|
|
|
// components: {
|
|
|
|
// ModalCard
|
|
|
|
// },
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
blanksrc:`${drupalSettings.path.themePath}/assets/img/blank.gif`,
|
|
|
|
loadingItem: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
...mapState({
|
|
|
|
isloggedin: state => state.User.isloggedin
|
|
|
|
})
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
itemIsLoading(id) {
|
|
|
|
return this.loadingItem
|
|
|
|
},
|
|
|
|
openModalCard (e) {
|
2021-03-31 18:42:05 +02:00
|
|
|
console.log('openModalCard', this.isLoggedin)
|
|
|
|
if (this.isloggedin) {
|
2021-01-20 12:09:22 +01:00
|
|
|
this.$modal.show(
|
|
|
|
ModalCard,
|
2021-08-04 18:26:50 +02:00
|
|
|
{
|
|
|
|
item: this.item,
|
|
|
|
// not really an event
|
|
|
|
// more a callback function passed as prop to the component
|
|
|
|
addNoteId:(id) => {
|
|
|
|
// no needs to refresh the entire item via searchresults
|
|
|
|
// plus if we are in article, there is not searchresults
|
|
|
|
// this.refreshItem({id: this.item.id})
|
|
|
|
// instead create the note id directly
|
|
|
|
this.item.note = {id: id}
|
|
|
|
}
|
|
|
|
},
|
2021-01-20 12:09:22 +01:00
|
|
|
{
|
2021-01-20 12:42:21 +01:00
|
|
|
name: `modal-${this.item.id}`,
|
|
|
|
draggable: false,
|
2021-08-04 18:26:50 +02:00
|
|
|
classes: "vm--modale-card",
|
|
|
|
// this does not work
|
|
|
|
// adaptative: true,
|
|
|
|
// maxWidth: 850,
|
|
|
|
// maxHeight: 610,
|
2021-03-30 15:42:40 +02:00
|
|
|
width: '95%',
|
|
|
|
height: '95%'
|
2021-01-20 12:09:22 +01:00
|
|
|
}
|
|
|
|
)
|
2021-08-04 18:26:50 +02:00
|
|
|
} else {
|
|
|
|
this.$modal.show(
|
|
|
|
MemberWarning,
|
|
|
|
{},
|
|
|
|
{
|
|
|
|
// name: `modal-${this.item.id}`,
|
|
|
|
draggable: false,
|
|
|
|
// classes: "vm--modale-card",
|
|
|
|
// this does not work
|
|
|
|
// adaptative: true,
|
|
|
|
// maxWidth: 850,
|
|
|
|
// maxHeight: 610,
|
|
|
|
width: '400px',
|
|
|
|
height: '250px'
|
|
|
|
}
|
|
|
|
)
|
2021-01-20 12:09:22 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
|
|
</style>
|