Skip to content

Commit

Permalink
Clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
magiccart committed Jun 4, 2021
1 parent fddbef3 commit 3cdbf59
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
1 change: 1 addition & 0 deletions Model/System/Config/Row.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class Row implements \Magento\Framework\Option\ArrayInterface
public function toOptionArray()
{
return [
'0'=> __('1 row(s) without warp /slider'),
'1'=> __('1 row(s) /slider'),
'2'=> __('2 row(s) /slider'),
'3'=> __('3 row(s) /slider'),
Expand Down
2 changes: 1 addition & 1 deletion etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<center_mode>true</center_mode>
<dots>false</dots>
<fade>true</fade>
<rows>1</rows>
<rows>0</rows>
<speed>300</speed>
<autoplay_speed>3000</autoplay_speed>
<autoplay-Speed>3000</autoplay-Speed>
Expand Down
17 changes: 3 additions & 14 deletions view/frontend/templates/testimonial-center-mode.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ $selector = 'alo-content-'.uniqid();
$testimonials = $this->getTestimonials();
if(!count($testimonials)) return;
?>
<div class="<?php echo $selector ?>">
<div class="<?php echo $selector ?>" data-mage-init='{"gridSlider": {}}'>
<div class="block-testimonial">
<?php echo $this->getTitle() ? '<h3 class="block-title title item">' . '<span>' . $this->getTitle() . '</span>' . '</h3>' : '' ?>
</div>
<div class="block-content">
<div class="testimonial center-mode"
<div class="testimonial center-mode grid-slider"
<?php foreach ($this->getFrontendCfg() as $opt) :?>
data-<?php echo $opt ?>='<?php echo $this->getData($opt) ?>'
<?php endforeach;?>
Expand Down Expand Up @@ -48,25 +48,14 @@ if(!count($testimonials)) return;
var el = $('.<?php echo $selector ?> .testimonial');
if(!el.length) return;
var options = el.data();
var iClass = '.alo-item';
el.children().addClass(iClass);
iClass = '.alo-item';
var selector = el.selector;
var classes = selector + ' '+ iClass;
var padding = options.padding;
var slider;
var style = padding ? classes + '{float: left; padding-left: '+padding+'px; padding-right:'+padding+'px} ' + selector + '{margin-left: -'+padding+'px; margin-right: -'+padding+'px}' : '';
if(options.slidesToShow){
if(el.hasClass('slick-initialized')) el.slick("refresh");
else $(el).slick(options);
var caption = $('.<?php echo $selector ?> .testimonial-caption');
var testimonial_text = el.find('.slick-current.slick-center .testimonial_text');
if(testimonial_text.length) caption.html(testimonial_text.html());
el.on('afterChange', function (event, slick, currentSlide, nextSlide) {
testimonial_text = $(slick.$slides.get(currentSlide)).find('.testimonial_text');
if(testimonial_text.length) caption.html(testimonial_text.html());
});
}
$('head').append('<style type="text/css">'+style+'</style>');
}
});
</script>

0 comments on commit 3cdbf59

Please sign in to comment.