diff --git a/addons/website_blog/controllers/main.py b/addons/website_blog/controllers/main.py index a5d5501949d..d406bef13ca 100644 --- a/addons/website_blog/controllers/main.py +++ b/addons/website_blog/controllers/main.py @@ -331,10 +331,3 @@ class WebsiteBlog(http.Controller): ids = post_obj.write(request.cr, SUPERUSER_ID, [int(post_id)], values) return [] - @http.route('/blogpsot/get_custom_options', type='json', auth="public", website=True) - def get_custom_options(self, image=None, **post): - values = {} - inherit_options = request.registry.get('ir.ui.view').search_read(request.cr, SUPERUSER_ID, [('name','in',['Allow comment in text','Select to Tweet'])], ['inherit_id','name']) - for options in inherit_options: - values[options.get('name')] = options.get('inherit_id') - return values diff --git a/addons/website_blog/static/src/js/website_blog.js b/addons/website_blog/static/src/js/website_blog.js index 4ab6e3c8d6a..ad4a675f8c5 100644 --- a/addons/website_blog/static/src/js/website_blog.js +++ b/addons/website_blog/static/src/js/website_blog.js @@ -1,11 +1,4 @@ $(document).ready(function() { - var discussion = false; - var share = false; - - function updateMinHeight(event) { - var vHeight = $(window).height(); - $(document).find('.cover_header').css('min-height', vHeight); - } function page_transist(event) { event.preventDefault(); @@ -21,31 +14,25 @@ $(document).ready(function() { }); } - function animate(event) { - event.stopImmediatePropagation(); - var target = this.hash; - $target = $(target); + function animate() { + var target = $(this.hash); $('html, body').stop().animate({ - 'scrollTop': $target.offset().top + 'scrollTop': target.offset().top }, 900, 'swing', function () { window.location.hash = target; }); + return false; } - $( window ).on('resize', function() { - updateMinHeight(); - }); - //check custome options inline discussion and select to tweet(share) are checked. - openerp.jsonRpc("/blogpsot/get_custom_options", 'call', {}).then(function(res){ - discussion = res['Allow comment in text']; - share = res['Select to Tweet']; - var content = $("#blog_content p"); - if(content.length && discussion){ - $('#discussions_wrapper').empty(); - new openerp.website.blog_discussion({'content' : content}); - } - if (share) $("h1, h2, h3, h4, ul, p","#blog_content ,.blog_title").share({'author_name':$('#blog_author').text()}); - }); + + var content = $(".js_discuss"); + if(content){ + $('#discussions_wrapper').empty(); + new openerp.website.blog_discussion({'content' : content}); + } + + $('.cover_header').css('min-height', $(window).height()); + $("js_tweet").find("h1, h2, h3, h4, li, p").share({'author_name':$('#blog_author').text()}); $('.cover_footer').on('click',page_transist); $('a[href^="#blog_content"]').on('click', animate); - updateMinHeight(); + }); diff --git a/addons/website_blog/views/website_blog_templates.xml b/addons/website_blog/views/website_blog_templates.xml index 4b171abe61e..a3181a04451 100644 --- a/addons/website_blog/views/website_blog_templates.xml +++ b/addons/website_blog/views/website_blog_templates.xml @@ -163,7 +163,7 @@