From c11f4f9352aea4ed9febae82fab8f2e91ad9f8cd Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Fri, 28 Feb 2014 10:55:31 +0100 Subject: [PATCH] [FIX] website: snippet: continue slide cycling when the user edit the content bzr revid: chm@openerp.com-20140228095531-8c735qyacmffryno --- .../static/src/js/website.snippets.animation.js | 4 ++++ .../website/static/src/js/website.snippets.editor.js | 12 +++++++++--- addons/website/views/website_templates.xml | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/addons/website/static/src/js/website.snippets.animation.js b/addons/website/static/src/js/website.snippets.animation.js index bc2ea064731..f1d19125a0c 100644 --- a/addons/website/static/src/js/website.snippets.animation.js +++ b/addons/website/static/src/js/website.snippets.animation.js @@ -64,6 +64,10 @@ start: function () { this.$target.carousel({interval: 10000}); }, + stop: function () { + this.$target.carousel('pause'); + this.$target.removeData("bs.carousel"); + }, }); website.snippet.animationRegistry.parallax = website.snippet.Animation.extend({ diff --git a/addons/website/static/src/js/website.snippets.editor.js b/addons/website/static/src/js/website.snippets.editor.js index a01d7605851..8414196b696 100644 --- a/addons/website/static/src/js/website.snippets.editor.js +++ b/addons/website/static/src/js/website.snippets.editor.js @@ -19,12 +19,11 @@ edit: function () { var self = this; $("body").off('click'); + website.snippet.stop_animation(); window.snippets = this.snippets = new website.snippet.BuildingBlock(this); this.snippets.appendTo(this.$el); - this.on('rte:ready', this, function () { self.snippets.$button.removeClass("hidden"); - website.snippet.stop_animation(); website.snippet.start_animation(); }); @@ -1305,6 +1304,14 @@ this.$target.find(".item:first").addClass("active"); } }, + onFocus : function () { + this._super(); + this.$target.carousel('pause'); + }, + onBlur : function () { + this._super(); + this.$target.carousel('cycle'); + }, start : function () { var self = this; this._super(); @@ -1315,7 +1322,6 @@ this.$editor.find(".js_add").on('click', function () {self.on_add_slide(); return false;}); this.$editor.find(".js_remove").on('click', function () {self.on_remove_slide(); return false;}); - this.$target.carousel('pause'); this.rebind_event(); }, on_add_slide: function () { diff --git a/addons/website/views/website_templates.xml b/addons/website/views/website_templates.xml index 96e184a32a1..a8ed626866d 100644 --- a/addons/website/views/website_templates.xml +++ b/addons/website/views/website_templates.xml @@ -80,8 +80,8 @@ - +