diff --git a/addons/website/data/data.xml b/addons/website/data/data.xml index 97342561caf..578f6992c89 100644 --- a/addons/website/data/data.xml +++ b/addons/website/data/data.xml @@ -105,14 +105,6 @@ - - business_hands - business_hands.jpg - ir.ui.view - url - /website/static/src/img/library/business_hands.jpg - - business_stats business_stats.jpg @@ -121,22 +113,6 @@ /website/static/src/img/library/business_stats.jpg - - engineer - engineer.jpg - ir.ui.view - url - /website/static/src/img/library/engineer.jpg - - - - flight - flight.jpg - ir.ui.view - url - /website/static/src/img/library/flight.jpg - - gears gears.png @@ -186,19 +162,11 @@ - school_kids - school_kids.jpg + world + world.jpg ir.ui.view url - /website/static/src/img/library/school_kids.jpg - - - - ship_sea - ship_sea.jpg - ir.ui.view - url - /website/static/src/img/library/ship_sea.jpg + /website/static/src/img/library/world.jpg @@ -210,11 +178,43 @@ - world - world.jpg + ship_sea + ship_sea.jpg ir.ui.view url - /website/static/src/img/library/world.jpg + /website/static/src/img/library/ship_sea.jpg + + + + flight + flight.jpg + ir.ui.view + url + /website/static/src/img/library/flight.jpg + + + + engineer + engineer.jpg + ir.ui.view + url + /website/static/src/img/library/engineer.jpg + + + + school_kids + school_kids.jpg + ir.ui.view + url + /website/static/src/img/library/school_kids.jpg + + + + business_hands + business_hands.jpg + ir.ui.view + url + /website/static/src/img/library/business_hands.jpg diff --git a/addons/website/static/src/css/editor.css b/addons/website/static/src/css/editor.css index 8ec49889863..f1d77acdc0d 100644 --- a/addons/website/static/src/css/editor.css +++ b/addons/website/static/src/css/editor.css @@ -85,7 +85,11 @@ .editor_enable [data-oe-readonly]:hover { cursor: default; } - +/* Summernote not Support for placeholder text https://github.com/summernote/summernote/issues/581 */ +.o_editable[placeholder]:empty:not(:focus):before { + content: attr(placeholder); + opacity: 0.3; +} /* Prevent the text contents of draggable elements from being selectable. */ [draggable] { -moz-user-select: none; diff --git a/addons/website/static/src/css/editor.sass b/addons/website/static/src/css/editor.sass index 9110b4454cd..73c000f737a 100644 --- a/addons/website/static/src/css/editor.sass +++ b/addons/website/static/src/css/editor.sass @@ -78,6 +78,10 @@ cursor: default // }}} +/* Summernote not Support for placeholder text https://github.com/summernote/summernote/issues/581 */ +.o_editable[placeholder]:empty:not(:focus):before + content: attr(placeholder) + opacity: 0.3 /* Prevent the text contents of draggable elements from being selectable. */ [draggable] diff --git a/addons/website/static/src/css/website.css b/addons/website/static/src/css/website.css index 473ea32f268..faba9afc267 100644 --- a/addons/website/static/src/css/website.css +++ b/addons/website/static/src/css/website.css @@ -768,6 +768,18 @@ div.carousel div.carousel-content { color: #ddd; } +.oe_none { + background-color: #FFFFFF; +} + +.oe_yellow { + background-color: #A2A51B; +} + +.oe_green { + background-color: #149F2C; +} + /* Misc */ .texttop { vertical-align: top; diff --git a/addons/website/static/src/css/website.sass b/addons/website/static/src/css/website.sass index 85259178e15..45215c1cb3e 100644 --- a/addons/website/static/src/css/website.sass +++ b/addons/website/static/src/css/website.sass @@ -603,6 +603,15 @@ div.carousel .text-muted color: #ddd +.oe_none + background-color: #FFFFFF + +.oe_yellow + background-color: #A2A51B + +.oe_green + background-color: #149F2C + /* Misc */ .texttop diff --git a/addons/website/static/src/js/website.contentMenu.js b/addons/website/static/src/js/website.contentMenu.js index ab85c061a12..bb91540b0b4 100644 --- a/addons/website/static/src/js/website.contentMenu.js +++ b/addons/website/static/src/js/website.contentMenu.js @@ -12,7 +12,10 @@ self.$el.on('click', 'a[data-action]', function(ev) { ev.preventDefault(); var $content_item = $(this); - self[$content_item.data('action')](); + var data_action = self[$content_item.data('action')]; + if (data_action) { + data_action(); + } }); return this._super(); }, diff --git a/addons/website_blog/controllers/main.py b/addons/website_blog/controllers/main.py index ddf899d90dd..68c99e24826 100644 --- a/addons/website_blog/controllers/main.py +++ b/addons/website_blog/controllers/main.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- import datetime +import json import urllib import werkzeug @@ -225,10 +226,12 @@ class WebsiteBlog(http.Controller): 'tag': tag, 'blog': blog, 'blog_post': blog_post, + 'blog_post_cover_properties': json.loads(blog_post.cover_properties), 'main_object': blog_post, 'nav_list': self.nav_list(blog), 'enable_editor': enable_editor, 'next_post': next_post, + 'next_post_cover_properties': json.loads(next_post.cover_properties) if next_post else {}, 'date': date_begin, 'blog_url': blog_url, 'pager': pager, @@ -314,9 +317,6 @@ class WebsiteBlog(http.Controller): cr, uid, context = request.cr, request.uid, request.context new_blog_post_id = request.registry['blog.post'].create(cr, uid, { 'blog_id': blog_id, - 'name': _("Blog Post Title"), - 'subtitle': _("Subtitle"), - 'content': '', 'website_published': False, }, context=context) new_blog_post = request.registry['blog.post'].browse(cr, uid, new_blog_post_id, context=context) @@ -360,10 +360,10 @@ class WebsiteBlog(http.Controller): return ret @http.route('/blog/post_change_background', type='json', auth="public", website=True) - def change_bg(self, post_id=0, image=None, **post): + def change_bg(self, post_id=0, cover_properties={}, **post): if not post_id: return False - return request.registry['blog.post'].write(request.cr, request.uid, [int(post_id)], {'background_image': image}, request.context) + return request.registry['blog.post'].write(request.cr, request.uid, [int(post_id)], {'cover_properties': cover_properties}, request.context) @http.route('/blog/get_user/', type='json', auth="public", website=True) def get_user(self, **post): diff --git a/addons/website_blog/data/website_blog_data.xml b/addons/website_blog/data/website_blog_data.xml index a4bc8778bec..457110a8981 100644 --- a/addons/website_blog/data/website_blog_data.xml +++ b/addons/website_blog/data/website_blog_data.xml @@ -2,17 +2,59 @@ - Our News - Sharing our evolution with passion + Our Blog + Get in touch with us - - News + Blog 40 + + + + + Chain + chain.jpg + ir.ui.view + url + /website_blog/static/src/img/library/chain.jpg + + + + Wood Wall Texture + woodtexture.jpg + ir.ui.view + url + /website_blog/static/src/img/library/woodtexture.jpg + + + + Gauze Green Texture + gauze-green-texture.jpg + ir.ui.view + url + /website_blog/static/src/img/library/gauze-green-texture.jpg + + + + Special Flower Texture + flower_texture.jpg + ir.ui.view + url + /website_blog/static/src/img/library/flower_texture.jpg + + + + Sad Danbo + sad_danbo.jpg + ir.ui.view + url + /website_blog/static/src/img/library/sad_danbo.jpg + + diff --git a/addons/website_blog/data/website_blog_demo.xml b/addons/website_blog/data/website_blog_demo.xml index 838d8d5a1ce..6b24cf1a9a2 100644 --- a/addons/website_blog/data/website_blog_demo.xml +++ b/addons/website_blog/data/website_blog_demo.xml @@ -20,9 +20,11 @@ Odoo, email The Future of Emails - /website_blog/static/src/img/post1.jpg + {"background-image": "url(/website_blog/static/src/img/library/flower_texture.jpg)", "background-color": "oe_yellow" ,"opacity": "1.0", "resize_class": "cover container cover_narrow"}
+

Emails are broken.

@@ -110,6 +112,7 @@

+ ]]>
@@ -120,22 +123,20 @@ - /website_blog/static/src/img/post2.jpg + {"background-image": "url(/website/static/src/img/library/ship_sea.jpg)", "background-color": "oe_green" ,"opacity": "0.8", "resize_class": "cover cover_full"} - -
- -
-
-

