activated lightbox on cards, started to dev modal-card
This commit is contained in:
@@ -1744,17 +1744,36 @@ article.card {
|
||||
width: 100%;
|
||||
height: 100%; }
|
||||
article.card section.images figure {
|
||||
cursor: pointer;
|
||||
margin: 0;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0; }
|
||||
left: 0;
|
||||
transition: opacity 0.2s ease-in-out; }
|
||||
article.card section.images figure:first-of-type {
|
||||
z-index: 5; }
|
||||
article.card section.images figure.show {
|
||||
opacity: 1;
|
||||
z-index: 6; }
|
||||
article.card section.images figure.hide {
|
||||
opacity: 0; }
|
||||
article.card section.images figure img.blank {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 20; }
|
||||
article.card.search-card > header {
|
||||
cursor: pointer; }
|
||||
article.card.modal-card {
|
||||
display: flex;
|
||||
flex-flow: row-reverse nowrap;
|
||||
width: 850px;
|
||||
height: 610px; }
|
||||
article.card.modal-card > .col {
|
||||
flex-basis: 50%; }
|
||||
article.card.modal-card section.col-right header {
|
||||
position: relative;
|
||||
bottom: auto; }
|
||||
|
||||
#main-content > article.article div.cols {
|
||||
display: grid;
|
||||
|
110
web/themes/custom/materiotheme/assets/dist/main.js
vendored
110
web/themes/custom/materiotheme/assets/dist/main.js
vendored
File diff suppressed because one or more lines are too long
@@ -20,6 +20,9 @@ Vue.use(InfiniteLoading, {
|
||||
import CoolLightBox from 'vue-cool-lightbox'
|
||||
Vue.use(CoolLightBox)
|
||||
|
||||
import VModal from 'vue-js-modal'
|
||||
Vue.use(VModal)
|
||||
|
||||
import store from 'vuejs/store'
|
||||
import router from 'vuejs/route'
|
||||
|
||||
|
@@ -12,3 +12,6 @@ $card_height: 295px;
|
||||
|
||||
$minicard_width: 170px;
|
||||
$minicard_height: 100px;
|
||||
|
||||
$modalcard_width: 850px;
|
||||
$modalcard_height: 610px;
|
||||
|
@@ -829,6 +829,7 @@ article.card{
|
||||
position: relative;
|
||||
&, *{width: 100%; height:100%;}
|
||||
figure{
|
||||
cursor: pointer;
|
||||
margin:0;
|
||||
position: absolute;
|
||||
top:0; left:0;
|
||||
@@ -836,6 +837,10 @@ article.card{
|
||||
&:first-of-type{
|
||||
z-index:5
|
||||
}
|
||||
transition: opacity 0.2s ease-in-out;
|
||||
&.show{opacity: 1; z-index:6;}
|
||||
&.hide{opacity: 0;}
|
||||
|
||||
img{
|
||||
// width: 100%; height:100%;
|
||||
&.blank{
|
||||
@@ -846,6 +851,28 @@ article.card{
|
||||
}
|
||||
}
|
||||
}
|
||||
// overwritnig card for card-medium (aka search-card)
|
||||
&.search-card{
|
||||
>header{
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
// overwriting card for modal-card
|
||||
&.modal-card{
|
||||
display: flex;
|
||||
flex-flow: row-reverse nowrap;
|
||||
width: $modalcard_width;
|
||||
height: $modalcard_height;
|
||||
>.col{
|
||||
flex-basis: 50%;
|
||||
}
|
||||
section.col-right{
|
||||
header{
|
||||
position: relative;
|
||||
bottom: auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,6 +1,8 @@
|
||||
<template>
|
||||
<article class="card search-card">
|
||||
<header>
|
||||
<header
|
||||
@click="openModalCard"
|
||||
>
|
||||
<h1>{{ item.title }}</h1>
|
||||
<h4>{{ item.field_short_description }}</h4>
|
||||
<span class="ref">{{ item.field_reference }}</span>
|
||||
@@ -34,27 +36,43 @@
|
||||
<img
|
||||
class="lazy"
|
||||
v-lazy="index"
|
||||
:data-src="img.url"
|
||||
:data-src="img.img_styles.card_medium"
|
||||
:title="img.title"
|
||||
/>
|
||||
<img class="blank" :src="blanksrc">
|
||||
<img
|
||||
class="blank"
|
||||
:src="blanksrc"
|
||||
@click="lightbox_index = index"
|
||||
>
|
||||
</figure>
|
||||
</section>
|
||||
<CoolLightBox
|
||||
:items="item.images"
|
||||
:index="lightbox_index"
|
||||
srcName="src"
|
||||
loop="true"
|
||||
@close="lightbox_index = null">
|
||||
</CoolLightBox>
|
||||
</article>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState, mapActions } from 'vuex'
|
||||
import cardMixins from 'vuejs/components/cardMixins'
|
||||
import ModalCard from 'vuejs/components/Content/ModalCard'
|
||||
|
||||
export default {
|
||||
name: "Card",
|
||||
props: ['item'],
|
||||
mixins: [cardMixins],
|
||||
components: {
|
||||
ModalCard
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
blanksrc:`${drupalSettings.path.themePath}/assets/img/blank.gif`,
|
||||
loadingFlag: false
|
||||
loadingFlag: false,
|
||||
lightbox_index: null
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -91,6 +109,17 @@ export default {
|
||||
this.loadingFlag = false;
|
||||
})
|
||||
}
|
||||
},
|
||||
openModalCard (e) {
|
||||
this.$modal.show(
|
||||
ModalCard,
|
||||
{ item: this.item },
|
||||
{
|
||||
draggable: true,
|
||||
width: '850px',
|
||||
height: '610px'
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -23,7 +23,7 @@
|
||||
<img
|
||||
class="lazy"
|
||||
v-lazy="index"
|
||||
:data-src="img.url"
|
||||
:data-src="img.img_styles.card_medium_half"
|
||||
:title="img.title"
|
||||
/>
|
||||
<img class="blank" :src="blanksrc">
|
||||
|
@@ -0,0 +1,116 @@
|
||||
<template>
|
||||
<article class="card modal-card">
|
||||
<section class="col col-right">
|
||||
<header>
|
||||
<h1>{{ item.title }}</h1>
|
||||
<h4>{{ item.field_short_description }}</h4>
|
||||
<span class="ref">{{ item.field_reference }}</span>
|
||||
</header>
|
||||
<nav class="tools">
|
||||
<section class="tool flags">
|
||||
<span class="btn mdi mdi-folder-outline"/>
|
||||
<div class="tool-content">
|
||||
<ul>
|
||||
<li v-if="flagcolls" v-for="coll in flagcolls" :key="coll.id">
|
||||
<span
|
||||
class="flag mdi"
|
||||
:class="[
|
||||
flagIsLoading(coll.id) ? 'mdi-loading mdi-spin' : flagIsActive(coll.id) ? 'mdi-close-circle isActive' : 'mdi-plus'
|
||||
]"
|
||||
:collid="coll.id"
|
||||
@click.prevent="onFlagActionCard"
|
||||
>
|
||||
{{ coll.name }}
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
</nav>
|
||||
</section>
|
||||
<section class="col col-left images" v-switcher>
|
||||
<figure
|
||||
v-for="(img, index) in item.images"
|
||||
:key="img.url"
|
||||
>
|
||||
<img
|
||||
class="lazy"
|
||||
v-lazy="index"
|
||||
:data-src="img.img_styles.card_full"
|
||||
:title="img.title"
|
||||
/>
|
||||
<img
|
||||
class="blank"
|
||||
:src="blanksrc"
|
||||
@click="lightbox_index = index"
|
||||
>
|
||||
</figure>
|
||||
</section>
|
||||
<CoolLightBox
|
||||
:items="item.images"
|
||||
:index="lightbox_index"
|
||||
srcName="src"
|
||||
loop="true"
|
||||
@close="lightbox_index = null">
|
||||
</CoolLightBox>
|
||||
</article>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState, mapActions } from 'vuex'
|
||||
import cardMixins from 'vuejs/components/cardMixins'
|
||||
|
||||
export default {
|
||||
name: "ModalCard",
|
||||
props: ['item'],
|
||||
mixins: [cardMixins],
|
||||
data() {
|
||||
return {
|
||||
blanksrc:`${drupalSettings.path.themePath}/assets/img/blank.gif`,
|
||||
loadingFlag: false,
|
||||
lightbox_index: null
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
flagcolls: state => state.User.flagcolls
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
...mapActions({
|
||||
flagUnflag: 'User/flagUnflag'
|
||||
}),
|
||||
flagIsActive(collid) {
|
||||
// console.log(this.item.uuid);
|
||||
// console.log(this.flagcolls[collid].items_uuids);
|
||||
return this.flagcolls[collid].items_uuids.indexOf(this.item.uuid) !== -1;
|
||||
},
|
||||
flagIsLoading(collid) {
|
||||
// console.log(this.item.uuid);
|
||||
// console.log(this.flagcolls[collid].items_uuids);
|
||||
return collid === this.loadingFlag;
|
||||
},
|
||||
onFlagActionCard (e) {
|
||||
console.log("Card onFlagActionCard", e);
|
||||
if (!this.loadingFlag) {
|
||||
let collid = e.target.getAttribute('collid');
|
||||
let isActive = this.flagIsActive(collid);
|
||||
let action = isActive ? 'unflag' : 'flag';
|
||||
// console.log('collid', collid);
|
||||
// console.log("this.item", this.item);
|
||||
this.loadingFlag = collid;
|
||||
this.flagUnflag({ action: action, uuid: this.item.uuid, collid: collid})
|
||||
.then(data => {
|
||||
console.log("onFlagActionCard then", data);
|
||||
this.loadingFlag = false;
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
</style>
|
@@ -312,7 +312,11 @@ export default {
|
||||
if(img.meta.imageDerivatives){
|
||||
field.images.push({
|
||||
title:img.meta.title,
|
||||
url:img.meta.imageDerivatives.links.card_medium.href
|
||||
src: img.meta.imageDerivatives.links.hd.href,
|
||||
img_styles: {
|
||||
card_medium: img.meta.imageDerivatives.links.card_medium.href,
|
||||
card_full: img.meta.imageDerivatives.links.card_full.href
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
@@ -26,9 +26,13 @@ export default {
|
||||
figs.forEach((fig, index) => {
|
||||
// console.log(index);
|
||||
if(index == delta){
|
||||
fig.style.display = "block"
|
||||
// fig.style.display = "block"
|
||||
fig.classList.remove("hide")
|
||||
fig.classList.add("show")
|
||||
}else{
|
||||
fig.style.display = "none"
|
||||
// fig.style.display = "none"
|
||||
fig.classList.remove("show")
|
||||
fig.classList.add("hide")
|
||||
}
|
||||
})
|
||||
})
|
||||
|
@@ -90,11 +90,16 @@ export default createStore(Vuex.Store, {
|
||||
item.images = []
|
||||
for (let j = 0; j < img_src.length; j++) {
|
||||
if (img_src[j].meta.imageDerivatives) {
|
||||
let img_styles = {}
|
||||
for (var k = 0; k < imgStyle.length; k++) {
|
||||
img_styles[imgStyle[k]] = img_src[j].meta.imageDerivatives.links.[imgStyle[k]].href
|
||||
}
|
||||
item.images.push({
|
||||
title: img_src[j].meta.title,
|
||||
src: img_src[j].meta.imageDerivatives.links.hd.href,
|
||||
// meta.imageDerivatives.style.href link is provided by drupal consumers_image_styles module
|
||||
// BUG: missing all image derivative but first
|
||||
url: img_src[j].meta.imageDerivatives.links.[imgStyle].href
|
||||
img_styles: img_styles
|
||||
})
|
||||
} else {
|
||||
console.warn('missing image derivative ' + j + '/' + img_src.length + ' for ' + attrs.title)
|
||||
|
@@ -110,7 +110,7 @@ export default {
|
||||
// https://github.com/huybuidac/vuex-extensions
|
||||
dispatch('loadMaterials', {
|
||||
uuids: data.uuids,
|
||||
imgStyle: 'card_medium',
|
||||
imgStyle: ['card_medium', 'card_full'],
|
||||
callBack: 'loadMaterialsCallBack'
|
||||
})
|
||||
}else{
|
||||
|
@@ -254,7 +254,7 @@ export default {
|
||||
if (state.flagcolls[collid].items_uuids.length) {
|
||||
dispatch('loadMaterials', {
|
||||
uuids: state.flagcolls[collid].items_uuids,
|
||||
imgStyle: 'card_medium_half',
|
||||
imgStyle: ['card_medium_half'],
|
||||
callBack: 'loadMaterialsCallBack',
|
||||
callBackArgs: { collid: collid }
|
||||
}).then( () => {
|
||||
@@ -282,7 +282,7 @@ export default {
|
||||
// https://github.com/huybuidac/vuex-extensions
|
||||
dispatch('loadMaterials', {
|
||||
uuids: state.flagcolls[collid].items_uuids,
|
||||
imgStyle: 'card_medium_half',
|
||||
imgStyle: ['card_medium_half'],
|
||||
callBack: 'loadMaterialsCallBack',
|
||||
callBackArgs: { collid: collid }
|
||||
})
|
||||
|
Reference in New Issue
Block a user