From 4aa4c8e87fc8d3047429e425244d7b301fdacce5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20K=C3=BChn?= Date: Mon, 5 Sep 2022 08:59:45 +0000 Subject: [PATCH] [FIX] im_livechat: do not cut header content in external lib livechat Before this commit, chat window header in external lib had text and button, due to chat window header being too narrow. This commit fixes the issue by increasing the chat window header height to match the visual in website livechat, which by itself also fixes the text and button being properly visible. Also adapt fold behaviour so it works on click anywhere in the header, excluding buttons and title click. Task-2973046 closes odoo/odoo#99542 Signed-off-by: Louis Wicket (wil) --- addons/im_livechat/static/src/legacy/public_livechat.scss | 3 +-- .../public_livechat_window/public_livechat_window.js | 2 +- .../static/src/models/public_livechat_window.js | 7 ++++--- .../im_livechat/static/src/scss/im_livechat_bootstrap.scss | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/addons/im_livechat/static/src/legacy/public_livechat.scss b/addons/im_livechat/static/src/legacy/public_livechat.scss index 2368acc9f79..2176ff9d830 100644 --- a/addons/im_livechat/static/src/legacy/public_livechat.scss +++ b/addons/im_livechat/static/src/legacy/public_livechat.scss @@ -42,6 +42,7 @@ $o-mail-thread-window-zindex: $zindex-modal + 1 !default; border-bottom: 1px solid map-get($grays, '300'); background-color: $o-brand-odoo; padding: 8px; + cursor: pointer; @include media-breakpoint-down(md) { align-items: center; @@ -81,9 +82,7 @@ $o-mail-thread-window-zindex: $zindex-modal + 1 !default; } .o_thread_window_title { - cursor: pointer; flex: 1 1 auto; - height: 100%; @include o-text-overflow; .o_mail_thread_typing_icon { diff --git a/addons/im_livechat/static/src/legacy/widgets/public_livechat_window/public_livechat_window.js b/addons/im_livechat/static/src/legacy/widgets/public_livechat_window/public_livechat_window.js index 2364f7176f0..5f56aeeea6b 100644 --- a/addons/im_livechat/static/src/legacy/widgets/public_livechat_window/public_livechat_window.js +++ b/addons/im_livechat/static/src/legacy/widgets/public_livechat_window/public_livechat_window.js @@ -18,7 +18,7 @@ const PublicLivechatWindow = Widget.extend({ template: 'im_livechat.legacy.PublicLivechatWindow', events: { 'click .o_thread_window_close': '_onClickClose', - 'click .o_thread_window_title': '_onClickFold', + 'click .o_thread_window_header': '_onClickFold', 'click .o_composer_text_field': '_onComposerClick', 'click .o_mail_thread': '_onThreadWindowClicked', 'keydown .o_composer_text_field': '_onKeydown', diff --git a/addons/im_livechat/static/src/models/public_livechat_window.js b/addons/im_livechat/static/src/models/public_livechat_window.js index e1b3a953067..a8d50aa1c21 100644 --- a/addons/im_livechat/static/src/models/public_livechat_window.js +++ b/addons/im_livechat/static/src/models/public_livechat_window.js @@ -59,9 +59,10 @@ registerModel({ $(this).on('click', self.messaging.publicLivechatGlobal.livechatButtonView.widget._onChatbotOptionClicked.bind(self.messaging.publicLivechatGlobal.livechatButtonView.widget)); }); - this.widget.$('.o_livechat_chatbot_main_restart').on('click', - this.messaging.publicLivechatGlobal.livechatButtonView.onChatbotRestartScript - ); + this.widget.$('.o_livechat_chatbot_main_restart').on('click', (ev) => { + ev.stopPropagation(); // prevent fold behaviour + this.messaging.publicLivechatGlobal.livechatButtonView.onChatbotRestartScript(ev); + }); if (this.messaging.publicLivechatGlobal.messages.length !== 0) { const lastMessage = this.messaging.publicLivechatGlobal.lastMessage; diff --git a/addons/im_livechat/static/src/scss/im_livechat_bootstrap.scss b/addons/im_livechat/static/src/scss/im_livechat_bootstrap.scss index 9d97ddd0ed7..7242f2661f0 100644 --- a/addons/im_livechat/static/src/scss/im_livechat_bootstrap.scss +++ b/addons/im_livechat/static/src/scss/im_livechat_bootstrap.scss @@ -15,7 +15,7 @@ box-sizing: border-box; } .o_thread_window_header { - height: 28px; + height: 35px; .fa-close { text-decoration: none; font-weight: bold;