[FIX] website: snippet overlay position

bzr revid: chm@openerp.com-20140312130939-6k15igo39ybuu81s
This commit is contained in:
chm@openerp.com
2014-03-12 14:09:39 +01:00
parent 4d125a3b52
commit d6fc0c259e
4 changed files with 23 additions and 21 deletions
+4 -1
View File
@@ -345,7 +345,10 @@
box-shadow: 0 0 5px 3px rgba(255, 255, 255, 0.7);
}
.oe_overlay .oe_handle.readonly {
content: "";
cursor: auto !important;
}
.oe_overlay .oe_handle.readonly:before, .oe_overlay .oe_handle.readonly.size {
display: none !important;
}
.oe_overlay .icon.btn {
display: inline-block;
+3 -1
View File
@@ -253,7 +253,9 @@
color: #fff
+box-shadow(0 0 5px 3px rgba(255,255,255,.7))
&.readonly
content: ""
cursor: auto !important
&:before, &.size
display: none !important
.icon.btn
display: inline-block
@@ -180,10 +180,10 @@
'top': pos.top - mt - 5,
'left': pos.left
});
$el.find(">.e,>.w").css({'height': $target.outerHeight() + mt + mb+1});
$el.find(">.s").css({'top': $target.outerHeight() + mt + mb});
$el.find(">.size").css({'top': $target.outerHeight() + mt});
$el.find(">.s,>.n").css({'width': $target.outerWidth()-2});
$el.find(".oe_handle.e,.oe_handle.w").css({'height': $target.outerHeight() + mt + mb+1});
$el.find(".oe_handle.s").css({'top': $target.outerHeight() + mt + mb});
$el.find(".oe_handle.size").css({'top': $target.outerHeight() + mt});
$el.find(".oe_handle.s,.oe_handle.n").css({'width': $target.outerWidth()-2});
},
show: function () {
this.$el.removeClass("hidden");
@@ -969,16 +969,13 @@
start: function () {
var self = this;
this._super();
var $box = $(openerp.qweb.render("website.snippets.resize"));
var resize_values = this.getSize();
if (!resize_values.n) $box.find(".oe_handle.n").remove();
if (!resize_values.s) $box.find(".oe_handle.s").remove();
if (!resize_values.e) $box.find(".oe_handle.e").remove();
if (!resize_values.w) $box.find(".oe_handle.w").remove();
if (!resize_values.size) $box.find(".oe_handle.size").remove();
this.$overlay.append($box.find(".oe_handles").html());
if (resize_values.n) this.$overlay.find(".oe_handle.n").removeClass("readonly");
if (resize_values.s) this.$overlay.find(".oe_handle.s").removeClass("readonly");
if (resize_values.e) this.$overlay.find(".oe_handle.e").removeClass("readonly");
if (resize_values.w) this.$overlay.find(".oe_handle.w").removeClass("readonly");
if (resize_values.size) this.$overlay.find(".oe_handle.size").removeClass("readonly");
this.$overlay.find(".oe_handle:not(:has(.oe_handle_button)), .oe_handle .oe_handle_button").on('mousedown', function (event){
event.preventDefault();
@@ -34,6 +34,13 @@
<a href="#" class="btn btn-default btn-sm oe_snippet_remove" title="Remove Block">&amp;nbsp;<i class="fa fa-trash-o"></i>&amp;nbsp; </a>
</div>
</div>
<div class='oe_handles'>
<div class='oe_handle n readonly'><div></div></div>
<div class='oe_handle e readonly'><div></div></div>
<div class='oe_handle w readonly'><div></div></div>
<div class='oe_handle size readonly'><div class="oe_handle_button size">Resize</div></div>
<div class='oe_handle s readonly'><div></div></div>
</div>
</div>
</t>
@@ -45,13 +52,6 @@
<div t-name="website.snippets.resize" data-snippet-id='resize'>
<!-- custom data for the widget -->
<div class='oe_handles'>
<div class='oe_handle n'><div></div></div>
<div class='oe_handle e'><div></div></div>
<div class='oe_handle w'><div></div></div>
<div class='oe_handle size'><div class="oe_handle_button size">Resize</div></div>
<div class='oe_handle s'><div></div></div>
</div>
<div class='oe_snippet_thumbnail'>Margin resize</div>
</div>