diff options
| author | chm@openerp.com <> | 2014-03-12 14:09:39 +0100 |
|---|---|---|
| committer | chm@openerp.com <> | 2014-03-12 14:09:39 +0100 |
| commit | d6fc0c259e510a1608caca785f91cdb3bb3fdb76 (patch) | |
| tree | 671be7b2d4da617a92c84c336dd1158c64bc8010 | |
| parent | 4d125a3b52f6141736a7c125482f6e8dff3809e6 (diff) | |
[FIX] website: snippet overlay position
bzr revid: chm@openerp.com-20140312130939-6k15igo39ybuu81s
| -rw-r--r-- | addons/website/static/src/css/snippets.css | 5 | ||||
| -rw-r--r-- | addons/website/static/src/css/snippets.sass | 4 | ||||
| -rw-r--r-- | addons/website/static/src/js/website.snippets.editor.js | 21 | ||||
| -rw-r--r-- | addons/website/static/src/xml/website.snippets.xml | 14 |
4 files changed, 23 insertions, 21 deletions
diff --git a/addons/website/static/src/css/snippets.css b/addons/website/static/src/css/snippets.css index 48400b88d45..4121b70ef2e 100644 --- a/addons/website/static/src/css/snippets.css +++ b/addons/website/static/src/css/snippets.css @@ -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; diff --git a/addons/website/static/src/css/snippets.sass b/addons/website/static/src/css/snippets.sass index 0c4abe362e2..d7442a5b0f7 100644 --- a/addons/website/static/src/css/snippets.sass +++ b/addons/website/static/src/css/snippets.sass @@ -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 diff --git a/addons/website/static/src/js/website.snippets.editor.js b/addons/website/static/src/js/website.snippets.editor.js index f3c702e7be3..bc7c6db15d1 100644 --- a/addons/website/static/src/js/website.snippets.editor.js +++ b/addons/website/static/src/js/website.snippets.editor.js @@ -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(); diff --git a/addons/website/static/src/xml/website.snippets.xml b/addons/website/static/src/xml/website.snippets.xml index ae109139e3c..4a9769203ef 100644 --- a/addons/website/static/src/xml/website.snippets.xml +++ b/addons/website/static/src/xml/website.snippets.xml @@ -34,6 +34,13 @@ <a href="#" class="btn btn-default btn-sm oe_snippet_remove" title="Remove Block">&nbsp;<i class="fa fa-trash-o"></i>&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> |
