From fd05ea1f7ae2d251e36dafcd650acfae73dbb183 Mon Sep 17 00:00:00 2001 From: "ajay javiya (OpenERP)" Date: Wed, 19 Mar 2014 19:09:34 +0530 Subject: [PATCH] [IMP] : page transition -> publish button on right bzr revid: aja@tinyerp.com-20140319133934-vycn6leow3x2r6cg --- .../static/src/js/website_blog.editor.js | 5 +-- .../static/src/js/website_blog.js | 45 +++++-------------- .../views/website_blog_templates.xml | 4 +- 3 files changed, 14 insertions(+), 40 deletions(-) diff --git a/addons/website_blog/static/src/js/website_blog.editor.js b/addons/website_blog/static/src/js/website_blog.editor.js index e7fa3e8bcb1..21ffee62486 100644 --- a/addons/website_blog/static/src/js/website_blog.editor.js +++ b/addons/website_blog/static/src/js/website_blog.editor.js @@ -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'); }, diff --git a/addons/website_blog/static/src/js/website_blog.js b/addons/website_blog/static/src/js/website_blog.js index f1e00743e51..cdf94f1c4ad 100644 --- a/addons/website_blog/static/src/js/website_blog.js +++ b/addons/website_blog/static/src/js/website_blog.js @@ -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); - }); - } }); diff --git a/addons/website_blog/views/website_blog_templates.xml b/addons/website_blog/views/website_blog_templates.xml index 52637e8f99e..12c795b0579 100644 --- a/addons/website_blog/views/website_blog_templates.xml +++ b/addons/website_blog/views/website_blog_templates.xml @@ -165,7 +165,7 @@