- New Features Launched -

-

- To add to an already comprehensive set of Odoo +

+
+
+ +
+

New Features Launched

+ +

To add to an already comprehensive set of Odoo features, a website content management system (CMS or WMS) has been developed and a beta release is - available from today, 31st January 2014. -

+ available from today, 31st January 2014.

+
diff --git a/addons/website_blog/models/website_blog.py b/addons/website_blog/models/website_blog.py index b63a77ac5ac..96ce3746d85 100644 --- a/addons/website_blog/models/website_blog.py +++ b/addons/website_blog/models/website_blog.py @@ -81,11 +81,18 @@ class BlogPost(osv.Model): res[blog_post.id] = blog_post.visits * (0.5+random.random()) / max(3, age.days) return res + def _default_content(self, cr, uid, context=None): + return '''
+
+

''' + _("Start writing here...") + '''

+
+
''' + _columns = { 'name': fields.char('Title', required=True, translate=True), 'subtitle': fields.char('Sub Title', translate=True), 'author_id': fields.many2one('res.partner', 'Author'), - 'background_image': fields.binary('Background Image', oldname='content_image'), + 'cover_properties': fields.text('Cover Properties'), 'blog_id': fields.many2one( 'blog.blog', 'Blog', required=True, ondelete='cascade', @@ -127,8 +134,9 @@ class BlogPost(osv.Model): } _defaults = { - 'name': _('Blog Post Title'), - 'subtitle': _('Subtitle'), + 'name': '', + 'content': _default_content, + 'cover_properties': '{"background-image": "none", "background-color": "oe_none", "opacity": "0.6", "resize_class": ""}', 'author_id': lambda self, cr, uid, ctx=None: self.pool['res.users'].browse(cr, uid, uid, context=ctx).partner_id.id, } @@ -163,7 +171,7 @@ class BlogPost(osv.Model): old_attribute = node.get(attribute) new_attribute = old_attribute - if old_attribute in existing_attributes: + if not new_attribute or (old_attribute in existing_attributes): if ancestor_tags: ancestor_tags.pop() counter = random.randint(10000, 99999) diff --git a/addons/website_blog/static/src/css/website_blog.css b/addons/website_blog/static/src/css/website_blog.css index a5de001e013..ffbab0908f2 100644 --- a/addons/website_blog/static/src/css/website_blog.css +++ b/addons/website_blog/static/src/css/website_blog.css @@ -15,6 +15,9 @@ margin-right: auto; } +.blog_content { + min-height: 350px !important; +} .blog_content a.oe_mail_expand:after { content: " →"; } @@ -32,43 +35,50 @@ div#blog_angle_down a:hover { } .cover { - -webkit-background-size: cover; - -moz-background-size: cover; - -o-background-size: cover; - background-size: cover; - background-position: center; - background-repeat: no-repeat; - background-color: #546579; color: white; position: relative; } .cover .blog_title { position: absolute; +} +.blog_title { text-align: center; + margin-right: auto; + margin-left: auto; top: 20%; left: 0; right: 0; } -.cover .blog_title h1 { +.blog_title h1{ font-weight: bold; } -.cover_footer { +.cover_full { + height: 100vh; +} +.cover_narrow { + height: 50vh; +} +.cover_footer_bg { min-height: 350px; height: 65vh; - cursor: pointer; } /* mobile preview: for blog h1,h2 font-size and cover-footer height of image overlapas */ @media (max-width: 768px) { - .cover h1 { + .blog_title h1 { font-size: 26px; } - .cover h2 { + .blog_title h2 { font-size: 20px; } - - .cover_footer { + .cover_narrow { + height: 65vh; + } + #title .blog_title { + top: 10%; + } + .cover_footer_bg { min-height: 280px; height: 50vh; } @@ -164,10 +174,29 @@ div#blog_angle_down a:hover { font-weight: normal; } -mark + .popover { +mark + .popover, .cover_footer{ cursor: pointer; } .discussion_scroll_post { overflow-x: auto; } + +.blog_publish_btn { + padding-top: 16px; +} + +.cover_footer_bg[style*="background-image: none;"] { + background-color: #B8B8B8; +} + +#js_blogcover { + background-blend-mode: multiply; + -webkit-background-size: cover; + -moz-background-size: cover; + -o-background-size: cover; + background-size: cover; + background-position: center; + background-repeat: no-repeat; + height: 100%; +} diff --git a/addons/website_blog/static/src/css/website_blog.sass b/addons/website_blog/static/src/css/website_blog.sass index e29995ad9b4..b090ef55fe5 100644 --- a/addons/website_blog/static/src/css/website_blog.sass +++ b/addons/website_blog/static/src/css/website_blog.sass @@ -15,6 +15,7 @@ margin-right: auto .blog_content + min-height: 350px !important a.oe_mail_expand:after content: " →" a.oe_mail_expand @@ -29,39 +30,53 @@ div#blog_angle_down text-decoration: none .cover - -webkit-background-size: cover - -moz-background-size: cover - -o-background-size: cover - background-size: cover - background-position: center - background-repeat: no-repeat - background-color: #546579 - color: #fff + color: white position: relative .blog_title position: absolute + +.blog_title text-align: center top: 20% + margin-right: auto + margin-left: auto left: 0 right: 0 h1 font-weight: bold -.cover_footer - min-height : 350px +.cover_full + height: 100vh + +.cover_narrow + height: 50vh + +.cover_footer_bg + min-height: 350px height: 65vh - cursor: pointer /* mobile preview: for blog h1,h2 font-size and cover-footer height of image overlapas */ @media (max-width: 768px) - .cover + .blog_title h1 font-size: 26px + + .blog_title h2 font-size: 20px + + .cover_narrow + height: 65vh + + #title + .blog_title + top: 10% + .cover_footer min-height: 280px height: 50vh + + .cover_footer .blog_title top: 2% @@ -145,8 +160,24 @@ div#blog_angle_down overflow: auto font-weight: normal -mark + .popover +mark + .popover, .cover_footer cursor: pointer .discussion_scroll_post overflow-x: auto + +.blog_publish_btn + padding-top: 16px + +.cover_footer_bg[style*="background-image: none;"] + background-color: #B8B8B8 + +#js_blogcover + background-blend-mode: multiply + -webkit-background-size: cover + -moz-background-size: cover + -o-background-size: cover + background-size: cover + background-position: center + background-repeat: no-repeat + height: 100% diff --git a/addons/website_blog/static/src/img/library/chain.jpg b/addons/website_blog/static/src/img/library/chain.jpg new file mode 100644 index 00000000000..194937e94e3 Binary files /dev/null and b/addons/website_blog/static/src/img/library/chain.jpg differ diff --git a/addons/website_blog/static/src/img/library/flower_texture.jpg b/addons/website_blog/static/src/img/library/flower_texture.jpg new file mode 100644 index 00000000000..d1e5ce2123f Binary files /dev/null and b/addons/website_blog/static/src/img/library/flower_texture.jpg differ diff --git a/addons/website_blog/static/src/img/library/gauze-green-texture.jpg b/addons/website_blog/static/src/img/library/gauze-green-texture.jpg new file mode 100644 index 00000000000..2a0db5157f9 Binary files /dev/null and b/addons/website_blog/static/src/img/library/gauze-green-texture.jpg differ diff --git a/addons/website_blog/static/src/img/library/sad_danbo.jpg b/addons/website_blog/static/src/img/library/sad_danbo.jpg new file mode 100644 index 00000000000..85959accbd9 Binary files /dev/null and b/addons/website_blog/static/src/img/library/sad_danbo.jpg differ diff --git a/addons/website_blog/static/src/img/library/woodtexture.jpg b/addons/website_blog/static/src/img/library/woodtexture.jpg new file mode 100644 index 00000000000..7001a64f14b Binary files /dev/null and b/addons/website_blog/static/src/img/library/woodtexture.jpg differ diff --git a/addons/website_blog/static/src/js/website.tour.blog.js b/addons/website_blog/static/src/js/website.tour.blog.js index f6ebfd7f21c..2e46b99c43e 100644 --- a/addons/website_blog/static/src/js/website.tour.blog.js +++ b/addons/website_blog/static/src/js/website.tour.blog.js @@ -27,12 +27,6 @@ content: _t("Select this menu item to create a new blog post."), popover: { fixed: true }, }, - { - element: '.modal-dialog:has(#editor_new_blog) button.btn-primary', - placement: 'right', - title: _t("Create Blog Post"), - content: _t("Click Continue to create the blog post."), - }, { waitFor: '#o_scroll .oe_snippet', title: _t("Blog Post Created"), @@ -41,51 +35,87 @@ }, { element: 'h1[data-oe-expression="blog_post.name"]', - placement: 'bottom', - sampleText: 'New Blog', - title: _t("Set a Title"), - content: _t("Click on this area and set a catchy title for your blog post."), - }, - { - waitNot: '#wrap h1[data-oe-model="blog.post"]:contains("Blog Post Title")', - snippet: '#snippet_structure .oe_snippet:eq(2)', - placement: 'bottom', - title: _t("Drag & Drop a Block"), - content: _t("Drag this block and drop it in your page."), - popover: { fixed: true }, - }, - { - snippet: '#snippet_structure .oe_snippet:eq(4)', - placement: 'bottom', - title: _t("Drag & Drop a block"), - content: _t("Drag this block and drop it below the image block."), - popover: { fixed: true }, - }, - { - element: '.oe_active .oe_snippet_remove', placement: 'top', - title: _t("Delete the block"), - content: _t("From this toolbar you can move, duplicate or delete the selected zone. Click on the garbage can image to delete the block. Or click on the Title and delete it."), + title: _t("Post Headline"), + sampleText:'Blog Post Title', + content: _t("Write a title, the subtitle is optional."), + popover: { fixed: true }, }, { - waitNot: '.oe_active .oe_snippet_remove:visible', + waitNot: '#wrap h1[data-oe-expression="blog_post.name"]:'+'containsExact("")', + element: '#oe_manipulators .oe_overlay.oe_active a.btn.btn-primary.btn-sm', + placement: 'left', + title: _t("Customize Cover"), + content: _t("Change and customize your blog post cover"), + popover: { fixed: true }, + }, + { + element: 'a:'+ 'containsExact(' + _t("Change Cover")+ '):eq(1)', + placement: 'left', + title: _t("Cover"), + content: _t("Select this menu item to change blog cover."), + popover: { fixed: true }, + }, + { + waitFor: '.modal:has(.existing-attachment-cell:nth(1))', + element: '.modal .existing-attachment-cell:nth(1) img', + placement: 'top', + title: _t("Choose an image"), + content: _t("Choose an image from the library."), + popover: { fixed: true }, + }, + { + waitFor: '.existing-attachment-cell.media_selected', + element: '.modal-content button.save', + placement: 'top', + title: _t("Save"), + content: _t("Click on 'Save' to set the picture as cover."), + popover: { fixed: true }, + }, + { + waitNot: '.modal-content:visible', + element: '.blog_content section.mt16', + placement: 'top', + title: _t("Content"), + content: _t("Start writing your story here. Click on save in the upper left corner when you are done."), + sampleText: ' ', + popover: { fixed: true }, + }, + { + waitNot: '.blog_content section.mt16 p:'+'containsExact('+_t('Start writing here...')+')', element: 'button[data-action=save]', placement: 'right', title: _t("Save Your Blog"), - content: _t("Click the Save button to record changes on the page."), + content: _t("Click on 'Save' button to record changes on the page."), popover: { fixed: true }, }, { - waitFor: '#website-top-edit:hidden', - element: 'button.btn-danger.js_publish_btn', + waitFor: 'button[data-action=save]:not(:visible)', + element: 'a[data-action=show-mobile-preview]', placement: 'bottom', - title: _t("Publish Your Post"), - content: _t("Your blog post is not yet published. You can update this draft version and publish it once you are ready."), + title: _t("Mobile Preview"), + content: _t("Click on the mobile icon to preview how your blog post will be displayed on a mobile device."), + popover: { fixed: true }, + }, + { + element: '.modal:has(#mobile-viewport) button[data-dismiss=modal]', + placement: 'right', + title: _t("Check Mobile Preview"), + content: _t("Scroll to check rendering and then close the mobile preview."), + popover: { fixed: true }, + }, + { + waitFor: '.modal:has(#mobile-viewport) button[data-dismiss=modal]:not(:visible)', + element: 'button.btn-danger.js_publish_btn', + placement: 'top', + title: _t("Publishing status"), + content: _t(" Click on this button to send your blog post online."), + popover: { fixed: true }, }, { waitFor: '.js_publish_management button.js_publish_btn.btn-success:visible', title: "Thanks!", - content: _t("This tutorial is finished. To discover more features, improve the content of this page and try the Promote button in the top right menu."), + content: _t("This tutorial is over. To discover more features and improve the content of this page, go to the upper right customize menu. You can also add some cool content with your text by clicking on 'Insert Blocks' in the edit mode."), popover: { next: _t("Close Tutorial") }, }, ] 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 b173a7fa35a..af14bc2f5ea 100644 --- a/addons/website_blog/static/src/js/website_blog.editor.js +++ b/addons/website_blog/static/src/js/website_blog.editor.js @@ -5,17 +5,23 @@ var _t = openerp._t; website.EditorBarContent.include({ - new_blog_post: function() { - website.prompt({ - id: "editor_new_blog", - window_title: _t("New Blog Post"), - select: "Select Blog", - init: function (field) { - return website.session.model('blog.blog') - .call('name_search', [], { context: website.get_context() }); - }, - }).then(function (cat_id) { - document.location = '/blog/' + cat_id + '/post/new'; + new_blog_post: function () { + website.session.model('blog.blog').call('name_search', [], { context: website.get_context() }) + .then(function (blog_ids) { + if (blog_ids.length == 1) { + document.location = '/blog/' + blog_ids[0][0] + '/post/new'; + } else if (blog_ids.length > 1) { + website.prompt({ + id: "editor_new_blog", + window_title: _t("New Blog Post"), + select: "Select Blog", + init: function (field) { + return blog_ids; + }, + }).then(function (blog_id) { + document.location = '/blog/' + blog_id + '/post/new'; + }); + } }); }, }); @@ -26,20 +32,32 @@ edit: function () { var self = this; $('.popover').remove(); + $('.cover_footer').off('click'); this._super(); - var vHeight = $(window).height(); }, - save : function() { - var res = this._super(); - if ($('.cover').length) { + save : function () { + var args = arguments; + var super_call = this._super; + var self = this; + if ($('#js_blogcover').length) { + var properties = { + "background-image": $('#js_blogcover').css("background-image").replace(/"/g, ''), + "background-color": $('#js_blogcover').attr("class"), + "opacity": $('#js_blogcover').css("opacity"), + "resize_class": $('#title').attr('class'), + }; openerp.jsonRpc("/blog/post_change_background", 'call', { - 'post_id' : $('#blog_post_name').attr('data-oe-id'), - 'image' : $('.cover').css('background-image').replace(/url\(|\)|"|'/g,''), + 'post_id' : $('h1[data-oe-expression="blog_post.name"]').attr('data-oe-id'), + 'cover_properties' : JSON.stringify(properties), + }).always(function() { + super_call.apply(self, args); }); + } else { + super_call.apply(self, args); } - return res; }, }); + website.snippet.options.many2one.include({ select_record: function (li) { var self = this; @@ -66,7 +84,8 @@ clear : function(type, value, $li) { if (type !== 'click') return; this.src = null; - this.$target.css({"background-image": '', 'min-height': $(window).height()}); + this.$target.find('#js_blogcover').css({"background-image": '', "opacity": "1.0"}).attr("class", "oe_none"); + this.$target.attr("class", ""); this.$image.removeAttr("src"); }, change : function(type, value, $li) { @@ -76,9 +95,33 @@ editor.appendTo('body'); editor.on('saved', self, function (event, img) { var url = self.$image.attr('src'); - self.$target.css({"background-image": url ? 'url(' + url + ')' : "", 'min-height': $(window).height()}); + self.$target.find('#js_blogcover').css({"background-image": url ? 'url(' + url + ')' : ""}); + self.$target.attr("class","cover cover_full"); + this.$el.parent().find('.snippet-option-website_blog:not(li[data-change])').removeClass("hidden"); }); }, + cover_class : function(type, value, $li) { + this.$target.attr("class", (type === 'over' || type === 'click') ? value : this.class); + }, + opacity : function(type, value, $li) { + this.$target.find('#js_blogcover').css("opacity", (type === 'over' || type === 'click') ? value : this.value); + }, + bgcolor : function(type, value, $li) { + this.$target.find('#js_blogcover').attr("class", (type === 'over' || type === 'click') ? value : this.background); + }, + set_active: function(){ + this.background = this.$target.find('#js_blogcover').attr("class"); + this.class = this.$target.attr('class'); + this.value = this.$target.find('#js_blogcover').css('opacity'); + if ( this.$target.hasClass("cover") ) { + this.$el.parent().find('.snippet-option-website_blog:not(li[data-change])').removeClass("hidden"); + } else { + this.$el.parent().find('.snippet-option-website_blog:not(li[data-change])').addClass("hidden"); + } + this.$el.find('li[data-bgcolor]').removeClass("active").siblings('[data-bgcolor="' + this.background + '"]').addClass("active"); + this.$el.find('li[data-opacity]').removeClass("active").siblings('[data-opacity="' + parseFloat(this.value).toFixed(1) + '"]').addClass("active"); + this.$el.find('li[data-cover_class]').removeClass("active").siblings('[data-cover_class="' + this.class + '"]').addClass("active"); + } }); openerp.define.active(); @@ -99,4 +142,4 @@ }); -})(); \ No newline at end of file +})(); diff --git a/addons/website_blog/static/src/js/website_blog.js b/addons/website_blog/static/src/js/website_blog.js index c811677b799..283f83461ce 100644 --- a/addons/website_blog/static/src/js/website_blog.js +++ b/addons/website_blog/static/src/js/website_blog.js @@ -32,9 +32,8 @@ $(document).ready(function() { }); } - $('.js_fullheight').css('min-height', $(window).height()); - $(".js_tweet").share({'author_name':$('#blog_author').text()}); - $('.cover_footer').on('click',page_transist); + $(".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/snippets.xml b/addons/website_blog/views/snippets.xml index 7b45d75d427..e7cddf5b9b5 100644 --- a/addons/website_blog/views/snippets.xml +++ b/addons/website_blog/views/snippets.xml @@ -5,11 +5,38 @@
-
  • Change Cover
  • -
  • Clear Cover
  • +
  • Change Cover
  • + + + +
  • No Cover
  • diff --git a/addons/website_blog/views/website_blog_templates.xml b/addons/website_blog/views/website_blog_templates.xml index 0dc46173502..b4f6d14e3ee 100644 --- a/addons/website_blog/views/website_blog_templates.xml +++ b/addons/website_blog/views/website_blog_templates.xml @@ -133,36 +133,34 @@
    - -

    - -

    - -
    -

    -
    - + + +

    Untitled Post

    +
    +
    +

    +
    + -   - -   - comment - comments - - -   - view - views - +   + +   + comment + comments + + +   + view + views + - not published + not published +
    -
    -

    @@ -187,74 +185,74 @@