[IMP] : code change cover photo
bzr revid: aja@tinyerp.com-20140214070522-ujfraed51a5ieifq
This commit is contained in:
parent
3168ee3a7f
commit
b9833c31e0
|
@ -29,6 +29,7 @@ p.post-meta {
|
|||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
background-color: rgba(0, 0, 0, 0.3);
|
||||
min-height: 400px;
|
||||
height: 100vh;
|
||||
color: white;
|
||||
padding-top: 30vh;
|
||||
|
@ -42,6 +43,7 @@ p.post-meta {
|
|||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
background-color: rgba(0, 0, 0, 0.3);
|
||||
min-height: 200px;
|
||||
height: 50vh;
|
||||
color: white;
|
||||
padding-top: 5vh;
|
||||
|
|
|
@ -28,6 +28,7 @@ p.post-meta
|
|||
background-position: center
|
||||
background-repeat: no-repeat
|
||||
background-color: rgba(0, 0, 0, 0.3)
|
||||
min-height : 400px
|
||||
height: 100vh
|
||||
color: white
|
||||
padding-top: 30vh
|
||||
|
@ -40,6 +41,7 @@ p.post-meta
|
|||
background-position: center
|
||||
background-repeat: no-repeat
|
||||
background-color: rgba(0, 0, 0, 0.3)
|
||||
min-height : 200px
|
||||
height: 50vh
|
||||
color: white
|
||||
padding-top: 5vh
|
||||
|
|
|
@ -28,9 +28,8 @@
|
|||
},
|
||||
}),
|
||||
edit: function () {
|
||||
var res = this._super();
|
||||
$('body').on('click', '#change_cover',change_bg);
|
||||
return res;
|
||||
this._super();
|
||||
$('body').on('click', '#change_cover',_.bind(this.change_bg));
|
||||
},
|
||||
save : function() {
|
||||
openerp.jsonRpc("/blogpsot/change_background", 'call', {
|
||||
|
@ -39,17 +38,16 @@
|
|||
});
|
||||
return this._super();
|
||||
},
|
||||
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(')','');
|
||||
});
|
||||
editor.on('save', self, function (o) {
|
||||
$('.blog_cover').css("background-image", o.url && o.url !== "" ? 'url(' + o.url + ')' : "");
|
||||
});
|
||||
editor.appendTo('body');
|
||||
},
|
||||
});
|
||||
|
||||
function change_bg(ev){
|
||||
var self = this;
|
||||
var editor = new website.editor.ImageDialog();
|
||||
editor.on('start', self, function (o) {
|
||||
o.url = $(self).parent()[0].style.background.replace('url(','').replace(')','');
|
||||
});
|
||||
editor.on('save', self, function (o) {
|
||||
$(self).parent().css("background-image", o.url && o.url !== "" ? 'url(' + o.url + ')' : "");
|
||||
});
|
||||
editor.appendTo('body');
|
||||
}
|
||||
})();
|
||||
|
|
|
@ -260,14 +260,16 @@
|
|||
<p id="is_document_user" groups="base.group_document_user"/>
|
||||
</xpath>
|
||||
<xpath expr="//span[@name='blog_post_date']" position="replace">
|
||||
<div class="text-center mt16">
|
||||
<a t-ignore="true" id="change_cover" class="btn btn-primary css_non_editable_mode_hidden" style="cursor :pointer">
|
||||
Change Cover Photo
|
||||
</a>
|
||||
</div>
|
||||
</xpath>
|
||||
<xpath expr="//p[@name='blog_post_data']" position="before">
|
||||
<h2 class="text-center " t-field="blog_post.sub_title"/>
|
||||
<h2 class="text-center" t-field="blog_post.sub_title"/>
|
||||
</xpath>
|
||||
<xpath expr="//div[@id='title']" position="inside">
|
||||
<a t-ignore="true" id="change_cover" class="btn btn-primary hover-edition-button css_non_editable_mode_hidden" style="top: 533px; left: 648px; cursor :pointer">
|
||||
Change Cover Photo
|
||||
</a>
|
||||
<div class="text-center blog_item">
|
||||
<img class="img-circle" t-att-src="'/website/image?model=res.users&field=image_small&id='+str(blog_post.create_uid.id)" style="width: 30px; margin-right: 10px;"/>
|
||||
<small id="blog_author" t-field="blog_post.create_uid.name"/>
|
||||
|
@ -278,7 +280,7 @@
|
|||
</xpath>
|
||||
<xpath expr="//section[@id='comments']" position="after">
|
||||
<div class="cover_footer mb0" t-attf-style="background-image: url(#{next_post.content_image})">
|
||||
<p class="text-center">Read Next</p>
|
||||
<p class="text-center" t-ignore="true">Read Next</p>
|
||||
<a class="hidden js_next" t-attf-href="/blogpost/#{ slug(next_post) }#wrap"/>
|
||||
<h1 class="text-center" t-field="next_post.name"/>
|
||||
<h2 class="text-center" t-field="next_post.sub_title"/>
|
||||
|
|
Loading…
Reference in New Issue