[FIX] website: snippet: continue slide cycling when the user edit the content
authorChristophe Matthieu <chm@openerp.com>
Fri, 28 Feb 2014 09:55:31 +0000 (10:55 +0100)
committerChristophe Matthieu <chm@openerp.com>
Fri, 28 Feb 2014 09:55:31 +0000 (10:55 +0100)
bzr revid: chm@openerp.com-20140228095531-8c735qyacmffryno

addons/website/static/src/js/website.snippets.animation.js
addons/website/static/src/js/website.snippets.editor.js
addons/website/views/website_templates.xml

index bc2ea06..f1d1912 100644 (file)
         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({
index a01d760..8414196 100644 (file)
         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();
             });
 
                 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();
             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 () {
index 96e184a..a8ed626 100644 (file)
@@ -80,8 +80,8 @@
 
             <script type="text/javascript" src="/website/static/src/js/website.js"></script>
             
-            <script type="text/javascript" src="/website/static/lib/bootstrap/js/bootstrap.js"></script>
             <script t-if="not translatable" type="text/javascript" src="/website/static/src/js/website.snippets.animation.js"></script>
+            <script type="text/javascript" src="/website/static/lib/bootstrap/js/bootstrap.js"></script>
 
             <t t-raw="head or ''" name='layout_head'/>
         </head>