diff --git a/addons/mass_mailing/views/website_mass_mailing.xml b/addons/mass_mailing/views/website_mass_mailing.xml index bc55f61400c..b76b48e54f9 100644 --- a/addons/mass_mailing/views/website_mass_mailing.xml +++ b/addons/mass_mailing/views/website_mass_mailing.xml @@ -1,14 +1,16 @@ - + + - - - + + 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 c169406384e..8a1845ef3a1 100644 --- a/addons/website_blog/static/src/js/website_blog.editor.js +++ b/addons/website_blog/static/src/js/website_blog.editor.js @@ -19,39 +19,40 @@ }); }, }); - - website.EditorBar.include({ - edit: function () { - var self = this; - $('.popover').remove(); - this._super(); - var vHeight = $(window).height(); - $('body').on('click','#change_cover',_.bind(this.change_bg, self.rte.editor, vHeight)); - $('body').on('click', '#clear_cover',_.bind(this.clean_bg, self.rte.editor, vHeight)); - }, - save : function() { - var res = this._super(); - if ($('.cover').length) { - openerp.jsonRpc("/blogpost/change_background", 'call', { - 'post_id' : $('#blog_post_name').attr('data-oe-id'), - 'image' : $('.cover').css('background-image').replace(/url\(|\)|"|'/g,''), + if ($('.website_blog').length) { + website.EditorBar.include({ + edit: function () { + var self = this; + $('.popover').remove(); + this._super(); + var vHeight = $(window).height(); + $('body').on('click','#change_cover',_.bind(this.change_bg, self.rte.editor, vHeight)); + $('body').on('click', '#clear_cover',_.bind(this.clean_bg, self.rte.editor, vHeight)); + }, + save : function() { + var res = this._super(); + if ($('.cover').length) { + openerp.jsonRpc("/blogpost/change_background", 'call', { + 'post_id' : $('#blog_post_name').attr('data-oe-id'), + 'image' : $('.cover').css('background-image').replace(/url\(|\)|"|'/g,''), + }); + } + return res; + }, + clean_bg : function(vHeight) { + $('.js_fullheight').css({"background-image":'none', 'min-height': vHeight}); + }, + change_bg : function(vHeight) { + var self = this; + var element = new CKEDITOR.dom.element(self.element.find('.cover-storage').$[0]); + var editor = new website.editor.MediaDialog(self, element); + $(document.body).on('media-saved', self, function (o) { + var url = $('.cover-storage').attr('src'); + $('.js_fullheight').css({"background-image": !_.isUndefined(url) ? 'url(' + url + ')' : "", 'min-height': vHeight}); + $('.cover-storage').remove(); }); - } - return res; - }, - clean_bg : function(vHeight) { - $('.js_fullheight').css({"background-image":'none', 'min-height': vHeight}); - }, - change_bg : function(vHeight) { - var self = this; - var element = new CKEDITOR.dom.element(self.element.find('.cover-storage').$[0]); - var editor = new website.editor.MediaDialog(self, element); - $(document.body).on('media-saved', self, function (o) { - var url = $('.cover-storage').attr('src'); - $('.js_fullheight').css({"background-image": !_.isUndefined(url) ? 'url(' + url + ')' : "", 'min-height': vHeight}); - $('.cover-storage').remove(); - }); - editor.appendTo('body'); - }, - }); + 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 3217bf1a04d..c811677b799 100644 --- a/addons/website_blog/static/src/js/website_blog.js +++ b/addons/website_blog/static/src/js/website_blog.js @@ -1,40 +1,41 @@ $(document).ready(function() { + if ($('.website_blog').length) { + function page_transist(event) { + event.preventDefault(); + newLocation = $('.js_next')[0].href; + var top = $('.cover_footer').offset().top; + $('.cover_footer').animate({ + height: $(window).height()+'px' + }, 300); + $('html, body').animate({ + scrollTop: top + }, 300, 'swing', function() { + window.location.href = newLocation; + }); + } + function animate(event) { + event.preventDefault(); + event.stopImmediatePropagation(); + var target = $(this.hash); + $('html, body').stop().animate({ + 'scrollTop': target.offset().top - 32 + }, 500, 'swing', function () { + window.location.hash = 'blog_content'; + }); + } - function page_transist(event) { - event.preventDefault(); - newLocation = $('.js_next')[0].href; - var top = $('.cover_footer').offset().top; - $('.cover_footer').animate({ - height: $(window).height()+'px' - }, 300); - $('html, body').animate({ - scrollTop: top - }, 300, 'swing', function() { - window.location.href = newLocation; - }); - } - function animate(event) { - event.preventDefault(); - event.stopImmediatePropagation(); - var target = $(this.hash); - $('html, body').stop().animate({ - 'scrollTop': target.offset().top - 32 - }, 500, 'swing', function () { - window.location.hash = 'blog_content'; - }); - } + var content = $("div[enable_chatter_discuss='True']").find('p[data-chatter-id]'); + if (content) { + openerp.jsonRpc("/blog/get_user/", 'call', {}).then(function(data){ + $('#discussions_wrapper').empty(); + new openerp.website.blog_discussion({'content' : content, 'public_user':data[0]}); + }); + } - var content = $("div[enable_chatter_discuss='True']").find('p[data-chatter-id]'); - if (content) { - openerp.jsonRpc("/blog/get_user/", 'call', {}).then(function(data){ - $('#discussions_wrapper').empty(); - new openerp.website.blog_discussion({'content' : content, 'public_user':data[0]}); - }); + $('.js_fullheight').css('min-height', $(window).height()); + $(".js_tweet").share({'author_name':$('#blog_author').text()}); + $('.cover_footer').on('click',page_transist); + $('a[href^="#blog_content"]').on('click', animate); } - $('.js_fullheight').css('min-height', $(window).height()); - $(".js_tweet").share({'author_name':$('#blog_author').text()}); - $('.cover_footer').on('click',page_transist); - $('a[href^="#blog_content"]').on('click', animate); - }); diff --git a/addons/website_blog/views/website_blog_templates.xml b/addons/website_blog/views/website_blog_templates.xml index cdee16da86d..ef56a54f5cd 100644 --- a/addons/website_blog/views/website_blog_templates.xml +++ b/addons/website_blog/views/website_blog_templates.xml @@ -338,15 +338,18 @@ +