[IMP] : page transition

-> publish button on right

bzr revid: aja@tinyerp.com-20140319133934-vycn6leow3x2r6cg
This commit is contained in:
ajay javiya (OpenERP) 2014-03-19 19:09:34 +05:30
parent aee1189f9e
commit fd05ea1f7a
3 changed files with 14 additions and 40 deletions

View File

@ -33,8 +33,7 @@
$('.popover').remove();
$('mark').contents().unwrap();
this._super();
var top_nav = _.isNull($('#website-top-navbar').height()) ? 0 : $('#website-top-navbar').height();
var vHeight = $(window).height() - ($('header').height() + top_nav);
var vHeight = $(window).height();
$('body').on('click','#change_cover',_.bind(this.change_bg,{},vHeight));
$('body').on('click', '#clear_cover',_.bind(this.clean_bg,{},vHeight));
},
@ -55,7 +54,7 @@
o.url = $('.cover_header')[0].style.background.replace('url(','').replace(')','');
});
editor.on('save', self, function (o) {
$('.cover').css({"background-image": o.url && o.url !== "" ? 'url(' + o.url + ')' : "", 'min-height': vHeight})
$('.cover_header').css({"background-image": o.url && o.url !== "" ? 'url(' + o.url + ')' : "", 'min-height': vHeight})
});
editor.appendTo('body');
},

View File

@ -3,16 +3,22 @@ $(document).ready(function() {
var share = false;
function updateMinHeight(event) {
var top_nav = _.isNull($('#website-top-navbar-placeholder').height()) ? 0 : $('#website-top-navbar-placeholder').height();
var vHeight = $(window).height() - ($('header').height() + top_nav);
var vHeight = $(window).height();
$(document).find('.cover_header').css('min-height', vHeight);
}
function page_transist(event) {
event.preventDefault();
newLocation = $('.js_next')[0].href;
$('.cover_footer')
.fadeIn(900, newpage);
var top = $('.cover_footer').offset().top;
$('.cover_footer').animate({
height: $(window).height()+'px'
}, 500);
$('html, body').animate({
scrollTop: top
}, 500, 'swing', function() {
window.location.href = newLocation;
});
}
function animate(event) {
@ -42,35 +48,4 @@ $(document).ready(function() {
$('.cover_footer').on('click',page_transist);
$('a[href^="#blog_content"]').on('click', animate);
updateMinHeight();
function page_upwards() {
var translationValue = $("#wrap:last-child").get(0).getBoundingClientRect().top;
$("#wrap:last-child").addClass('easing_upward');
setTimeout(function(){
$html = $(document.documentElement);
$("#wrap:first-child").add($html).scrollTop(0);
$("#wrap:last-child").removeClass('easing_upward');
$("#wrap:first").remove();
var content = $(document).find("#blog_content p");
if (content && discussion){
new openerp.website.blog_discussion({'content' : content});
}
}, 300 );
}
function newpage() {
$.ajax({
url: newLocation
}).done(function(data) {
$('main').append($(data).find('main').html());
page_upwards();
updateMinHeight();
//bind again it takes control from now on, until page relaod.
$(document).find('.cover_footer').on('click',page_transist);
$(document).find('a[href^="#blog_content"]').on('click', animate);
if (share) $("p,h1,h2,h3,h4,ul").share({'author_name':$(data).find('#blog_author').text()});
if (newLocation != window.location)
history.pushState(null, null, newLocation);
});
}
});

View File

@ -165,7 +165,7 @@
<div t-attf-class="cover #{blog_post.content_image and 'cover_header' or ''} text-center" id="title" t-attf-style="background-image : url(#{blog_post.content_image})" t-ignore="True">
<div class="container">
<div style="position: absolute" class="container text-right mt16">
<div class="container text-right mt16">
<div class="btn-group css_non_editable_mode_hidden">
<a id="change_cover" class="btn btn-primary">
Change Cover
@ -224,7 +224,7 @@
<t t-if="next_post">
<div class="cover cover_footer mb0 text-center" t-attf-style="background-image: url(#{next_post.content_image})" t-ignore="True">
<p>Read Next</p>
<a class="hidden js_next" t-attf-href="/blogpost/#{ slug(next_post) }#wrap"/>
<a class="hidden js_next" t-attf-href="/blogpost/#{ slug(next_post) }/#wrap"/>
<h1 t-field="next_post.name"/>
<h2 t-field="next_post.sub_title"/>
<div>