Skip to content
Permalink
Browse files

[IMP] mail: Improve the document chat window

On Hover the systray, add 'expand' icon, it directly open the form view.

Delete the name of the task on all messages: only keep it in the header of the chat window.
For messages on praticular document do not diplay the Document Links in chatter window.

when user click on the expand button icon, it will open the task.

fix the font size in chatter. (on,from)

Task:1929169

closes #30957
  • Loading branch information...
ppr-odoo committed Feb 22, 2019
1 parent 5091bc1 commit 1cc5c752a98347ade4e5b3e5e1a434f693f6aaf0
@@ -260,6 +260,7 @@ var Message = AbstractMessage.extend(Mixins.EventDispatcherMixin, ServicesMixin
messageID: this.getID(),
status: this.status,
title: title,
isLinkedToDocumentThread: this.isLinkedToDocumentThread(),
};
},
/**
@@ -24,6 +24,7 @@ var MessagingMenu = Widget.extend({
'click .o_filter_button': '_onClickFilterButton',
'click .o_new_message': '_onClickNewMessage',
'click .o_mail_preview_mark_as_read': '_onClickPreviewMarkAsRead',
'click .o_thread_window_expand': '_onClickExpand',
'show.bs.dropdown': '_onShowDropdown',
},
/**
@@ -246,6 +247,19 @@ var MessagingMenu = Widget.extend({
_onShowDropdown: function () {
this._updatePreviews();
},
/**
* When a expand is clicked on, we want to open the related object
*
* @private
* @param {MouseEvent} ev
*/
_onClickExpand: function (ev) {
ev.stopPropagation();
var $preview = $(ev.currentTarget).closest('.o_mail_preview');
var documentModel = $preview.data('documentModel');
var documentID = $preview.data('documentId');
this._openDocument(documentModel, documentID);
},
/**
* @private
* @param {MouseEvent} ev
@@ -77,11 +77,14 @@ var AbstractThreadWindow = Widget.extend({
var self = this;
this.$input = this.$('.o_composer_text_field');
this.$header = this.$('.o_thread_window_header');

this._threadWidget = new ThreadWidget(this, {
displayMarkAsRead: false,
displayStars: this.options.displayStars,
});
var options = {
displayMarkAsRead: false,
displayStars: this.options.displayStars,
};
if (this._thread && this._thread._type === 'document_thread') {
options.displayDocumentLinks = false;
}
this._threadWidget = new ThreadWidget(this, options);

// animate the (un)folding of thread windows
this.$el.css({transition: 'height ' + this.FOLD_ANIMATION_DURATION + 'ms linear'});
@@ -362,6 +362,7 @@
flex: 1 1 100%;
overflow: hidden;
.o_preview_title {
align-items: center;
display: flex;
.o_preview_name {
flex: 0 1 auto;
@@ -378,7 +379,10 @@
padding-right: 0px;
}
.o_preview_counter {
flex: 1 1 auto;
flex: 0 1 auto;
}
.o_thread_window_expand {
margin: 0px 6px;
}
.o_last_message_date {
flex: 0 0 auto;
@@ -316,7 +316,8 @@
<span class="o_preview_counter">
<t t-if="preview.unreadCounter &gt; 0">&amp;nbsp;(<t t-esc="preview.unreadCounter"/>)</t>
</span>
<span class="o_last_message_date"> <t t-esc="preview.date ? preview.date.fromNow() : ''"/> </span>
<span class="o_discuss_icon o_thread_window_expand fa fa-expand" t-if="preview.isLinkedToDocumentThread"/>
<span class="o_last_message_date ml-auto mr-2"> <t t-esc="preview.date ? preview.date.fromNow() : ''"/> </span>
</div>
<div class="o_last_message_preview">
<t t-if="preview.body">
@@ -308,10 +308,10 @@

- <small class="o_mail_timestamp" t-att-title="message.getDate().format(dateFormat)"><t t-esc="message.getTimeElapsed()"/></small>
<t t-if="message.isLinkedToDocumentThread() and options.displayDocumentLinks">
on <a t-att-href="message.getURL()" t-att-data-oe-model="message.getDocumentModel()" t-att-data-oe-id="message.getDocumentID()" class="o_document_link"><t t-esc="message.getDocumentName()"/></a>
<small>on</small> <a t-att-href="message.getURL()" t-att-data-oe-model="message.getDocumentModel()" t-att-data-oe-id="message.getDocumentID()" class="o_document_link"><t t-esc="message.getDocumentName()"/></a>
</t>
<t t-if="message.originatesFromChannel() and (message.getOriginChannelID() !== thread.getID())">
(from <a t-att-data-oe-id="message.getOriginChannelID()" href="#">#<t t-esc="message.getOriginChannelName()"/></a>)
(<small>from</small> <a t-att-data-oe-id="message.getOriginChannelID()" href="#">#<t t-esc="message.getOriginChannelName()"/></a>)
</t>
<span t-if="options.displayEmailIcons and (message.hasCustomerEmailData() or ['exception', 'bounce'].indexOf(message._customerEmailStatus) > -1)" class="o_thread_tooltip_container">

@@ -881,5 +881,48 @@ QUnit.test('messaging menu widget: do not open chat window twice on preview clic
messagingMenu.destroy();
});

QUnit.test('messaging menu widget: expand on thread preview', async function (assert) {
assert.expect(4);

var taskMessage = [{
author_id: [1, "Demo"],
body: "<p>Office Design Project</p>",
res_id: 123,
model: 'some.res.model',
needaction: true,
needaction_partner_ids: [44],
}];
this.data['mail.message'].records =
this.data['mail.message'].records.concat(taskMessage);

var messagingMenu = new MessagingMenu();
testUtils.mock.addMockEnvironment(messagingMenu, {
services: this.services,
data: this.data,
session: {
partner_id: 44,
},
intercepts: {
do_action: function (ev) {
if (ev.data.action.res_model === 'some.res.model' &&
ev.data.action.res_id === 123
) {
assert.step('open_document');
}
},
},
});
await messagingMenu.appendTo($('#qunit-fixture'));

await testUtils.dom.click(messagingMenu.$('.dropdown-toggle'));

var $preview = messagingMenu.$('.o_mail_preview');
assert.containsOnce(messagingMenu, '.o_thread_window_expand', "should display one preview");
assert.strictEqual($preview.data('document-model'), "some.res.model", "preview should be from some.res.model");
await testUtils.dom.click($preview.find('.o_thread_window_expand'));
assert.verifySteps(['open_document']);
messagingMenu.destroy();
});

});
});

0 comments on commit 1cc5c75

Please sign in to comment.
You can’t perform that action at this time.