Skip to content

Commit

Permalink
fixes Piwigo#14 hide thumbnail on remove from collection action, for …
Browse files Browse the repository at this point in the history
…Bootrstrap Darkroom theme

adds a user-collection-selected class on selected thumbnails
  • Loading branch information
plegall committed Nov 15, 2019
1 parent 95ecf20 commit e9b9ad8
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion template/thumbnails_css_js.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
{* <!-- all pages but collection edit page --> *}
{if not isset($UC_IN_EDIT)}
{footer_script require='jquery'}

{* add css class to selected items on load, only for bootstrap theme *}
jQuery(".addCollection").each(function() {
var col_ids = jQuery(this).data('cols');
if (col_ids != '') {
jQuery(this).closest('.card.card-thumbnail').addClass('user-collection-selected');
}
});

var $cdm = jQuery('#collectionsDropdown');

$cdm.on('mouseleave', function() {
Expand Down Expand Up @@ -108,9 +117,13 @@ $cdm.on('click', '.add, .remove', function(e) {
if (method == 'pwg.collections.removeImages') {
col_ids.splice(col_ids.indexOf(col_id), 1);
if (col_ids == ''){
$(this).closest('.card.card-thumbnail').removeClass('user-collection-selected');
}
}
else if (col_ids.indexOf(col_id) == -1) {
col_ids[ col_ids.length ] = col_id;
$(this).closest('.card.card-thumbnail').addClass('user-collection-selected');
}
$(this).data('col', col_ids);
});
Expand Down Expand Up @@ -203,7 +216,8 @@ jQuery('#thumbnails').on('click', '.addCollection', function(e) {
},
success: function(data) {
if (data.stat == 'ok') {
$trigger.parent('li').hide('fast', function() {
{* col-outer is for bootstrap themes *}
$trigger.closest('li, .col-outer').hide('fast', function() {
jQuery(this).remove();
if (typeof GThumb != 'undefined') {
GThumb.build();
Expand Down

0 comments on commit e9b9ad8

Please sign in to comment.