diff options
| author | Christophe Simonis <chs@odoo.com> | 2016-09-09 18:13:31 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2016-09-09 18:13:31 +0200 |
| commit | 298e2032ea3a8ef7aac3a606e2cbc420760fd4c9 (patch) | |
| tree | 0832a96998574fcb45148480bf22207a9bfef439 /addons/website/static/src | |
| parent | 75f60f69416625713819c810d2da33db4dc0b06c (diff) | |
| parent | 9f28139297af937990a79d4a3026ba25bb9be6fe (diff) | |
[MERGE] forward port branch saas-12 up to 9f28139
Diffstat (limited to 'addons/website/static/src')
| -rw-r--r-- | addons/website/static/src/js/website.snippets.editor.js | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/addons/website/static/src/js/website.snippets.editor.js b/addons/website/static/src/js/website.snippets.editor.js index fdbf4e2282a..808c3b43614 100644 --- a/addons/website/static/src/js/website.snippets.editor.js +++ b/addons/website/static/src/js/website.snippets.editor.js @@ -163,33 +163,29 @@ options.registry.slider = options.Class.extend({ return $clone; }, remove_slide: function (type) { - if(type !== "click") return; - - if (this.remove_process) { - return; - } + if (type !== "click" || this.remove_process) return; var self = this; - var cycle = this.$inner.find('.item').length - 1; - var index = this.$inner.find('.item.active').index(); + + var $items = this.$inner.find('.item'); + var cycle = $items.length - 1; + var $active = $items.filter('.active'); + var index = $active.index(); if (cycle > 0) { this.remove_process = true; - var $el = this.$inner.find('.item.active'); - self.$target.on('slid.bs.carousel', function (event) { - $el.remove(); + this.$target.on('slid.bs.carousel.slide_removal', function (event) { + $active.remove(); self.$indicators.find("li:last").remove(); - self.$target.off('slid.bs.carousel'); + self.$target.off('slid.bs.carousel.slide_removal'); self.rebind_event(); self.remove_process = false; if (cycle === 1) { - self.on_remove_slide(event); + self.$target.find('.carousel-control, .carousel-indicators').addClass("hidden"); } }); - setTimeout(function () { - self.$target.carousel( index > 0 ? --index : cycle ); - }, 500); - } else { - this.$target.find('.carousel-control, .carousel-indicators').addClass("hidden"); + _.defer(function () { + self.$target.carousel(index > 0 ? --index : cycle); + }); } }, interval : function (type, value) { @@ -217,18 +213,24 @@ options.registry.carousel = options.registry.slider.extend({ }, start : function () { var self = this; - this._super(); + this._super.apply(this, arguments); // set background and prepare to clean for save this.$target.on('slid.bs.carousel', function () { - if(self.editor && self.editor.styles.background) { - self.editor.styles.background.$target = self.$target.find(".item.active"); self.editor.styles.background_position.$target = self.editor.styles.background.$target; - self.editor.styles.background.set_active(); self.editor.styles.background_position.set_active(); self.editor.styles.background.$target.trigger("snippet-option-change", [self.editor.styles.background]); - } self.$target.carousel("pause"); + if (!self.editor) return; + + _.each(["background", "background_position", "colorpicker"], function (opt_name) { + var s_option = self.editor.styles[opt_name]; + if (!s_option) return; + + s_option.$target = self.$target.find(".item.active"); + s_option.set_active(); + s_option.$target.trigger("snippet-option-change", [s_option]); + }); }); this.$target.trigger('slid.bs.carousel'); }, |
