From ccddf7072ff0918bba7f2c78bd50237e181844cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Thu, 22 Oct 2015 13:00:13 +0200 Subject: [PATCH] [IMP] mail: make the interface usable in mobile mode The sidebar can be make visible by clicking on a button 'Channels' in the control panel. --- addons/mail/static/src/js/client_action.js | 13 +++++++++++-- addons/mail/static/src/less/client_action.less | 11 +++++++---- addons/mail/static/src/xml/client_action.xml | 5 +++-- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/addons/mail/static/src/js/client_action.js b/addons/mail/static/src/js/client_action.js index a6a441d0f67..a4bca075998 100644 --- a/addons/mail/static/src/js/client_action.js +++ b/addons/mail/static/src/js/client_action.js @@ -165,6 +165,9 @@ var ChatAction = Widget.extend(ControlPanelMixin, { this.$buttons.find('button').css({display:"inline-block"}); this.$buttons.on('click', '.o_mail_chat_button_invite', this.on_click_button_invite); this.$buttons.on('click', '.o_mail_chat_button_detach', this.on_click_button_detach); + this.$buttons.on('click', '.o_mail_toggle_channels', function () { + self.$('.o_mail_chat_sidebar').slideToggle(200); + }); this.thread.on('redirect', this, this.on_redirect); this.thread.on('redirect_to_channel', this, function (channel_id) { @@ -295,10 +298,12 @@ var ChatAction = Widget.extend(ControlPanelMixin, { var new_channel_scrolltop = this.channels_scrolltop[channel.id]; this.channel = channel; this.set("title", channel.name); - this.$buttons.toggle(channel.type !== "static"); + this.$buttons + .find('.o_mail_chat_button_detach') + .toggle(channel.type !== "static"); this.$buttons .find('.o_mail_chat_button_invite') - .toggle(channel.type !== "dm"); + .toggle(channel.type !== "dm" && channel.type !== 'static'); this.update_cp(); this.action.context.active_id = channel.id; @@ -318,6 +323,10 @@ var ChatAction = Widget.extend(ControlPanelMixin, { if (!config.device.touch) { self.composer.focus(); } + if (config.device.size_class === config.device.SIZES.XS) { + self.$('.o_mail_chat_sidebar').hide(); + } + self.action_manager.do_push_state({ action: self.action.id, active_id: self.channel.id, diff --git a/addons/mail/static/src/less/client_action.less b/addons/mail/static/src/less/client_action.less index 4e63a2b956f..7c4bdfab206 100644 --- a/addons/mail/static/src/less/client_action.less +++ b/addons/mail/static/src/less/client_action.less @@ -6,8 +6,9 @@ height: 100%; @media (max-width: @screen-xs-max) { - position: static; height: auto; + flex-direction: column; + } .o-flex-display(); @@ -18,6 +19,11 @@ overflow: auto; padding: 8px 0; + @media (max-width: @screen-xs-max) { + flex: none; + display: none; + } + .o_mail_sidebar_title { .o-webclient-padding(@top: 5px, @bottom: 5px); .o-flex-display(); @@ -56,9 +62,6 @@ height: 100%; .o-flex-display(); .o-flex-flow(column, nowrap); - @media (max-width: @screen-xs-max) { - height: auto; - } .o_mail_thread { .o-flex(1, 0, 0); diff --git a/addons/mail/static/src/xml/client_action.xml b/addons/mail/static/src/xml/client_action.xml index 635fceb36a9..7c8564c8146 100644 --- a/addons/mail/static/src/xml/client_action.xml +++ b/addons/mail/static/src/xml/client_action.xml @@ -83,8 +83,9 @@
- - + + +