summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorajay javiya (OpenERP) <aja@tinyerp.com>2014-03-19 19:09:34 +0530
committerajay javiya (OpenERP) <aja@tinyerp.com>2014-03-19 19:09:34 +0530
commitfd05ea1f7ae2d251e36dafcd650acfae73dbb183 (patch)
tree58f7604c62b0f4c918d100e680fcd1fdd38480a0 /addons
parentaee1189f9eb698df1cc3640ce20cf5c0493ba186 (diff)
[IMP] : page transition
-> publish button on right bzr revid: aja@tinyerp.com-20140319133934-vycn6leow3x2r6cg
Diffstat (limited to 'addons')
-rw-r--r--addons/website_blog/static/src/js/website_blog.editor.js5
-rw-r--r--addons/website_blog/static/src/js/website_blog.js45
-rw-r--r--addons/website_blog/views/website_blog_templates.xml4
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 @@
<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>