summaryrefslogtreecommitdiff
path: root/addons/website/static/src/js/content
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2019-06-03 15:49:31 +0200
committerChristophe Simonis <chs@odoo.com>2019-06-03 15:49:31 +0200
commitc8d7ad9a6bc55af465392d772ae15e981d0f80c7 (patch)
treee9423fa8d28f85b8ad6a1a16e59afadb8db441e9 /addons/website/static/src/js/content
parent8085f259c87f1e6b7f9cf89067f56b327b8936e3 (diff)
parent995aa1685eece9ff1070a637d19d511fb1f80260 (diff)
[MERGE] forward port branch saas-12.2 up to 995aa1685ee
Diffstat (limited to 'addons/website/static/src/js/content')
-rw-r--r--addons/website/static/src/js/content/snippets.animation.js4
-rw-r--r--addons/website/static/src/js/content/website_root.js31
2 files changed, 35 insertions, 0 deletions
diff --git a/addons/website/static/src/js/content/snippets.animation.js b/addons/website/static/src/js/content/snippets.animation.js
index 7f57eb81f2c..33e1e01ebcc 100644
--- a/addons/website/static/src/js/content/snippets.animation.js
+++ b/addons/website/static/src/js/content/snippets.animation.js
@@ -860,6 +860,10 @@ registry.gallerySlider = publicWidget.Widget.extend({
destroy: function () {
this._super.apply(this, arguments);
+ if (!this.$indicator) {
+ return;
+ }
+
this.$prev.prependTo(this.$indicator);
this.$next.appendTo(this.$indicator);
this.$carousel.off('.gallery_slider');
diff --git a/addons/website/static/src/js/content/website_root.js b/addons/website/static/src/js/content/website_root.js
index 9f16c94b38b..dc2b2f679d7 100644
--- a/addons/website/static/src/js/content/website_root.js
+++ b/addons/website/static/src/js/content/website_root.js
@@ -20,6 +20,7 @@ var WebsiteRoot = publicRootData.PublicRoot.extend({
}),
custom_events: _.extend({}, publicRootData.PublicRoot.prototype.custom_events || {}, {
'ready_to_clean_for_save': '_onWidgetsStopRequest',
+ seo_object_request: '_onSeoObjectRequest',
}),
/**
@@ -112,6 +113,36 @@ var WebsiteRoot = publicRootData.PublicRoot.extend({
window.location.href = _.str.sprintf("/website/lang/%(lang)s?r=%(url)s%(hash)s", redirect);
},
/**
+ /**
+ * Checks information about the page SEO object.
+ *
+ * @private
+ * @param {OdooEvent} ev
+ */
+ _onSeoObjectRequest: function (ev) {
+ var res = this._unslugHtmlDataObject('seo-object');
+ ev.data.callback(res);
+ },
+ /**
+ * Returns a model/id object constructed from html data attribute.
+ *
+ * @private
+ * @param {string} dataAttr
+ * @returns {Object} an object with 2 keys: model and id, or null
+ * if not found
+ */
+ _unslugHtmlDataObject: function (dataAttr) {
+ var repr = $('html').data(dataAttr);
+ var match = repr && repr.match(/(.+)\((\d+),(.*)\)/);
+ if (!match) {
+ return null;
+ }
+ return {
+ model: match[1],
+ id: match[2] | 0,
+ };
+ },
+ /**
* @todo review
* @private
*/