[FIX] website_blog: fix broken change cover wizard

This commit is contained in:
Martin Trigaux 2014-05-13 12:31:57 +02:00
parent eed75b620d
commit 00a4845bc7
2 changed files with 10 additions and 8 deletions

View File

@ -30,11 +30,12 @@
},
}),
edit: function () {
var self = this;
$('.popover').remove();
this._super();
var vHeight = $(window).height();
$('body').on('click','#change_cover',_.bind(this.change_bg,{},vHeight));
$('body').on('click', '#clear_cover',_.bind(this.clean_bg,{},vHeight));
$('body').on('click','#change_cover',_.bind(this.change_bg, self.rte.editor, vHeight));
$('body').on('click', '#clear_cover',_.bind(this.clean_bg, self.rte.editor, vHeight));
},
save : function() {
var res = this._super();
@ -51,12 +52,12 @@
},
change_bg : function(vHeight) {
var self = this;
var editor = new website.editor.ImageDialog();
editor.on('start', self, function (o) {
o.url = $('.js_fullheight').length ? $('.js_fullheight').css('background-image').replace(/url\(|\)|"|'/g,'') : '';
});
editor.on('save', self, function (o) {
$('.js_fullheight').css({"background-image": o.url && o.url !== "" ? 'url(' + o.url + ')' : "", 'min-height': vHeight})
var element = new CKEDITOR.dom.element(self.element.find('.cover-storage').$[0]);
var editor = new website.editor.MediaDialog(self, element);
$(document.body).on('media-saved', self, function (o) {
var url = $('.cover-storage').attr('src');
$('.js_fullheight').css({"background-image": !_.isUndefined(url) ? 'url(' + url + ')' : "", 'min-height': vHeight});
$('.cover-storage').remove();
});
editor.appendTo('body');
},

View File

@ -187,6 +187,7 @@
<span class="fa fa-times"/>
</a>
</div>
<div class="cover-storage oe_hidden"></div>
<t t-call="website.publish_management">
<t t-set="object" t-value="blog_post"/>
<t t-set="publish_edit" t-value="True"/>