Skip to content
Snippets Groups Projects
Commit 53ae8bec authored by rde's avatar rde
Browse files

[FIX] website_blog: repair blog post save

Before this commit and since the huge JS refactoring, when you were editing
a blog post it wouldn't save your modifications if you touched the title or
subtitle of the blog.

This was due to title & subtitle getting considered as the cover itself
when saving (_saveElement) because they are inside the cover (in a HTML point
of view).
So if you had modified both the cover, the title and the subtiltle, it was:
	1. Saving the cover
	2. Saving the cover again
	3. Saving the cover again

Now, _saveElement is called as it should, for the same case, it is:
	1. Saving the cover
	2. Saving the title
	3. Saving the subtitle
parent 8baabfb6
Branches
Tags
No related merge requests found
......@@ -69,17 +69,15 @@ rte.Class.include({
return this._super.apply(this, arguments);
},
_saveElement: function ($el, context) {
var defs = [this._super.apply(this, arguments)];
// TODO the o_dirty class is not put on the right element for blog cover
// edition. For some strange reason, it was forcly put (even if not
// dirty) in <= saas-16 but this is not the case anymore.
if (this.__blogCoverSaved) {
return $.when();
}
var $blogContainer = $el.closest('.o_blog_cover_container');
if ($blogContainer.length) {
if (!this.__blogCoverSaved && $blogContainer.length) {
$el = $blogContainer;
this.__blogCoverSaved = true;
return this._rpc({
defs.push(this._rpc({
route: '/blog/post_change_background',
params: {
post_id: parseInt($el.closest("[name=\"blog_post\"], .website_blog").find("[data-oe-model=\"blog.post\"]").first().data("oe-id"), 10),
......@@ -90,9 +88,9 @@ rte.Class.include({
"resize_class": $el.data("cover_class"),
},
},
});
}));
}
return this._super.apply(this, arguments);
return $.when.apply($, defs);
},
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment