summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/widgets
diff options
context:
space:
mode:
authorLucas Perais (lpe) <lpe@odoo.com>2019-10-30 13:05:51 +0000
committerfw-bot <otis@odoo.com>2019-10-31 11:07:12 +0000
commit18765dde73331c659d087362a1a2e2eb1d3227bb (patch)
tree272582db941406b05818319ce9489814333a569f /addons/web/static/src/js/widgets
parentd11ba1454a5cda4705526715bc027522bfd90d95 (diff)
[FIX] web: dropdown in modal in RTL mode
Be in Right to left Open a m2o search more, to get onto the list modal toggle the filters menu Before this commit, the filters dropdown was almost invisble and too much on the right anyway This was because the RTL was not taken into account After this commit, we anchor the dropdown on the right (both as in good and as in side) side of its trigger button Also, when modifying the dropdown, by developping the Custom Filter we force the repositioning of the dropdown, to take those new elements into account It is expected though that after this commit, in RTL, the dropdown in a modal that has a scrollbar (which is on the left) will be slightly pushed to the right. It is usable and visible though Some kind of plumbing using $el.data('offset', fn) from popper.js is possible, but has been deemed not robust enough Docs https://getbootstrap.com/docs/4.0/components/dropdowns/#methods OPW 2088934 X-original-commit: 105b4affd65ea23e1aa65b53f4595c174c9984ef
Diffstat (limited to 'addons/web/static/src/js/widgets')
-rw-r--r--addons/web/static/src/js/widgets/dropdown_menu.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/addons/web/static/src/js/widgets/dropdown_menu.js b/addons/web/static/src/js/widgets/dropdown_menu.js
index 11873718576..d8663731c67 100644
--- a/addons/web/static/src/js/widgets/dropdown_menu.js
+++ b/addons/web/static/src/js/widgets/dropdown_menu.js
@@ -6,6 +6,8 @@ var Widget = require('web.Widget');
var QWeb = core.qweb;
+var _t = core._t;
+
var DropdownMenu = Widget.extend({
template: 'web.DropdownMenu',
@@ -37,7 +39,18 @@ var DropdownMenu = Widget.extend({
this.items = items;
this.openItems = {};
},
+ /**
+ * @override
+ */
+ start: function () {
+ this.$menu = this.$('.o_dropdown_menu');
+ this.$dropdownReference = this.$('.o_dropdown_toggler_btn');
+ if (_t.database.parameters.direction === 'rtl') {
+ this.$menu.addClass('dropdown-menu-right');
+ }
+ return this._super.apply(this, arguments);
+ },
//--------------------------------------------------------------------------
// Public