[IMP] mail: client action: focus on composer when opening a channel

Disable this feature on mobile as we don't want the mobile composer to open
each time we switch from an channel to an other.
This commit is contained in:
Aaron Bohy
2015-10-02 15:49:10 +02:00
parent 98bd82365c
commit 986f449909
2 changed files with 7 additions and 0 deletions
@@ -5,6 +5,7 @@ var chat_manager = require('mail.chat_manager');
var ChatComposer = require('mail.ChatComposer');
var ChatThread = require('mail.ChatThread');
var config = require('web.config');
var ControlPanelMixin = require('web.ControlPanelMixin');
var core = require('web.core');
var data = require('web.data');
@@ -314,6 +315,9 @@ var ChatAction = Widget.extend(ControlPanelMixin, {
return this.fetch_and_render_thread().then(function () {
self.thread.scroll_to({offset: new_channel_scrolltop});
if (!config.device.touch) {
self.composer.focus();
}
self.action_manager.do_push_state({
action: self.action.id,
active_id: self.channel_id,
+3
View File
@@ -479,6 +479,9 @@ var Composer = Widget.extend({
is_empty: function () {
return !this.$input.val().trim() && !this.$('.o_attachments').children().length;
},
focus: function () {
this.$input.focus();
},
});
return Composer;