From 0edf1ce2465bcc46f9fc3927dd64ca2e471bbab0 Mon Sep 17 00:00:00 2001 From: "Nasreddin (bon)" Date: Tue, 27 Oct 2020 12:59:27 +0000 Subject: [PATCH] [FIX] web: add rtl management for resizable jquery-ui widget Issue - Install "Project" modules - Set user language as "Hebrew" - Go to Project and open any project - Go to 'gantt' view - Try to resize a task Everything is reversed. Cause Jquery-ui 'resizable' widget do not manage RTL feature. Solution Update the the `position.left` props according to the language direction (LTR or RTL). opw-2367692 closes odoo/odoo#61082 X-original-commit: 1f318d7c7aa66287c8756a89b49293b4e8c2217e Related: odoo/enterprise#14507 Signed-off-by: Aaron Bohy (aab) Signed-off-by: bon-odoo --- addons/web/static/lib/jquery.ui/jquery-ui.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/addons/web/static/lib/jquery.ui/jquery-ui.js b/addons/web/static/lib/jquery.ui/jquery-ui.js index 2d48addb2a3..d4b4ebabe17 100644 --- a/addons/web/static/lib/jquery.ui/jquery-ui.js +++ b/addons/web/static/lib/jquery.ui/jquery-ui.js @@ -3527,6 +3527,8 @@ $.widget( "ui.resizable", $.ui.mouse, { // See #7960 zIndex: 90, + odoo_isRTL: false, + // Callbacks resize: null, start: null, @@ -3880,6 +3882,7 @@ $.widget( "ui.resizable", $.ui.mouse, { dx = ( event.pageX - smp.left ) || 0, dy = ( event.pageY - smp.top ) || 0, trigger = this._change[ a ]; + dx = this.options.odoo_isRTL ? -dx : dx; this._updatePrevProperties(); @@ -4651,11 +4654,19 @@ $.ui.plugin.add( "resizable", "grid", { } if ( newWidth - gridX > 0 ) { that.size.width = newWidth; - that.position.left = op.left - ox; + if (that.options.odoo_isRTL) { + that.position.left = op.left + ox; + } else { + that.position.left = op.left - ox; + } } else { newWidth = gridX - outerDimensions.width; that.size.width = newWidth; - that.position.left = op.left + os.width - newWidth; + if (that.options.odoo_isRTL) { + that.position.left = op.left - os.width + newWidth; + } else { + that.position.left = op.left + os.width - newWidth; + } } } }