Files
grzanieplus.pl/plugins/stAllegroPlugin/modules/stAllegroBackend/templates/_offer_images.php
2025-03-12 17:06:23 +01:00

49 lines
1.9 KiB
PHP

<div id="st-allegro-edit-images">
<?php foreach ($images as $image): ?><div class="image" data-value="<?php echo $image->url ?>">
<div class="image-overlay">
<a href="#" class="delete" data-action="delete"><?php echo st_admin_get_icon('remove') ?></a>
</div>
<div class="thumbnail" style="background-image: url(<?php echo $image->url ?>)"></div>
<input type="hidden" name="<?php echo $name ?>[][url]" value="<?php echo $image->url ?>" class="image-url">
</div><?php endforeach ?><a href="#" class="add-image" id="st-allegro-offer-add-image-modal-trigger"></a>
</div>
<?php echo modal('st-allegro-offer-add-image-modal', __('Dodaj zdjęcia produktu'), array(
'remote_url' => st_url_for('@stAllegroPlugin?action=ajaxUploadOfferImages&product=' . $product->getId()),
'trigger' => '#st-allegro-offer-add-image-modal-trigger',
'width' => 960,
)) ?>
<script id="add-offer-image-tpl" type="text/x-template">
<div class="image" data-value="##image##">
<div class="image-overlay">
<a href="#" class="delete" data-action="delete"><?php echo st_admin_get_icon('remove') ?></a>
</div>
<div class="thumbnail" style="background-image: url(##image##)"></div>
<input type="hidden" name="<?php echo $name ?>[][url]" value="##image##" class="image-url">
</div>
</script>
<script>
jQuery(function($) {
$('#st-allegro-edit-images').on('click', 'a.delete', function() {
var link = $(this);
link.closest('.image').remove();
return false;
});
var imageList = $('#st-allegro-edit-images');
imageList.sortable({
placeholder: "image-placeholder",
tolerance: 'pointer',
items: '> div',
forcePlaceholderSize: false,
cursor: 'move',
handle: '.image-overlay',
opacity: 0.5,
});
imageList.disableSelection();
});
</script>