Browse Source

show map on gallery and change name

axolotle 2 years ago
parent
commit
79bb45851f

+ 5 - 3
src/components/layouts/SideView.vue

@@ -5,12 +5,13 @@
     no-header
     :id="id"
     :body-class="{ paddings: !noCross }"
+    :visible="visible"
   >
-    <template #default="{ hide, visible }">
+    <template #default="{ hide, visible: visible2 }">
       <div v-if="!noCross" class="btn-close-wrapper">
         <button-close @click="hide()" />
       </div>
-      <slot name="default" v-bind="{ hide, visible }" />
+      <slot name="default" v-bind="{ hide, visible: visible2 }" />
     </template>
   </b-sidebar>
 </template>
@@ -21,7 +22,8 @@ export default {
 
   props: {
     id: { type: String, required: true },
-    noCross: { type: Boolean, default: false }
+    noCross: { type: Boolean, default: false },
+    visible: { type: Boolean, default: false }
   }
 }
 </script>

+ 1 - 1
src/messages/fr.json

@@ -6,7 +6,7 @@
     "contact": "Contact",
     "library": "Bibliothèque",
     "kit": "Kit de désapprentissage",
-    "gallery": "Créations numériques",
+    "gallery": "Galerie virtuelle",
     "blog": "Blog"
   },
   "variants": {

+ 6 - 2
src/pages/Gallery.vue

@@ -4,7 +4,7 @@
       {{ $t('map') }}
     </b-button>
 
-    <side-view id="gallery-map-side">
+    <side-view id="gallery-map-side" :visible="mapIsVisible">
       <template #default="{ hide, visible }">
         <gallery-map
           v-if="creations && creation"
@@ -100,7 +100,8 @@ export default {
 
   data () {
     return {
-      intro: ''
+      intro: '',
+      mapIsVisible: false
     }
   },
 
@@ -126,6 +127,9 @@ export default {
   },
 
   created () {
+    if (this.$route.hash === '#map') {
+      this.mapIsVisible = true
+    }
     this.$store.dispatch('INIT_GALLERY', parseInt(this.id))
     this.$store.dispatch('QUERY_PAGE', 'gallery').then(page => {
       this.intro = page.content

+ 5 - 0
src/pages/gallery/GalleryMap.vue

@@ -87,6 +87,11 @@ export default {
 
   created () {
     this.setDots()
+    if (this.visible) {
+      this.$nextTick().then(() => {
+        this.defineSize()
+      })
+    }
   }
 }
 </script>

+ 1 - 1
src/store/modules/gallery.js

@@ -29,7 +29,7 @@ export default {
 
     async 'OPEN_CREATION' ({ state, commit, dispatch }, id) {
       if (router.currentRoute.name !== 'gallery-view') {
-        router.push({ name: 'gallery-view', params: { id } })
+        router.push({ name: 'gallery-view', params: { id }, hash: '#map' })
       } else {
         router.push({ params: { id } })
       }