diff options
| author | Frédéric van der Essen <fva@openerp.com> | 2013-09-02 11:10:05 +0200 |
|---|---|---|
| committer | Frédéric van der Essen <fva@openerp.com> | 2013-09-02 11:10:05 +0200 |
| commit | c5fa23bffa8ccbc3db6a88be822c4f9209701ffc (patch) | |
| tree | 4a54872ef832a0f20fea2f5fa45ef46c22b68a16 /addons/website/static/src/js | |
| parent | ae1687c6ab89f15ef95c479ac42f71a714c62e98 (diff) | |
[IMP] website editor: allow click trough on snippet manipulators
bzr revid: fva@openerp.com-20130902091005-pnhb05fxk29z5q0r
Diffstat (limited to 'addons/website/static/src/js')
| -rw-r--r-- | addons/website/static/src/js/website.js | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/addons/website/static/src/js/website.js b/addons/website/static/src/js/website.js index 69797d44020..2969e52ff63 100644 --- a/addons/website/static/src/js/website.js +++ b/addons/website/static/src/js/website.js @@ -340,6 +340,9 @@ template: 'website.snippets', init: function () { this._super.apply(this, arguments); + if(!$('#oe_manipulators').length){ + $("<div id='oe_manipulators'></div>").appendTo('body'); + } }, start: function() { var self = this; @@ -549,7 +552,7 @@ var $target = $targets.eq(i); var $zone = $(zone_template); this.cover_target($zone,$target); - $zone.appendTo('body'); + $zone.appendTo('#oe_manipulators'); $zone.data('target',$target); } }, @@ -567,8 +570,13 @@ // activates the manipulator boxes (with resizing handles) for all snippets activate_snippet_manipulators: function(){ var self = this; + // we generate overlay drop zones only to get an idea of where the snippet are, the drop + // zones are replaced by manipulators this.activate_overlay_zones('#wrap .container'); + var $active_manipulator = null; + var locked = false; + $('.oe_drop_zone').each(function(){; var $zone = $(this); @@ -577,10 +585,35 @@ self.cover_target($manipulator, $zone); $manipulator.data('target',$snippet); - $manipulator.appendTo('body'); + $manipulator.appendTo('#oe_manipulators'); $zone.remove(); + $manipulator.mouseover(function(){ + if(!locked && $active_manipulator != $manipulator){ + if($active_manipulator){ + $active_manipulator.removeClass('oe_selected'); + } + $active_manipulator = $manipulator; + $manipulator.addClass('oe_selected'); + } + }); + /*$manipulator.mouseleave(function(){ + if(!locked && $active_manipulator){ + $active_manipulator.removeClass('oe_selected'); + $active_manipulator = null; + } + });*/ + /* + $manipulator.click(function(){ + if($active_manipulator === $manipulator){ + selected = !selected; + $manipulator.toggleClass('oe_selected',selected); + } + }); + */ + $manipulator.find('.oe_handle').mousedown(function(event){ + locked = true; var $handle = $(this); var x = event.pageX; var y = event.pageY; @@ -607,6 +640,7 @@ }); $('body').mouseup(function(){ + locked = false; $('body').unbind('mousemove'); $('body').unbind('mouseup'); self.deactivate_snippet_manipulators(); |
