@@ -633,26 +633,27 @@ <h5 class="card-title mb-0">{% translate "Attachments" %}</h5>
633633 < div class ="card-body overflow-auto flex-grow-1 " id ="attachments-drop-zone ">
634634 < div class ="row g-3 " id ="attachments-gallery ">
635635 {% for photo in asset.attachments.all %}
636- < div class ="col-6 col-sm-4 col-md-custom-5 col-lg-2 col-xxl-3 " data-attachment-id ="{{ photo.pk|stringformat:'d' }} ">
636+ < div class ="col-6 col-sm-4 col-md-custom-5 col-lg-2 col-xxl-3 attachment-col " data-attachment-id ="{{ photo.pk|stringformat:'d' }} ">
637637 < div class ="position-relative attachment-item " style ="aspect-ratio: 1; ">
638638 < img src ="{{ photo.attachment.url }} "
639639 data-fancybox ="gallery "
640- data-caption ="{{ photo.upload_date}} · {{ photo.filename }} "
640+ data-caption ="{{ photo.filename }} · {{ photo.upload_date}} "
641+ data-filename ="{{ photo.filename }} "
641642 alt ="{{ photo.filename }} "
642643 class ="img-fluid rounded w-100 h-100 "
643644 style ="object-fit: cover; cursor: pointer; "/>
644- < div class ="attachment-controls position-absolute top-0 end-0 p-2 ">
645+ < div class ="attachment-controls position-absolute top-0 end-0 p-2 " style =" pointer-events: auto; " >
645646 < button class ="btn btn-sm btn-danger delete-attachment-btn "
646647 data-attachment-id ="{{ photo.pk|stringformat:'d' }} "
647648 title ="{% translate 'Delete attachment' %} ">
648649 < i class ="fas fa-trash "> </ i >
649650 </ button >
650651 </ div >
651- < div class ="drag-handle position-absolute top-0 start-0 p-2 "
652+ < div class ="drag-handle position-absolute top-0 start-0 p-2 " style =" touch-action: none; user-select: none; "
652653 title ="{% translate 'Drag to reorder' %} ">
653- < i class ="fas fa-grip-vertical text-white " style ="text-shadow: 1px 1px 2px rgba(0,0,0,0.8); "> </ i >
654+ < i class ="fas fa-grip-vertical text-white " style ="text-shadow: 1px 1px 2px rgba(0,0,0,0.8); pointer-events: none; "> </ i >
654655 </ div >
655- < div class ="attachment-checkbox position-absolute bottom-0 end-0 p-2 ">
656+ < div class ="attachment-checkbox position-absolute bottom-0 end-0 p-2 " style =" pointer-events: auto; " >
656657 < input type ="checkbox " class ="form-check-input attachment-select-checkbox "
657658 data-attachment-id ="{{ photo.pk|stringformat:'d' }} "
658659 style ="width: 20px; height: 20px; cursor: pointer; ">
@@ -935,16 +936,26 @@ <h5 class="card-title">{% translate "Divested" %}</h5>
935936 opacity : 0.7 ;
936937 cursor : grab;
937938 transition : opacity 0.2s ease;
939+ z-index : 10 ;
940+ pointer-events : auto;
938941 }
939-
942+
940943 .drag-handle : active {
941944 cursor : grabbing;
942945 }
943-
946+
944947 .attachment-item : hover .drag-handle {
945948 opacity : 1 ;
946949 }
947950
951+ .attachment-controls {
952+ z-index : 10 ;
953+ }
954+
955+ .attachment-checkbox {
956+ z-index : 10 ;
957+ }
958+
948959 .upload-skeleton-btn : hover {
949960 background-color : # e3f2fd !important ;
950961 border-color : # 2196F3 !important ;
@@ -1250,7 +1261,7 @@ <h5 class="card-title">{% translate "Divested" %}</h5>
12501261 e . preventDefault ( ) ;
12511262 e . stopPropagation ( ) ;
12521263 const url = slide . src ;
1253- const filename = url . split ( '/' ) . pop ( ) ;
1264+ const filename = slide . el ?. dataset ?. filename || url . split ( '/' ) . pop ( ) ;
12541265
12551266 fetch ( url )
12561267 . then ( resp => resp . blob ( ) )
@@ -1281,15 +1292,6 @@ <h5 class="card-title">{% translate "Divested" %}</h5>
12811292 IFRAME_ERROR : "{% translate " Error Loading Page " %}" ,
12821293 } ,
12831294 } ) ;
1284-
1285- // Initialize Carousel
1286- const carousel = new Carousel ( document . querySelector ( ".carousel" ) , {
1287- 'l10n' : {
1288- NEXT : "{% translate " Next " %}" ,
1289- PREV : "{% translate " Previous slide " %}" ,
1290- GOTO : "{% translate " Go to slide % d " %}" ,
1291- }
1292- } ) ;
12931295 </ script >
12941296 < script src ="https://unpkg.com/filepond/dist/filepond.js "> </ script >
12951297 < script >
@@ -1444,11 +1446,12 @@ <h5 class="card-title">{% translate "Divested" %}</h5>
14441446 ghostClass : 'sortable-ghost' ,
14451447 dragClass : 'sortable-drag' ,
14461448 handle : '.drag-handle' ,
1447- forceFallback : true ,
1448- fallbackTolerance : 3 ,
14491449 onEnd : function ( evt ) {
1450+ if ( evt . oldIndex === evt . newIndex ) {
1451+ return ;
1452+ }
14501453 const attachmentIds = Array . from ( galleryElement . children ) . map ( item =>
1451- item . getAttribute ( 'data-attachment-id' )
1454+ parseInt ( item . getAttribute ( 'data-attachment-id' ) )
14521455 ) ;
14531456 updateAttachmentOrder ( attachmentIds ) ;
14541457 }
0 commit comments