123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- <template>
- <article class="card minicard">
- <header
- @click.prevent="openModalCard"
- >
- <h1>{{ item.title }}</h1>
- <span v-if="item.reference" class="ref">{{ item.reference }}</span>
- </header>
- <nav class="tools">
- <section class="tool flags">
- <span
- class="mdi unflag"
- :class="[
- itemIsLoading() ? 'mdi-loading mdi-spin' : 'mdi-folder-remove'
- ]"
- @click.prevent="onUnFlagCard"
- />
- </section>
- </nav>
- <section class="images" v-switcher>
- <figure
- v-for="(img, index) in item.images"
- :key="img.url"
- >
- <img
- class="lazy"
- v-lazy="index"
- :data-src="img.style_minicard.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'
- import ModalCard from 'vuejs/components/Content/ModalCard'
- export default {
- name: "MiniCard",
- props: ['item', 'collid'],
- mixins: [cardMixins],
- components: {
- ModalCard
- },
- data() {
- return {
- blanksrc:`${drupalSettings.path.themePath}/assets/img/blank.gif`,
- loadingItem: false
- }
- },
- computed: {
- ...mapState({
- isloggedin: state => state.User.isloggedin
- })
- },
- methods: {
- ...mapActions({
- flagUnflag: 'User/flagUnflag'
- }),
- itemIsLoading(id) {
- return this.loadingItem
- },
- onUnFlagCard (e) {
- console.log("Card onFlagActionCard", e, this.item);
- if (!this.loadingItem) {
- this.loadingItem = true;
- this.flagUnflag({
- action: 'unflag',
- id: this.item.id,
- collid: this.collid
- })
- .then(data => {
- console.log("onUnFlagCard then", data);
- this.loadingItem = false;
- })
- }
- },
- openModalCard (e) {
- console.log('openModalCard', this.isLoggedin);
- if(this.isloggedin){
- this.$modal.show(
- ModalCard,
- { item: this.item },
- {
- name: `modal-${this.item.id}`,
- draggable: true,
- width: '850px',
- height: '610px'
- }
- )
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- </style>
|