Skip to content

Commit

Permalink
Merge pull request #10169 from PierreRambaud/fix/boom-6116
Browse files Browse the repository at this point in the history
Images aren't displayed in combinations
  • Loading branch information
matks committed Aug 30, 2018
2 parents e5ace89 + cbcb031 commit 6dae020
Show file tree
Hide file tree
Showing 27 changed files with 1,697 additions and 1,607 deletions.
2,980 changes: 1,497 additions & 1,483 deletions admin-dev/themes/default/package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion admin-dev/themes/new-theme/js/product-page/combination.js
Expand Up @@ -11,7 +11,7 @@ export default function() {
const idsProductAttribute = $jsCombinationsList.data('ids-product-attribute').toString().split(',');
const refreshImagesUrl = $jsCombinationsList
.attr('data-action-refresh-images')
.replace(/product-form-images\/\d+/, 'product-form-images/' + $jsCombinationsList.data('id-product'));
.replace(/form-images\/\d+/, 'form-images/' + $jsCombinationsList.data('id-product'));
const idsCount = idsProductAttribute.length;
const step = 50;
let currentCount = 0;
Expand Down
74 changes: 52 additions & 22 deletions admin-dev/themes/new-theme/js/product-page/product-header.js
Expand Up @@ -23,41 +23,71 @@
* International Registered Trademark & Property of PrestaShop SA
*/

const $ = window.$;

export default function() {
let tabWidth = 0;
let navWidth = 50;
const $defaultArrowWidth = 35;
const $arrow = $('.js-arrow');
const $tabs = $('.js-tabs');
const $navTabs = $('.js-nav-tabs');

let $positions;
let $moveTo = 0;
let $tabWidth = 0;
let $navWidth = $defaultArrowWidth;
let $widthWithTabs = 0;

$('.js-nav-tabs li').each((index, item) => {
navWidth += $(item).width();
$navTabs.find('li').each((index, item) => {
$navWidth += $(item).width();
});
$('.js-nav-tabs').width(navWidth);

$('.js-nav-tabs [data-toggle="tab"]').on('click', (e) => {
$navTabs.width($navWidth);

$widthWithTabs = $navWidth + ($defaultArrowWidth * 2);

$navTabs.find('[data-toggle="tab"]').on('click', (e) => {
if (!$(e.target).hasClass('active')) {
$('#form_content > .form-contenttab').removeClass('active');
}
if ($(e.target).attr('href') === '#step1') {
setTimeout(_=> {
setTimeout(() => {
$('#description_short, #tab_description_short .description-tab').addClass('active');
}, 100);
}, 100);
}
});

$('.js-arrow').on('click', (e) => {
tabWidth = navWidth - $('.js-tabs').width();

if ($('.js-arrow').is(':visible')) {
$('.js-nav-tabs').animate({
left: $(e.currentTarget).hasClass('right-arrow') ? `-=${tabWidth}` : 0
}, 400, 'easeOutQuad', () => {
if ($(e.currentTarget).hasClass('right-arrow')) {
$('.left-arrow').addClass('visible');
$('.right-arrow').removeClass('visible');
} else {
$('.right-arrow').addClass('visible');
$('.left-arrow').removeClass('visible');
$arrow.on('click', (e) => {
if ($arrow.is(':visible')) {
$tabWidth = $navWidth > $navWidth ? $navWidth - $tabs.width() : $tabs.width();
$positions = $navTabs.position();

$moveTo = '-=0';
if ($(e.currentTarget).hasClass('right-arrow')) {
if (($tabWidth - $positions.left) < $navWidth) {
$moveTo = `-=${$tabWidth}`;
}
} else {
if ($positions.left < $defaultArrowWidth) {
$moveTo = `+=${$tabWidth}`;
}
}

$navTabs.animate(
{
left: $moveTo
},
400,
'easeOutQuad',
() => {
if ($(e.currentTarget).hasClass('right-arrow')) {
$('.left-arrow').addClass('visible');
$('.right-arrow').removeClass('visible');
} else {
$('.right-arrow').addClass('visible');
$('.left-arrow').removeClass('visible');
}
}
});
);
}
});
}
2 changes: 1 addition & 1 deletion admin-dev/themes/new-theme/public/backup.bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion admin-dev/themes/new-theme/public/catalog.bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6dae020

Please sign in to comment.