summaryrefslogtreecommitdiff
path: root/addons/website/static/src/js/website.snippets.gallery.js
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2015-08-24 18:19:19 +0200
committerChristophe Simonis <chs@odoo.com>2015-08-24 18:19:19 +0200
commit88c0ce0692ccf3b1302e15c4ebe34dbf2040be40 (patch)
tree5bb1749f69f96df22a92a747052dc2965e83430e /addons/website/static/src/js/website.snippets.gallery.js
parent878c3c9291ad69b530d24227cb25b38dbf10229b (diff)
parente16d495d8965522d90ddf5d5da234b1650a695f9 (diff)
[MERGE] forward port of branch saas-6 up to e16d495
Diffstat (limited to 'addons/website/static/src/js/website.snippets.gallery.js')
-rw-r--r--addons/website/static/src/js/website.snippets.gallery.js21
1 files changed, 6 insertions, 15 deletions
diff --git a/addons/website/static/src/js/website.snippets.gallery.js b/addons/website/static/src/js/website.snippets.gallery.js
index 4eb09a4837b..fd6005456e2 100644
--- a/addons/website/static/src/js/website.snippets.gallery.js
+++ b/addons/website/static/src/js/website.snippets.gallery.js
@@ -38,13 +38,9 @@ options.registry.gallery = options.Class.extend({
this._temp_col = this.$el.find("data-columns").data("columns");
},
drop_and_build_snippet: function() {
- var uuid = 0;
- $(".carousel").each(function () {
- var id = parseInt(($(this).attr('id') || '0').replace(/[^0-9]/, ''));
- if (id > uuid) uuid = id;
- });
- this.$target.find('.carousel').attr('id', 'slideshow_'+ (uuid+1));
- this.$target.find('[data-target]').attr('data-target', '#slideshow_'+ (uuid+1));
+ var uuid = new Date().getTime();
+ this.$target.find('.carousel').attr('id', 'slideshow_' + uuid);
+ this.$target.find('[data-target]').attr('data-target', '#slideshow_' + uuid);
},
styling : function(type, value) {
var classes = this.$el.find('li[data-styling]').map(function () {
@@ -194,18 +190,13 @@ options.registry.gallery = options.Class.extend({
var self = this,
$imgs = $(this.get_imgs()),
- urls = $imgs.map(function() { return $(this).attr("src"); } ).get(),
- uuid = 0;
- $(".carousel").each(function () {
- var id = parseInt(($(this).attr('id') || '0').replace(/[^0-9]/, ''));
- if (id > uuid) uuid = id;
- });
+ urls = $imgs.map(function() { return $(this).attr("src"); } ).get();
var params = {
srcs : urls,
- index: 1,
+ index: 0,
title: "",
interval : this.$target.data("interval") || false,
- id: "slideshow_" + (uuid+1)
+ id: "slideshow_" + new Date().getTime()
},
$slideshow = $(qweb.render('website.gallery.slideshow', params));
this.replace($slideshow);