Просмотр исходного кода

#5244 Comments: image preview isn't working in Discussions

Alex Trofimov 1 год назад
Родитель
Сommit
c8d8ff319c

+ 4 - 2
modules/boonex/artificer/data/template/bx_forum/comment_attachments.html

@@ -1,7 +1,8 @@
+<div class="pswp-gallery">
 <bx_repeat:attached>
     <div class="__style_prefix__-attached-preview bx-forum-attached-preview p-1">
         <bx_if:show_image>
-            <a href="javascript:void(0)" onclick="__js_object__.showImage(event || window.event, this)" data-file-id="__file_id__" data-src="__file__" data-w="__w__" data-h="__h__" title="<bx_text_attribute:_cmt_view_attached_image />">
+            <a href="__file__" data-file-id="__file_id__" data-src="__file__" data-pswp-src="__file__" data-pswp-width="__w__" data-pswp-height="__h__" title="<bx_text_attribute:_cmt_view_attached_image />">
                 <img class="bg-cover" src="<bx_image_url:spacer.gif />" style="background-image:url(__preview__)" /> __file_name__ <span class="bx-def-font-grayed">__file_size__</span>
             </a>
         </bx_if:show_image>
@@ -11,4 +12,5 @@
             </a>
         </bx_if:show_file>
     </div>
-</bx_repeat:attached>
+</bx_repeat:attached>
+</div>

+ 4 - 2
modules/boonex/forum/template/comment_attachments.html

@@ -1,7 +1,8 @@
+<div class="pswp-gallery">
 <bx_repeat:attached>
     <div class="__style_prefix__-attached-preview bx-forum-attached-preview bx-def-round-corners bx-def-padding-thd">
         <bx_if:show_image>
-            <a href="javascript:void(0)" onclick="__js_object__.showImage(event || window.event, this)" data-file-id="__file_id__" data-src="__file__" data-w="__w__" data-h="__h__" title="<bx_text_attribute:_cmt_view_attached_image />">
+            <a href="__file__" data-file-id="__file_id__" data-src="__file__" data-pswp-src="__file__" data-pswp-width="__w__" data-pswp-height="__h__" title="<bx_text_attribute:_cmt_view_attached_image />">
                 <img class="bg-cover" src="<bx_image_url:spacer.gif />" style="background-image:url(__preview__)" /> __file_name__ <span class="bx-def-font-grayed">__file_size__</span>
             </a>
         </bx_if:show_image>
@@ -9,4 +10,5 @@
             <a href="__file__" title="<bx_text_attribute:_cmt_download_attached_file />"><i class="sys-icon __file_icon__"></i> __file_name__ <span class="bx-def-font-grayed">__file_size__</span></a>
         </bx_if:show_file>
     </div>
-</bx_repeat:attached>
+</bx_repeat:attached>
+</div>