From f8d5a6727d3e8d428d9bef93da7ba6b11f344284 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Wed, 1 Oct 2014 18:46:13 +0200 Subject: [FIX] website: repair compatibility with 8.0rc1 carousel (banner) snippets that may be present in existing pages --- .../website/static/src/js/website.snippets.editor.js | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'addons/website/static/src/js/website.snippets.editor.js') diff --git a/addons/website/static/src/js/website.snippets.editor.js b/addons/website/static/src/js/website.snippets.editor.js index b6e3919b9d4..dc1c78251a2 100644 --- a/addons/website/static/src/js/website.snippets.editor.js +++ b/addons/website/static/src/js/website.snippets.editor.js @@ -1003,7 +1003,19 @@ this.$target.find('.carousel-control, .carousel-indicators').removeClass("hidden"); this.$indicators.append('
  • '); - var $clone = this.$target.find(".item.active").clone(); + // clone the best candidate from template to use new features + var $snippets = this.BuildingBlock.$snippets.find('.oe_snippet_body.carousel'); + var point = 0; + var selection; + var className = _.compact(this.$target.attr("class").split(" ")); + $snippets.each(function () { + var len = _.intersection(_.compact(this.className.split(" ")), className).length; + if (len > point) { + point = len; + selection = this; + } + }); + var $clone = $(selection).find('.item:first').clone(); // insert $clone.removeClass('active').insertAfter($active); @@ -1115,10 +1127,10 @@ var self = this; this.$target.find('.carousel-control').off('click').on('click', function () { self.$target.carousel( $(this).data('slide')); }); - - this.$target.find('.carousel-image, .carousel-inner .content > div').attr('contentEditable', 'true'); - this.$target.find('.carousel-image').attr('attributeEditable', 'true'); this._super(); + + /* Fix: backward compatibility saas-3 */ + this.$target.find('.item.text_image .container').find('> .carousel-caption > div, > img.carousel-image').attr('contentEditable', 'true'); }, }); -- cgit v1.2.3