Browse Source

some bug fixe, added showroom

Bachir Soussi Chiadmi 4 years ago
parent
commit
e4bb6c909f

File diff suppressed because it is too large
+ 0 - 0
web/themes/custom/materiotheme/assets/dist/main.css


File diff suppressed because it is too large
+ 0 - 0
web/themes/custom/materiotheme/assets/dist/main.js


+ 2 - 1
web/themes/custom/materiotheme/assets/styles/main.scss

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

+ 27 - 18
web/themes/custom/materiotheme/vuejs/components/Pages/Article.vue

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

Some files were not shown because too many files changed in this diff