[IMP] : change background iamge and clean background
bzr revid: aja@tinyerp.com-20140224051502-dmv98ks8lwxgyd18
This commit is contained in:
parent
b066aa497c
commit
5cc0a2eb88
|
@ -32,22 +32,26 @@
|
|||
edit: function () {
|
||||
this._super();
|
||||
$('body').on('click', '#change_cover',_.bind(this.change_bg));
|
||||
$('body').on('click', '#clear_cover',_.bind(this.clean_bg));
|
||||
},
|
||||
save : function() {
|
||||
openerp.jsonRpc("/blogpsot/change_background", 'call', {
|
||||
'post_id' : $('#blog_post_name').attr('data-oe-id'),
|
||||
'image' : $('.blog_cover')[0].style.background.replace('url(','').replace(')',''),
|
||||
'image' : $('.cover')[0].style.background.replace('url(','').replace(')',''),
|
||||
});
|
||||
return this._super();
|
||||
},
|
||||
clean_bg : function() {
|
||||
$('.cover').css("background-image","");
|
||||
},
|
||||
change_bg : function() {
|
||||
var self = this;
|
||||
var editor = new website.editor.ImageDialog();
|
||||
editor.on('start', self, function (o) {
|
||||
o.url = $('.blog_cover')[0].style.background.replace('url(','').replace(')','');
|
||||
o.url = $('.cover')[0].style.background.replace('url(','').replace(')','');
|
||||
});
|
||||
editor.on('save', self, function (o) {
|
||||
$('.blog_cover').css("background-image", o.url && o.url !== "" ? 'url(' + o.url + ')' : "");
|
||||
$('.cover').css("background-image", o.url && o.url !== "" ? 'url(' + o.url + ')' : "");
|
||||
});
|
||||
editor.appendTo('body');
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue