[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
This commit is contained in:
Benoit Socias
2022-12-28 17:29:10 +01:00
parent 35d8ffd39a
commit 4ffdf8a45b
+4 -4
View File
@@ -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"]');