diff --git a/addons/website_blog/static/src/css/website_blog.css b/addons/website_blog/static/src/css/website_blog.css index 0ddf482f8b2..1ce770c7dea 100644 --- a/addons/website_blog/static/src/css/website_blog.css +++ b/addons/website_blog/static/src/css/website_blog.css @@ -34,11 +34,9 @@ p.post-meta { .cover_header { color: white; - min-height: 400px; - height: 100vh; } .cover_header .blog_title { - padding-top: 20vh; + padding-top: 10%; } .cover_header h1 { font-weight: bold; diff --git a/addons/website_blog/static/src/css/website_blog.sass b/addons/website_blog/static/src/css/website_blog.sass index 2fb01b61f2e..7dd30826343 100644 --- a/addons/website_blog/static/src/css/website_blog.sass +++ b/addons/website_blog/static/src/css/website_blog.sass @@ -31,10 +31,8 @@ p.post-meta .cover_header color: white - min-height : 400px - height: 100vh .blog_title - padding-top : 20vh + padding-top : 10% h1 font-weight: bold h2.text-muted 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 84fdb2db9e2..c150b77213a 100644 --- a/addons/website_blog/static/src/js/website_blog.editor.js +++ b/addons/website_blog/static/src/js/website_blog.editor.js @@ -31,8 +31,10 @@ }), edit: function () { this._super(); - $('body').on('click', '#change_cover',_.bind(this.change_bg)); - $('body').on('click', '#clear_cover',_.bind(this.clean_bg)); + var top_nav = _.isNull($('#website-top-navbar').height()) ? 0 : $('#website-top-navbar').height(); + var vHeight = $(window).height() - ($('header').height() + top_nav); + $('body').on('click','#change_cover',_.bind(this.change_bg,{},vHeight)); + $('body').on('click', '#clear_cover',_.bind(this.clean_bg,{},vHeight)); }, save : function() { openerp.jsonRpc("/blogpsot/change_background", 'call', { @@ -41,18 +43,17 @@ }); return this._super(); }, - clean_bg : function() { - $('.cover').css("background-image",""); + clean_bg : function(vHeight) { + $('.cover_header').css({"background-image":"", 'min-height': vHeight}); }, - change_bg : function() { + change_bg : function(vHeight) { var self = this; var editor = new website.editor.ImageDialog(); editor.on('start', self, function (o) { - o.url = $('.cover')[0].style.background.replace('url(','').replace(')',''); + 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 + ')' : "" ) - .addClass('cover_header'); + $('.cover').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 e7105999ae7..4b3cd38c8b5 100644 --- a/addons/website_blog/static/src/js/website_blog.js +++ b/addons/website_blog/static/src/js/website_blog.js @@ -1,6 +1,9 @@ $(document).ready(function() { var discussion = false; var share = false; + var top_nav = _.isNull($('#website-top-navbar-placeholder').height()) ? 0 : $('#website-top-navbar-placeholder').height(); + var vHeight = $(window).height() - ($('header').height() + top_nav); + $('.cover_header').css('min-height', vHeight); function page_transist(event) { event.preventDefault(); newLocation = $('.js_next')[0].href; @@ -56,9 +59,9 @@ $(document).ready(function() { page_upwards(); //bind again it takes control from now on, until page relaod. $(document).find('.cover_footer').on('click',page_transist); - console.log($(data).find('#blog_author')) + $(document).find('.cover_header').css('min-height', vHeight); $(document).find('a[href^="#blog_content"]').on('click', animate); - if (share) $("p,h1,h2,h3,h4,ul").share({'author_name':$(data).find('#blog_author:first').text()}); + 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); });