浏览代码

:recycle: fixing attrs for attachment endpoint | adjusting single template to use new gallery data

tags/0.9.0
J 5 年前
父节点
当前提交
c888ab7bec
共有 2 个文件被更改,包括 12 次插入4 次删除
  1. 1
    1
      plugins/cia-endpoints/includes/class.make-endpoint.php
  2. 11
    3
      vue-theme/src/pages/single.vue

+ 1
- 1
plugins/cia-endpoints/includes/class.make-endpoint.php 查看文件

57
         $all_image_ids_in_gallery = array();
57
         $all_image_ids_in_gallery = array();
58
         $all_image_ids = array();
58
         $all_image_ids = array();
59
         foreach ($galleries as $gallery) {
59
         foreach ($galleries as $gallery) {
60
-            array_push($all_image_ids_in_gallery, $gallery[ids]);
60
+            array_push($all_image_ids_in_gallery, $gallery[attrs][ids]);
61
         }
61
         }
62
         foreach ($all_image_ids_in_gallery as $ids) {
62
         foreach ($all_image_ids_in_gallery as $ids) {
63
             foreach ($ids as $id) {
63
             foreach ($ids as $id) {

+ 11
- 3
vue-theme/src/pages/single.vue 查看文件

14
             //- ?: are objects are always gallery blocks
14
             //- ?: are objects are always gallery blocks
15
             .gallery.block(v-if="typeof block === 'object'" :class="`gallery-${i}`")
15
             .gallery.block(v-if="typeof block === 'object'" :class="`gallery-${i}`")
16
                 p gallery number: {{ i }}
16
                 p gallery number: {{ i }}
17
-                ul.t-cntr 
18
-                    li(v-for="(imageID, j) in post.galleries[block.gallery].ids" :class="`gallery-${i}--image-${j+1}`" :key="`block-${i}-${j}`")
17
+                p ids: {{ post.galleries[block.gallery].innerHTML }}
18
+                ul.t-cntr(v-if="post.galleries[block.gallery]")
19
+                    li(v-for="(imageID, j) in getImageIdsForGallery(block.gallery)" :class="`gallery-${i}--image-${j+1}`" :key="`block-${i}-${j}`")
19
                         img(@click="openGallery(i - 1, imageID)" :src="post.attached[imageID]['thumbnail']")
20
                         img(@click="openGallery(i - 1, imageID)" :src="post.attached[imageID]['thumbnail']")
20
                         //- TO DO Caption stuff and full screen Title/Description
21
                         //- TO DO Caption stuff and full screen Title/Description
21
                         p Caption goes here<br>
22
                         p Caption goes here<br>
86
             }, {})
87
             }, {})
87
         },
88
         },
88
 
89
 
90
+        idsForGallery() {
91
+            return this.post.galleries[this.activeGalleryIndex].attrs.ids
92
+        },
89
         /**
93
         /**
90
          * We need a convenient way to get all the images
94
          * We need a convenient way to get all the images
91
          * broken down by gallery. We use the active gallery
95
          * broken down by gallery. We use the active gallery
98
             // {
102
             // {
99
             //     imageId: { 'thumbnail': url, 'large': url }
103
             //     imageId: { 'thumbnail': url, 'large': url }
100
             // }
104
             // }
101
-            return this.post.galleries[this.activeGalleryIndex].ids.reduce((imageMap, id) => {
105
+            return this.idsForGallery.reduce((imageMap, id) => {
102
                 imageMap[id] = this.post.attached[id]
106
                 imageMap[id] = this.post.attached[id]
103
                 return imageMap
107
                 return imageMap
104
             }, {})
108
             }, {})
108
         }
112
         }
109
     },
113
     },
110
     methods: {
114
     methods: {
115
+        getImageIdsForGallery(galleryIndex) {
116
+            console.log(galleryIndex)
117
+            return galleryIndex >= 0 ? this.post.galleries[galleryIndex].attrs.ids : []
118
+        },
111
         /**
119
         /**
112
          * We set the active gallery to the index.
120
          * We set the active gallery to the index.
113
          * Everything kicks off when activeGallery
121
          * Everything kicks off when activeGallery

正在加载...
取消
保存