[FIX] web_responsive: Show history section in discuss mobile

pull/1951/head
Alexandre D. Díaz 2021-06-07 15:41:49 +02:00
parent f67b12ba74
commit 83d853a8ad
2 changed files with 58 additions and 50 deletions

View File

@ -800,9 +800,16 @@ html .o_web_client .o_action_manager .o_action {
}
// Enable scroll on dropdowns
.o_cp_buttons .dropdown-menu {
.o_cp_buttons {
> div {
display: inline-flex;
flex-direction: row;
gap: 0.5em;
}
.dropdown-menu {
max-height: 70vh;
overflow-y: auto;
overflow-x: hidden;
}
}
}

View File

@ -113,6 +113,7 @@ odoo.define("web_responsive.Discuss", function(require) {
_setThread: function(threadID) {
const thread = this.call("mail_service", "getThread", threadID);
this._thread = thread;
this._updateButtons(threadID);
if (thread.getType() !== "mailbox") {
this.call("mail_service", "openThreadWindow", threadID);
return Promise.resolve();
@ -158,7 +159,7 @@ odoo.define("web_responsive.Discuss", function(require) {
* @returns {Promise}
*/
_updateContent: function(type) {
const inMailbox = type === "mailbox_inbox" || type === "mailbox_starred";
const inMailbox = type.startsWith("mailbox_");
if (!inMailbox && this._isInInboxTab()) {
// We're leaving the inbox, so store the thread scrolltop
this._storeThreadState();
@ -202,6 +203,12 @@ odoo.define("web_responsive.Discuss", function(require) {
this._$mainContent.html($content);
}
this._updateButtons(type);
});
},
_updateButtons: function(type) {
const inMailbox = type.startsWith("mailbox_");
// Update control panel
this.$buttons
.find("button")
@ -232,19 +239,14 @@ odoo.define("web_responsive.Discuss", function(require) {
.removeClass("btn-secondary")
.addClass("btn-primary");
} else {
this.$(".o_mail_discuss_mobile_mailboxes_buttons").addClass(
"o_hidden"
);
this.$(".o_mail_discuss_mobile_mailboxes_buttons").addClass("o_hidden");
}
// Update bottom buttons
this.$(".o_mail_mobile_tab").removeClass("active");
// Mailbox_inbox and mailbox_starred share the same tab
const type_n = type === "mailbox_starred" ? "mailbox_inbox" : type;
this.$(".o_mail_mobile_tab[data-type=" + type_n + "]").addClass(
"active"
);
});
this.$(".o_mail_mobile_tab[data-type=" + type_n + "]").addClass("active");
},
// --------------------------------------------------------------------------
@ -280,9 +282,8 @@ odoo.define("web_responsive.Discuss", function(require) {
*/
_onClickMobileTab: function(ev) {
const type = $(ev.currentTarget).data("type");
if (type === "mailbox") {
const inbox = this.call("mail_service", "getMailbox", "inbox");
this._setThread(inbox);
if (type === "mailbox_inbox") {
this._setThread("mailbox_inbox");
}
this._updateContent(type);
},