[FIX] mail: various UI improvements to chat interface
- don't display user name in chat windows - scroll to the new messages separator if it exists (in client action) - increase sidebar width - add correct link href in threads - hide chat window in mobile mode - mail: ignore o_mail_redirect or o_channel_redirect, but redirect anyway
This commit is contained in:
@@ -137,6 +137,7 @@ function make_message (data) {
|
||||
channel_ids: data.channel_ids,
|
||||
model: data.model,
|
||||
res_id: data.res_id,
|
||||
url: session.url("/mail/view?message_id=" + data.id),
|
||||
};
|
||||
|
||||
_.each(_.keys(emoji_substitutions), function (key) {
|
||||
@@ -516,11 +517,12 @@ function on_chat_session_notification (chat_session) {
|
||||
}
|
||||
// partner specific change (open a detached window for example)
|
||||
if ((chat_session.state === "open") || (chat_session.state === "folded")) {
|
||||
if (chat_session.is_minimized && chat_manager.get_channel(chat_session.id)) {
|
||||
chat_manager.bus.trigger("open_chat", chat_session);
|
||||
var channel = chat_session.is_minimized && chat_manager.get_channel(chat_session.id);
|
||||
if (channel) {
|
||||
chat_manager.bus.trigger("open_chat", channel);
|
||||
}
|
||||
} else if (chat_session.state === "closed") {
|
||||
chat_manager.bus.trigger("close_chat", chat_session);
|
||||
chat_manager.bus.trigger("close_chat", chat_manager.get_channel(chat_session.id));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -375,7 +375,13 @@ var ChatAction = Widget.extend(ControlPanelMixin, {
|
||||
.removeClass('o_unread_message')
|
||||
.addClass('o_active');
|
||||
|
||||
self.thread.scroll_to({offset: new_channel_scrolltop});
|
||||
var $new_messages_separator = self.$('.o_thread_new_messages_separator');
|
||||
if ($new_messages_separator.length) {
|
||||
self.thread.$el.scrollTo($new_messages_separator);
|
||||
} else {
|
||||
self.thread.scroll_to({offset: new_channel_scrolltop});
|
||||
}
|
||||
|
||||
if (!config.device.touch) {
|
||||
self.composer.focus();
|
||||
}
|
||||
|
||||
@@ -16,8 +16,9 @@ var Thread = Widget.extend({
|
||||
className: 'o_mail_thread',
|
||||
|
||||
events: {
|
||||
"click .o_mail_redirect": "on_click_redirect",
|
||||
"click .o_channel_redirect": "on_channel_redirect",
|
||||
"click a": "on_click_redirect",
|
||||
"click img": "on_click_redirect",
|
||||
"click strong": "on_click_redirect",
|
||||
"click .o_thread_show_more": "on_click_show_more",
|
||||
"click .o_thread_message_needaction": function (event) {
|
||||
event.stopPropagation();
|
||||
@@ -85,16 +86,13 @@ var Thread = Widget.extend({
|
||||
},
|
||||
|
||||
on_click_redirect: function (event) {
|
||||
event.preventDefault();
|
||||
var res_id = $(event.target).data('oe-id');
|
||||
var res_model = $(event.target).data('oe-model');
|
||||
this._redirect({model:res_model, id: res_id});
|
||||
},
|
||||
|
||||
on_channel_redirect: function (event) {
|
||||
event.preventDefault();
|
||||
var channel_id = $(event.target).data('oe-id');
|
||||
this._redirect({channel_id: channel_id});
|
||||
var id = $(event.target).data('oe-id');
|
||||
if (id) {
|
||||
event.preventDefault();
|
||||
var model = $(event.target).data('oe-model');
|
||||
var options = model ? {model: model, id: id} : {channel_id: id};
|
||||
this._redirect(options);
|
||||
}
|
||||
},
|
||||
|
||||
_redirect: _.debounce(function (options) {
|
||||
|
||||
@@ -11,6 +11,10 @@
|
||||
border: 1px solid gray;
|
||||
border-radius: 3px;
|
||||
|
||||
@media (max-width: @screen-xs-max) {
|
||||
display:none;
|
||||
}
|
||||
|
||||
.o_chat_header {
|
||||
.o-flex-display();
|
||||
.o-flex(0, 0, auto);
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
.o-flex-flow(row, nowrap);
|
||||
|
||||
.o_mail_chat_sidebar {
|
||||
.o-flex(0, 0, 220px);
|
||||
.o-flex(0, 0, 250px);
|
||||
overflow: auto;
|
||||
padding: 8px 0;
|
||||
font-weight: 300;
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
<img t-if="message.avatar_src && message.display_author"
|
||||
t-att-src="message.avatar_src"
|
||||
data-oe-model="res.partner"
|
||||
t-att-data-oe-id="message.author_id[0]"
|
||||
t-att-data-oe-id="message.author_redirect ? message.author_id[0] : ''"
|
||||
t-attf-class="o_thread_message_avatar #{message.author_redirect ? 'o_mail_redirect' : ''}"/>
|
||||
</t>
|
||||
<t t-if="message.mailto || !message.author_id[0]">
|
||||
@@ -79,7 +79,7 @@
|
||||
</a>
|
||||
</strong>
|
||||
<strong t-if="!message.mailto && message.author_id[0]"
|
||||
data-oe-model="res.partner" t-att-data-oe-id="message.author_id[0]"
|
||||
data-oe-model="res.partner" t-att-data-oe-id="message.author_redirect ? message.author_id[0] : ''"
|
||||
t-attf-class="#{message.author_redirect ? 'o_mail_redirect' : ''}">
|
||||
<t t-esc="message.displayed_author"/>
|
||||
</strong>
|
||||
@@ -91,10 +91,10 @@
|
||||
- <t t-esc="message.hour"/>
|
||||
</small>
|
||||
<t t-if="message.model && (message.model != 'mail.channel') && options.display_document_link">
|
||||
on <a class="o_mail_redirect" href="#" t-att-data-oe-model="message.model" t-att-data-oe-id="message.res_id"><t t-esc="message.record_name"/></a>
|
||||
on <a t-att-href="message.url" t-att-data-oe-model="message.model" t-att-data-oe-id="message.res_id"><t t-esc="message.record_name"/></a>
|
||||
</t>
|
||||
<t t-if="message.origin_id && (message.origin_id !== options.channel_id)">
|
||||
(from <a class="o_channel_redirect" t-att-data-oe-id="message.origin_id" href="#">#<t t-esc="message.origin_name"/></a>)
|
||||
(from <a t-att-data-oe-id="message.origin_id" href="#">#<t t-esc="message.origin_name"/></a>)
|
||||
</t>
|
||||
<span>
|
||||
<i t-if="options.display_stars && message.message_type != 'notification'"
|
||||
|
||||
Reference in New Issue
Block a user