[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 // 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; max-height: 70vh;
overflow-y: auto; overflow-y: auto;
overflow-x: hidden; overflow-x: hidden;
} }
} }
}

View File

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