[IMP] website snippets: add slide for banner with an other background of the active...
authorChristophe Matthieu <chm@openerp.com>
Tue, 15 Oct 2013 14:56:54 +0000 (16:56 +0200)
committerChristophe Matthieu <chm@openerp.com>
Tue, 15 Oct 2013 14:56:54 +0000 (16:56 +0200)
bzr revid: chm@openerp.com-20131015145654-294fik4do6lh85vr

addons/website/static/src/js/website.snippets.js

index e4e41e8..6cd135a 100644 (file)
 
             // select in ul options
             $ul.find("li").removeClass("active");
-            var selected = $ul.find('[data-value="' + bg_value + '"], [data-value="' + bg_value.replace(/.*:\/\/[^\/]+/, '') + '"]');
+            var selected = $ul.find('[data-value="' + bg_value + '"], [data-value="' + bg_value.replace(/.*:\/\/[^\/]+|\)$/g, '') + '"]');
             selected.addClass('active');
             if (!selected.length) {
                 $ul.find('.oe_custom_bg b').html(bg_value);
             var index = $active.index();
             this.$target.find('.carousel-control, .carousel-indicators').removeClass("hidden");
             this.$indicators.append('<li data-target="#' + this.id + '" data-slide-to="' + cycle + '"></li>');
-            $active.clone().removeClass('active').insertAfter($active);
+            
+            var $clone = this.$el.find(".item.active").clone();
+            var bg = this.$editor.find('ul[name="carousel-background"] li:not([data-value="'+ $active.css("background-image").replace(/.*:\/\/[^\/]+|\)$/g, '') +'"]):first').data("value");
+            $clone.css("background-image", "url('"+ bg +"')");
+            $clone.removeClass('active').insertAfter($active);
             this.$target.carousel().carousel(++index);
         },
         on_remove: function (e) {