diff options
| author | Christophe Matthieu <chm@odoo.com> | 2015-08-21 09:17:27 +0200 |
|---|---|---|
| committer | Christophe Matthieu <chm@odoo.com> | 2015-08-21 15:58:53 +0200 |
| commit | 394a0c8bb40ffa6eb080dd9e3bc9bce16db3d6f1 (patch) | |
| tree | 0b25f1431664d685b3938fbc5aa507fd4e768dcf /addons/website/static/src/js/website.snippets.editor.js | |
| parent | a38e5bee18506128773af97c9685c136a72ab137 (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.editor.js')
| -rw-r--r-- | addons/website/static/src/js/website.snippets.editor.js | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/addons/website/static/src/js/website.snippets.editor.js b/addons/website/static/src/js/website.snippets.editor.js index abb4b9e859f..e45feeb590c 100644 --- a/addons/website/static/src/js/website.snippets.editor.js +++ b/addons/website/static/src/js/website.snippets.editor.js @@ -1175,23 +1175,15 @@ }); website.snippet.options.slider = website.snippet.Option.extend({ - unique_id: function () { - var id = 0; - $(".carousel").each(function () { - var cid = 1 + parseInt($(this).attr("id").replace(/[^0123456789]/g, ''),10); - if (id < cid) id = cid; - }); - return "myCarousel" + id; - }, drop_and_build_snippet: function() { - this.id = this.unique_id(); + this.id = "myCarousel_" + new Date().getTime(); this.$target.attr("id", this.id); this.$target.find("[data-slide]").attr("data-cke-saved-href", "#" + this.id); this.$target.find("[data-target]").attr("data-target", "#" + this.id); this.rebind_event(); }, on_clone: function ($clone) { - var id = this.unique_id(); + var id = "myCarousel_" + new Date().getTime(); $clone.attr("id", id); $clone.find("[data-slide]").attr("href", "#" + id); $clone.find("[data-slide-to]").attr("data-target", "#" + id); |
