summaryrefslogtreecommitdiff
path: root/addons/website/static/src/js/website.snippets.gallery.js
diff options
context:
space:
mode:
authorChristophe Matthieu <chm@odoo.com>2015-08-21 09:17:27 +0200
committerChristophe Matthieu <chm@odoo.com>2015-08-21 15:58:53 +0200
commit394a0c8bb40ffa6eb080dd9e3bc9bce16db3d6f1 (patch)
tree0b25f1431664d685b3938fbc5aa507fd4e768dcf /addons/website/static/src/js/website.snippets.gallery.js
parenta38e5bee18506128773af97c9685c136a72ab137 (diff)
[FIX] website: two sliders or galleries can have the same id
(because the user can edit separate part like footer or using versioning)
Diffstat (limited to 'addons/website/static/src/js/website.snippets.gallery.js')
-rw-r--r--addons/website/static/src/js/website.snippets.gallery.js19
1 files changed, 5 insertions, 14 deletions
diff --git a/addons/website/static/src/js/website.snippets.gallery.js b/addons/website/static/src/js/website.snippets.gallery.js
index 12392c4ef52..dede9e07969 100644
--- a/addons/website/static/src/js/website.snippets.gallery.js
+++ b/addons/website/static/src/js/website.snippets.gallery.js
@@ -30,13 +30,9 @@
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 () {
@@ -186,18 +182,13 @@
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: 0,
title: "",
interval : this.$target.data("interval") || false,
- id: "slideshow_" + (uuid+1)
+ id: "slideshow_" + new Date().getTime()
},
$slideshow = $(openerp.qweb.render('website.gallery.slideshow', params));
this.replace($slideshow);