diff options
| author | Benjamin Vray <bvr@odoo.com> | 2020-01-29 09:53:49 +0000 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2020-03-12 15:00:38 +0000 |
| commit | b339310d31c78b6282a797cd515cba29ee95db73 (patch) | |
| tree | 42c9753116c7a050fbeea6d076e1de006bba2144 /addons/website/static/src/snippets/s_image_gallery | |
| parent | d944e67b467f8187aa1988a9f1f1fe8b21e12235 (diff) | |
[FIX] website: update links ids in duplicated carousel snippets
(+ gallery snippet in carousel mode)
Part of https://github.com/odoo/odoo/pull/44180
task-2162952
X-original-commit: 6237c59d607389cb0ed57694bb23b253f49805c8
Diffstat (limited to 'addons/website/static/src/snippets/s_image_gallery')
| -rw-r--r-- | addons/website/static/src/snippets/s_image_gallery/options.js | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/addons/website/static/src/snippets/s_image_gallery/options.js b/addons/website/static/src/snippets/s_image_gallery/options.js index cbbadb6ea50..e796b5a16d3 100644 --- a/addons/website/static/src/snippets/s_image_gallery/options.js +++ b/addons/website/static/src/snippets/s_image_gallery/options.js @@ -56,9 +56,13 @@ options.registry.gallery = options.Class.extend({ * @override */ onBuilt: function () { - var uuid = new Date().getTime(); - this.$target.find('.carousel').attr('id', 'slideshow_' + uuid); - this.$target.find('[data-target]').attr('data-target', '#slideshow_' + uuid); + this._adaptNavigationIDs(); + }, + /** + * @override + */ + onClone: function () { + this._adaptNavigationIDs(); }, /** * @override @@ -332,6 +336,21 @@ options.registry.gallery = options.Class.extend({ //-------------------------------------------------------------------------- /** + * @private + */ + _adaptNavigationIDs: function () { + var uuid = new Date().getTime(); + this.$target.find('.carousel').attr('id', 'slideshow_' + uuid); + _.each(this.$target.find('[data-slide], [data-slide-to]'), function (el) { + var $el = $(el); + if ($el.attr('data-target')) { + $el.attr('data-target', '#slideshow_' + uuid); + } else if ($el.attr('href')) { + $el.attr('href', '#slideshow_' + uuid); + } + }); + }, + /** * @override */ _computeWidgetState: function (methodName, params) { |
