[FIX] im_livechat, website_event_track_online: avoid overlapping banners

On mobile devices, when you go for the first time inside the event
public page the PWA install bar and the livechat tooltip are displayed
at same area. Because of this it's was difficult to click on the
"install" button.

X-original-commit: 6705c6b6fe0360f95b4a499a9141f876648b7202
This commit is contained in:
Romain Estievenart
2020-08-14 15:18:35 +00:00
parent c06bb52f57
commit 71b44f15dd
2 changed files with 13 additions and 1 deletions
@@ -110,6 +110,13 @@ var LivechatButton = Widget.extend({
if (this.options.button_text_color) {
this.$el.css('color', this.options.button_text_color);
}
// If website_event_track_online installed, put the livechat banner above the PWA banner.
var pwaBannerHeight = $('.o_pwa_install_banner').outerHeight(true);
if (pwaBannerHeight) {
this.$el.css('bottom', pwaBannerHeight + 'px');
}
return this._super();
},
@@ -76,6 +76,7 @@ odoo.define("website_event_track_online.website_event_pwa_widget", function (req
*/
_hideInstallBanner: function () {
this.installBanner ? this.installBanner.destroy() : undefined;
$('.o_livechat_button').css('bottom', '0');
},
/**
@@ -102,7 +103,11 @@ odoo.define("website_event_track_online.website_event_pwa_widget", function (req
*/
_showInstallBanner: function () {
this.installBanner = new PWAInstallBanner(this);
this.installBanner.appendTo(this.$el);
this.installBanner.appendTo(this.$el).then(() => {
// If Livechat available, It should be placed above the PWA banner.
var height = this.$('.o_pwa_install_banner').outerHeight(true);
$('.o_livechat_button').css('bottom', height + 'px');
});
},
//--------------------------------------------------------------------------