[FIX] website_blog: change_background doesn't work occasionally
Some time new background image, which I set via "Change cover" button don't saved. Because super is called before the jsonRpc and don't wait that the background is saved.
This commit is contained in:
parent
fc61bfe993
commit
ae175d1574
|
@ -30,14 +30,18 @@ $(document).ready(function() {
|
|||
$('body').on('click', '#clear_cover',_.bind(this.clean_bg, self.rte.editor, vHeight));
|
||||
},
|
||||
save : function() {
|
||||
var res = this._super();
|
||||
var self = this;
|
||||
var _super = this._super;
|
||||
if ($('.cover').length) {
|
||||
openerp.jsonRpc("/blogpost/change_background", 'call', {
|
||||
return openerp.jsonRpc("/blogpost/change_background", 'call', {
|
||||
'post_id' : $('#blog_post_name').attr('data-oe-id'),
|
||||
'image' : $('.cover').css('background-image').replace(/url\(|\)|"|'/g,''),
|
||||
}).then(function () {
|
||||
return _super.call(self);
|
||||
});
|
||||
} else {
|
||||
return this._super();
|
||||
}
|
||||
return res;
|
||||
},
|
||||
clean_bg : function(vHeight) {
|
||||
$('.js_fullheight').css({"background-image":'none', 'min-height': vHeight});
|
||||
|
|
Loading…
Reference in New Issue