From 7ffc2916ee8c5a6c97ebb66d1aa59da05f71838c Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Wed, 28 Oct 2015 14:36:31 +0100 Subject: [PATCH] [FIX] website: slide position gallery snippet Changing position of a slide from the gallery snippet was not working. saas-6 part of #9284 opw-653061 opw-653167 --- addons/website/static/src/js/website.snippets.gallery.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/website/static/src/js/website.snippets.gallery.js b/addons/website/static/src/js/website.snippets.gallery.js index dede9e07969..2d57211b51c 100644 --- a/addons/website/static/src/js/website.snippets.gallery.js +++ b/addons/website/static/src/js/website.snippets.gallery.js @@ -220,7 +220,7 @@ var $container = this.$target.find(".container:first"); var editor = new website.editor.MediaDialog(this.$target.closest('.o_editable'), null, {select_images: true}); editor.appendTo(document.body); - var index = Math.max(_.map(this.$target.find("img").get(), function (img) { return img.dataset.index | 0; })) + 1; + var index = Math.max(0, _.max(_.map(this.$target.find("img").get(), function (img) { return img.dataset.index | 0; })) + 1); editor.on('saved', this, function (attachments) { for (var i = 0 ; i < attachments.length; i++) { var img = $('') @@ -327,7 +327,6 @@ if (type !== "click") return; var $parent = this.$target.closest("section"); - this.BuildingBlock.create_overlay($parent); var editor = $parent.data('snippet-editor').styles.gallery; var imgs = $parent.find('img').get(); imgs.sort(function (a,b) { return $(a).data('index')-$(b).data('index'); });