From b1fc013fae5f7dbc962f0fb04a2835db07efe83e Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Mon, 23 Sep 2013 11:51:22 +0200 Subject: [PATCH] [IMP] website snippet: add drop zone for end of table bzr revid: chm@openerp.com-20130923095122-vnaaw1z5jz0x3i37 --- .../website/static/src/js/website.snippets.js | 134 ++++++++++++------ .../static/src/xml/website.snippets.xml | 1 - 2 files changed, 92 insertions(+), 43 deletions(-) diff --git a/addons/website/static/src/js/website.snippets.js b/addons/website/static/src/js/website.snippets.js index 3457fbb66e2..8c432c2b282 100644 --- a/addons/website/static/src/js/website.snippets.js +++ b/addons/website/static/src/js/website.snippets.js @@ -28,6 +28,7 @@ return this._super.apply(this, arguments); }, save: function () { + this.snippets.make_active(false); remove_added_snippet_id(); this._super(); }, @@ -106,9 +107,11 @@ var $ul = this.parent.$("#website-top-edit ul"); - var $button = $(openerp.qweb.render('website.snippets_button')) - .click(function () {self.$el.toggleClass("hidden");}) - .prependTo($ul); + var $button = $(openerp.qweb.render('website.snippets_button')).prependTo($ul); + $button.find('button').click(function () { + self.make_active(false); + self.$el.toggleClass("hidden"); + }); this.fetch_snippet_templates(); @@ -626,8 +629,7 @@ // activate drag and drop for the snippets in the snippet toolbar _drag_and_drop: function(){ var self = this; - var dropped = false; - var $move = this.$overlay.find(".oe_snippet_move"); + this.dropped = false; this.$overlay.draggable({ greedy: true, appendTo: 'body', @@ -639,49 +641,67 @@ }, helper: function() { var $clone = $(this).clone().css({width: "24px", height: "24px", border: 0}); - $clone.find(".oe_overlay_options >:not(.oe_snippet_move), .oe_handle").remove(); + $clone.find(".oe_overlay_options >:not(:contains(.oe_snippet_move)), .oe_handle").remove(); $clone.find(":not(.glyphicon)").css({position: 'absolute', top: 0, left: 0}); - return $clone.appendTo("body").removeClass("hidden"); + $clone.appendTo("body").removeClass("hidden"); + return $clone; }, - start: function(){ - self.parent.hide(); - self.parent.editor_busy = true; - self.$target.after("