summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src
diff options
context:
space:
mode:
authorKishan Gajjar <kig@odoo.com>2017-08-17 11:35:12 +0530
committerqsm-odoo <qsm@odoo.com>2017-09-30 11:17:22 +0200
commit2a9605414b5b0d51bf4212c4dcfacb11ffc763cc (patch)
tree2d0c23d40456c376e3ad20043582c8789c8ccf75 /addons/web_editor/static/src
parent1a18eb64f4712317f3b5fc2b72a60c2431358c13 (diff)
[FIX] web_editor: open customize menus to the left/right
Open customize options menus to the left if there is not enough space on the right.
Diffstat (limited to 'addons/web_editor/static/src')
-rw-r--r--addons/web_editor/static/src/js/editor/snippets.options.js12
-rw-r--r--addons/web_editor/static/src/less/web_editor.ui.less5
2 files changed, 15 insertions, 2 deletions
diff --git a/addons/web_editor/static/src/js/editor/snippets.options.js b/addons/web_editor/static/src/js/editor/snippets.options.js
index afa1b77f3c1..fbcf364a057 100644
--- a/addons/web_editor/static/src/js/editor/snippets.options.js
+++ b/addons/web_editor/static/src/js/editor/snippets.options.js
@@ -298,8 +298,16 @@ var SnippetOption = Widget.extend({
* @param {Event} ev
*/
_onLinkEnter: function (ev) {
- var $li = $(ev.currentTarget).parent(':hasData');
- if (!$li.length) {
+ var $li = $(ev.currentTarget).parent();
+ if ($li.is('.dropdown-submenu')) {
+ var $menu = $li.children('.dropdown-menu');
+ if ($menu.length) {
+ var menuRightPosition = $li.offset().left + $li.outerWidth() + $menu.outerWidth();
+ $menu.toggleClass('o_open_to_left', menuRightPosition > $(window).outerWidth());
+ }
+ }
+
+ if (!$li.is(':hasData')) {
return;
}
this.__click = false;
diff --git a/addons/web_editor/static/src/less/web_editor.ui.less b/addons/web_editor/static/src/less/web_editor.ui.less
index a434f07fe54..1d59c4e2033 100644
--- a/addons/web_editor/static/src/less/web_editor.ui.less
+++ b/addons/web_editor/static/src/less/web_editor.ui.less
@@ -452,6 +452,11 @@ html[lang] > body.editor_enable [data-oe-translation-state] {
display: block;
left: 100%;
top: 0;
+
+ &.o_open_to_left {
+ left: auto;
+ right: 100%;
+ }
}
}
&.dropdown-submenu:before {