some bug fixe, added showroom

This commit is contained in:
Bachir Soussi Chiadmi 2020-02-20 12:57:35 +01:00
parent f69853bb46
commit e4bb6c909f
4 changed files with 31 additions and 21 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -644,8 +644,9 @@ article.card{
} }
} }
section.taxonomy{ section.taxonomy{
margin:1em 0;
ul{ ul{
margin:1em 0 0; margin: 0;
} }
li{ li{
display:inline-block; display:inline-block;

View File

@ -25,7 +25,7 @@
</nav> </nav>
<div class="cols"> <div class="cols">
<div class="col col-left"> <div class="col col-left">
<section class="accroche"> <section v-if="content.image_accroche" class="accroche">
<figure> <figure>
<img <img
:src="content.image_accroche.src" :src="content.image_accroche.src"
@ -50,6 +50,14 @@
</ul> </ul>
</div> </div>
</section> </section>
<section v-if="content.field_showroom" class="showroom">
<h2>{{ content.field_showroom.name }}</h2>
<a class="mail" :href="'mail:'+content.field_showroom.field_public_email">
{{ content.field_showroom.field_public_email }}</a>
<br/>
<a class="phone" :href="'tel:' + content.field_showroom.field_public_phone">
{{ content.field_showroom.field_public_phone }}</a>
</section>
</div> <!-- //col-left --> </div> <!-- //col-left -->
<div class="col col-right"> <div class="col col-right">
<section class="body" v-html="content.body"></section> <section class="body" v-html="content.body"></section>
@ -216,14 +224,13 @@ export default {
// will be filled by videos and field_visuel // will be filled by videos and field_visuel
this.content.lightbox_items = []; this.content.lightbox_items = [];
// parse embeded videos // parse embeded videos pushing it in lightbox
this.content.videos = [];
for(let key in attrs.field_video){ for(let key in attrs.field_video){
let videolink = attrs.field_video[key] let videolink = attrs.field_video[key]
console.log('videolink', videolink); // console.log('videolink', videolink);
let provider_regex = /https:\/\/(www\.)?(?<provider>youtube|vimeo)\.com\/.+/; let provider_regex = /https:\/\/(www\.)?(?<provider>youtube|vimeo)\.com\/.+/;
let match = provider_regex.exec(videolink) let match = provider_regex.exec(videolink)
console.log('provider', match.groups.provider); // console.log('provider', match.groups.provider);
let video_id = null; let video_id = null;
let video_thumb = null; let video_thumb = null;
switch (match.groups.provider) { switch (match.groups.provider) {
@ -239,7 +246,7 @@ export default {
video_thumb = "http://img.youtube.com/vi/"+video_id+"/0.jpg" video_thumb = "http://img.youtube.com/vi/"+video_id+"/0.jpg"
break; break;
} }
console.log('video_id', video_id); // console.log('video_id', video_id);
this.content.lightbox_items.push({ this.content.lightbox_items.push({
src: videolink, src: videolink,
@ -253,14 +260,6 @@ export default {
// href: videolink // href: videolink
// }); // });
} }
console.log(this.content.videos);
// for(let key in this.content.videos){
// this.content.lightbox_items.push(this.content.videos[key].href)
// }
// for(let key in this.content.field_visuel){
// this.content.lightbox_items.push(this.content.field_visuel[key].src)
// }
// parse all relationships // parse all relationships
for (let key in relations) { for (let key in relations) {
@ -268,7 +267,20 @@ export default {
if (!relations.hasOwnProperty(key)) continue; if (!relations.hasOwnProperty(key)) continue;
let relation_obj = relations[key] let relation_obj = relations[key]
console.log('typeof relation_obj.data', typeof relation_obj.data); console.log("relation", key, relation_obj);
// console.log('typeof relation_obj.data', typeof relation_obj.data);
if(!relation_obj.data) continue;
// showroom is unique field so no array in data
// we parse it here
switch (key) {
case 'field_showroom':
let included = inc.find((i) => { return i.id == relation_obj.data.id })
// console.log('included',included);
this.content[key] = included.attributes;
break
}
// skip relation_obj if data is not array // skip relation_obj if data is not array
if(!Array.isArray(relation_obj.data)) continue if(!Array.isArray(relation_obj.data)) continue
// create empty field array // create empty field array
@ -310,9 +322,6 @@ export default {
field = included.attributes field = included.attributes
field.id = included.id field.id = included.id
break; break;
// case 'field_showroom':
// field = included.attributes
// break
default: default:
} }
this.content[key].push(field) this.content[key].push(field)