From 4ffdf8a45ba5964b8592201f204d447d727216c2 Mon Sep 17 00:00:00 2001 From: Benoit Socias Date: Wed, 28 Dec 2022 07:55:45 +0000 Subject: [PATCH] [FIX] website_blog: apply cover properties behavior only on post page Before this commit the whole options javascript of blogs was skipped if the accessed page was not the blog post page. This actually did not work anymore since the website preview was moved into an iframe. After this commit, the global condition is removed, and a new condition is added in the cover properties override so that it only applies to blog covers displayed inside the single blog post page. task-2811746 X-original-commit: a6b7a2731ca05314a0bd28a54d84efd61b3e1ad8 Part-of: odoo/odoo#108763 --- addons/website_blog/static/src/js/options.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/website_blog/static/src/js/options.js b/addons/website_blog/static/src/js/options.js index d559b841757..72760d65992 100644 --- a/addons/website_blog/static/src/js/options.js +++ b/addons/website_blog/static/src/js/options.js @@ -6,10 +6,6 @@ const {_t} = require('web.core'); const options = require('web_editor.snippets.options'); require('website.editor.snippets.options'); -if (!$('.website_blog').length) { - return; -} - const NEW_TAG_PREFIX = 'new-blog-tag-'; options.registry.many2one.include({ @@ -45,6 +41,10 @@ options.registry.CoverProperties.include({ */ updateUI: async function () { await this._super(...arguments); + const isBlogCover = this.$target[0].classList.contains('o_wblog_post_page_cover'); + if (!isBlogCover) { + return; + } var isRegularCover = this.$target.is('.o_wblog_post_page_cover_regular'); var $coverFull = this.$el.find('[data-select-class*="o_full_screen_height"]'); var $coverMid = this.$el.find('[data-select-class*="o_half_screen_height"]');