summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorChristophe Matthieu <chm@odoo.com>2015-01-19 12:03:54 +0100
committerChristophe Matthieu <chm@odoo.com>2015-01-23 12:44:26 +0100
commit88c1b40dead092b52914a1ff6b0164cfef41a6db (patch)
tree1e9fbeb39c819b08aa363dab5fd03b08db8698a3 /addons
parent113e6addad899dd5f9d42ca1a26f310c61aaa26a (diff)
[FIX] website: snippet gallery in mode slideshow: When selecting an image, the previous one is highlighted when add images. Can't display the first image.
Diffstat (limited to 'addons')
-rw-r--r--addons/website/static/src/js/website.snippets.animation.js8
-rw-r--r--addons/website/static/src/js/website.snippets.gallery.js10
2 files changed, 14 insertions, 4 deletions
diff --git a/addons/website/static/src/js/website.snippets.animation.js b/addons/website/static/src/js/website.snippets.animation.js
index d872a0c54f8..63ed2561a00 100644
--- a/addons/website/static/src/js/website.snippets.animation.js
+++ b/addons/website/static/src/js/website.snippets.animation.js
@@ -280,7 +280,7 @@
var $prev = $indicator.find('li.fa:first');
var $next = $indicator.find('li.fa:last');
var index = ($lis.filter('.active').index() || 1) -1;
- var page = Math.floor((index-1) / 10);
+ var page = Math.floor(index / 10);
var nb = Math.ceil($lis.length / 10);
// fix bootstrap use index insead of data-slide-to
@@ -296,7 +296,7 @@
function hide () {
$lis.addClass('hidden').each(function (i) {
- if (i > page*10 && i < (page+1)*10+1) {
+ if (i >= page*10 && i < (page+1)*10) {
$(this).removeClass('hidden');
}
});
@@ -306,14 +306,14 @@
$indicator.find('li.fa').on('click', function () {
page = (page + ($(this).hasClass('o_indicators_left')?-1:1)) % nb;
- $carousel.carousel(page*10+1);
+ $carousel.carousel(page*10);
hide();
});
hide();
$carousel.on('slid.bs.carousel', function() {
var index = ($lis.filter('.active').index() || 1) -1;
- page = Math.floor((index-1) / 10);
+ page = Math.floor(index / 10);
hide();
});
}
diff --git a/addons/website/static/src/js/website.snippets.gallery.js b/addons/website/static/src/js/website.snippets.gallery.js
index 377ffcd1305..8984eaccbd8 100644
--- a/addons/website/static/src/js/website.snippets.gallery.js
+++ b/addons/website/static/src/js/website.snippets.gallery.js
@@ -205,6 +205,16 @@
$(this).attr('data-index', index).data('index', index);
});
this.$target.css("height", Math.round(window.innerHeight*0.7));
+
+ // apply layout animation
+ this.$target.off('slide.bs.carousel').off('slid.bs.carousel');
+ this.$target.find('li.fa').off('click');
+ if (this.$target.data("snippet-view", view)) {
+ var view = new website.snippet.animationRegistry.gallery_slider(this.$target, true);
+ this.$target.data("snippet-view", view);
+ } else {
+ this.$target.data("snippet-view").start(true);
+ }
},
columns : function(type, value) {
this.$target.attr("data-columns", value);