Initial commit: is_imageslider out of the box. v2.3.2
This commit is contained in:
35
is_imageslider/views/js/createForm.js
Normal file
35
is_imageslider/views/js/createForm.js
Normal file
@ -0,0 +1,35 @@
|
||||
$(document).ready(function () {
|
||||
handleFileInputChange();
|
||||
|
||||
window.prestashop.component.initComponents(
|
||||
[
|
||||
'TranslatableField',
|
||||
'TinyMCEEditor',
|
||||
'TranslatableInput',
|
||||
],
|
||||
);
|
||||
|
||||
const choiceTree = new window.prestashop.component.ChoiceTree('#image_slider_shop_association');
|
||||
choiceTree.enableAutoCheckChildren();
|
||||
});
|
||||
|
||||
|
||||
function handleFileInputChange() {
|
||||
const $fileInput = $('#image_slider [type="file"]');
|
||||
|
||||
$fileInput.on('change', (e) => {
|
||||
const $input = $(e.currentTarget);
|
||||
const $relatedImage = $(`[data-related-field="${$input.attr('id')}"]`);
|
||||
const files = $input[0].files;
|
||||
|
||||
if (FileReader && files && files.length) {
|
||||
const reader = new FileReader();
|
||||
|
||||
reader.onload = function () {
|
||||
$relatedImage.attr('src', reader.result)
|
||||
}
|
||||
|
||||
reader.readAsDataURL(files[0]);
|
||||
}
|
||||
})
|
||||
}
|
||||
15
is_imageslider/views/js/form.js
Normal file
15
is_imageslider/views/js/form.js
Normal file
@ -0,0 +1,15 @@
|
||||
$(document).ready(function () {
|
||||
window.prestashop.component.initComponents(
|
||||
[
|
||||
'MultistoreConfigField',
|
||||
'Grid',
|
||||
],
|
||||
);
|
||||
|
||||
const imageSliderkGrid = new window.prestashop.component.Grid('is_imageslider');
|
||||
|
||||
imageSliderkGrid.addExtension(new prestashop.component.GridExtensions.AsyncToggleColumnExtension());
|
||||
imageSliderkGrid.addExtension(new window.prestashop.component.GridExtensions.SortingExtension());
|
||||
imageSliderkGrid.addExtension(new window.prestashop.component.GridExtensions.PositionExtension());
|
||||
imageSliderkGrid.addExtension(new window.prestashop.component.GridExtensions.SubmitRowActionExtension());
|
||||
});
|
||||
11
is_imageslider/views/js/index.php
Normal file
11
is_imageslider/views/js/index.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../');
|
||||
exit;
|
||||
Reference in New Issue
Block a user