summaryrefslogtreecommitdiff
path: root/addons/website/static/src
diff options
context:
space:
mode:
authorFrédéric van der Essen <fva@openerp.com>2013-09-02 11:10:05 +0200
committerFrédéric van der Essen <fva@openerp.com>2013-09-02 11:10:05 +0200
commitc5fa23bffa8ccbc3db6a88be822c4f9209701ffc (patch)
tree4a54872ef832a0f20fea2f5fa45ef46c22b68a16 /addons/website/static/src
parentae1687c6ab89f15ef95c479ac42f71a714c62e98 (diff)
[IMP] website editor: allow click trough on snippet manipulators
bzr revid: fva@openerp.com-20130902091005-pnhb05fxk29z5q0r
Diffstat (limited to 'addons/website/static/src')
-rw-r--r--addons/website/static/src/css/editor.css38
-rw-r--r--addons/website/static/src/css/editor.sass32
-rw-r--r--addons/website/static/src/js/website.js38
-rw-r--r--addons/website/static/src/xml/website.xml4
4 files changed, 99 insertions, 13 deletions
diff --git a/addons/website/static/src/css/editor.css b/addons/website/static/src/css/editor.css
index 8a20e94bec0..3e678efe612 100644
--- a/addons/website/static/src/css/editor.css
+++ b/addons/website/static/src/css/editor.css
@@ -96,6 +96,7 @@
line-height: 120px;
color: white;
text-shadow: 0px 1px 2px rgba(0, 0, 0, 0.95);
+ box-shadow: 0px 0px 0px 1px rgba(255, 255, 255, 0.07) inset;
}
.oe_snippet .oe_snippet_body {
display: none;
@@ -161,31 +162,56 @@
.oe_snippet_manipulator {
display: block;
position: absolute;
- background: rgba(153, 0, 255, 0.1);
+ background: transparent;
border-radius: 3px;
- border: solid 1px rgba(153, 0, 255, 0.5);
opacity: 0;
transition: opacity 100ms linear;
+ box-sizing: border-box;
}
.oe_snippet_manipulator > .oe_handle {
display: none;
}
-.oe_snippet_manipulator:hover, .oe_snippet_manipulator.oe_hover {
+.oe_snippet_manipulator.oe_hover {
opacity: 1;
+ cursor: pointer;
}
-.oe_snippet_manipulator:hover > .oe_handle, .oe_snippet_manipulator.oe_hover > .oe_handle {
+.oe_snippet_manipulator.oe_selected {
+ opacity: 1;
+ pointer-events: none;
+ background: transparent;
+ border: solid 1px rgba(153, 0, 255, 0.5);
+}
+.oe_snippet_manipulator.oe_selected > * {
+ pointer-events: auto;
+}
+.oe_snippet_manipulator.oe_selected > .oe_handle {
display: block;
}
+.oe_snippet_manipulator .oe_buttons {
+ position: absolute;
+ right: 16px;
+ top: 16px;
+ background: #ad00ff;
+ color: white;
+ padding: 0px 2px;
+ border-radius: 3px;
+}
+.oe_snippet_manipulator .oe_buttons .oe_icon {
+ display: inline-block;
+ padding: 8px;
+ cursor: pointer;
+}
.oe_handle {
+ pointer-events: auto;
position: absolute;
top: 50%;
left: 50%;
display: block;
background: white;
- border: solid 1px rgba(153, 0, 255, 0.5);
+ border: solid 1px #9900ff;
box-sizing: border-box;
- border-radius: 2px;
+ border-radius: 8px;
width: 16px;
height: 16px;
margin: -8px;
diff --git a/addons/website/static/src/css/editor.sass b/addons/website/static/src/css/editor.sass
index 29621f95e4b..feb7432821c 100644
--- a/addons/website/static/src/css/editor.sass
+++ b/addons/website/static/src/css/editor.sass
@@ -89,6 +89,7 @@
line-height: 120px
color: white
text-shadow: 0px 1px 2px rgba(0, 0, 0, 0.95)
+ box-shadow: 0px 0px 0px 1px rgba(255, 255, 255, 0.07) inset
.oe_snippet_body
display: none
@@ -146,27 +147,48 @@
.oe_snippet_manipulator
display: block
position: absolute
- background: rgba(153, 0, 255, 0.1)
+ background: transparent //rgba(153, 0, 255, 0.05)
border-radius: 3px
- border: solid 1px rgba(153, 0, 255, 0.5)
opacity: 0
transition: opacity 100ms linear
+ box-sizing: border-box
& > .oe_handle
display: none
- &:hover,&.oe_hover
+ &.oe_hover
+ opacity: 1
+ cursor: pointer
+ &.oe_selected
opacity: 1
+ pointer-events: none
+ background: transparent
+ border: solid 1px rgba(153, 0, 255, 0.5)
+ & > *
+ pointer-events: auto
& > .oe_handle
display: block
+ .oe_buttons
+ position: absolute
+ right: 16px
+ top: 16px
+ background: rgb(173, 0, 255)
+ color: white
+ padding: 0px 2px
+ border-radius: 3px
+ .oe_icon
+ display: inline-block
+ padding: 8px
+ cursor: pointer
.oe_handle
+ pointer-events: auto
position: absolute
top: 50%
left: 50%
display: block
background: rgba(255, 255, 255, 1)
- border: solid 1px rgba(153, 0, 255, 0.5)
+ border: solid 1px rgba(153, 0, 255, 1)
box-sizing: border-box
- border-radius: 2px
+ border-radius: 8px
width: 16px
height: 16px
margin: -8px
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();
diff --git a/addons/website/static/src/xml/website.xml b/addons/website/static/src/xml/website.xml
index 37a3bc453f3..ab2f622429c 100644
--- a/addons/website/static/src/xml/website.xml
+++ b/addons/website/static/src/xml/website.xml
@@ -69,6 +69,10 @@
<t t-name="website.snippet_manipulator">
<div class='oe_snippet_manipulator'>
+ <div class='oe_buttons'>
+ <i class='icon-move oe_icon js_move'></i>
+ <i class='icon-remove oe_icon js_remove'></i>
+ </div>
<div class='oe_handle n'></div>
<div class='oe_handle ne'></div>
<div class='oe_handle e'></div>