diff options
| author | XavierDo <xdo@odoo.com> | 2019-01-07 12:31:18 +0000 |
|---|---|---|
| committer | XavierDo <xdo@odoo.com> | 2019-02-07 08:54:33 +0000 |
| commit | c21d200285ebeb646b8e5be6ba233f96d9714c6f (patch) | |
| tree | 456e22dba6bd235f1ed1143b224097f6a0e0f1dd /addons/mail/static/src | |
| parent | b60224c41cb6c9817fd328bb60b21681e619fb26 (diff) | |
[IMP] mail: add ooo status in chats windows.
In a chat window with a single usert (dm_chat) the ooo status of the
other user is displayed on the top when set.
Task: 1856205
Diffstat (limited to 'addons/mail/static/src')
| -rw-r--r-- | addons/mail/static/src/js/models/threads/dm_chat.js | 14 | ||||
| -rw-r--r-- | addons/mail/static/src/js/thread_windows/abstract_thread_window.js | 16 | ||||
| -rw-r--r-- | addons/mail/static/src/scss/abstract_thread_window.scss | 5 | ||||
| -rw-r--r-- | addons/mail/static/src/scss/discuss.scss | 5 | ||||
| -rw-r--r-- | addons/mail/static/src/scss/thread.scss | 13 | ||||
| -rw-r--r-- | addons/mail/static/src/xml/thread_window.xml | 3 |
6 files changed, 56 insertions, 0 deletions
diff --git a/addons/mail/static/src/js/models/threads/dm_chat.js b/addons/mail/static/src/js/models/threads/dm_chat.js index 4967a1e9963..21fb72e91ae 100644 --- a/addons/mail/static/src/js/models/threads/dm_chat.js +++ b/addons/mail/static/src/js/models/threads/dm_chat.js @@ -1,7 +1,9 @@ odoo.define('mail.model.DMChat', function (require) { "use strict"; +var core = require('web.core'); var TwoUserChannel = require('mail.model.TwoUserChannel'); +var _t = core._t; /** * Any piece of code in JS that make use of DMs must ideally interact with @@ -18,6 +20,7 @@ var DMChat = TwoUserChannel.extend({ * @param {integer} params.data.direct_partner[0].id * @param {string} params.data.direct_partner[0].im_status * @param {string} params.data.direct_partner[0].name + * @param {string} [params.data.direct_partner[0].out_of_office_message=''] */ init: function (params) { this._super.apply(this, arguments); @@ -51,6 +54,17 @@ var DMChat = TwoUserChannel.extend({ return this._directPartnerID; }, /** + * Get the out of office message of the thread + * + * @returns {string} + */ + getOutOfOfficeMessage: function () { + if (this._outOfOfficeMessage === '') { + return undefined; + } + return this._outOfOfficeMessage; + }, + /** * @override */ getPreview: function () { diff --git a/addons/mail/static/src/js/thread_windows/abstract_thread_window.js b/addons/mail/static/src/js/thread_windows/abstract_thread_window.js index 3e4e2e16325..da958c1c5f1 100644 --- a/addons/mail/static/src/js/thread_windows/abstract_thread_window.js +++ b/addons/mail/static/src/js/thread_windows/abstract_thread_window.js @@ -148,6 +148,22 @@ var AbstractThreadWindow = Widget.extend({ return this._thread; }, /** + * Get out of office user text + * + * @returns {string|undefined} + */ + getOutOfOfficeMessage: function () { + if ( + !( + this.hasThread() && + this._thread.getType() === 'dm_chat' + ) + ) { + return undefined; + } + return this._thread.getOutOfOfficeMessage(); + }, + /** * Get the status of the thread, such as the im status of a DM chat * ('online', 'offline', etc.). If this window has no thread, returns * `undefined`. diff --git a/addons/mail/static/src/scss/abstract_thread_window.scss b/addons/mail/static/src/scss/abstract_thread_window.scss index b148afa111f..62b0c42d033 100644 --- a/addons/mail/static/src/scss/abstract_thread_window.scss +++ b/addons/mail/static/src/scss/abstract_thread_window.scss @@ -79,6 +79,11 @@ $o-mail-thread-window-zindex: $zindex-modal + 1 !default; } + .o_out_of_office { + background-color: #9dd0e8; + padding:8px; + } + .o_mail_thread { flex: 1 1 100%; overflow: auto; diff --git a/addons/mail/static/src/scss/discuss.scss b/addons/mail/static/src/scss/discuss.scss index 570dc2dedd6..711180d3544 100644 --- a/addons/mail/static/src/scss/discuss.scss +++ b/addons/mail/static/src/scss/discuss.scss @@ -252,6 +252,11 @@ &.o_user_idle { color: theme-color('warning'); } + &.fa-stack { + width: 1em; + height: 1em; + line-height: 1em; + } } diff --git a/addons/mail/static/src/scss/thread.scss b/addons/mail/static/src/scss/thread.scss index 7c867896150..84a826922ff 100644 --- a/addons/mail/static/src/scss/thread.scss +++ b/addons/mail/static/src/scss/thread.scss @@ -68,6 +68,19 @@ margin-top: 2px; text-align: center; font-size: smaller; + .o_thread_message_sidebar_image { + position: relative; + height: $o-mail-thread-avatar-size; + + .o_updatable_im_status { + width: $o-mail-thread-avatar-size; + } + .o_mail_user_status { + position: absolute; + bottom: 0; + right: 0; + } + } @include media-breakpoint-down(sm) { margin-top: 4px; diff --git a/addons/mail/static/src/xml/thread_window.xml b/addons/mail/static/src/xml/thread_window.xml index 4164bc0abc9..4d175fcf2b8 100644 --- a/addons/mail/static/src/xml/thread_window.xml +++ b/addons/mail/static/src/xml/thread_window.xml @@ -6,6 +6,9 @@ --> <t t-name="mail.ThreadWindow" t-extend="mail.AbstractThreadWindow"> <t t-jquery=".o_thread_window_header" t-operation="after"> + <div class="o_out_of_office" t-if="widget.getOutOfOfficeMessage() !== undefined"> + <div class="o_out_of_office_text" t-esc="widget.getOutOfOfficeMessage()"/> + </div> <div t-if="!widget.hasThread()" class="o_thread_search_input"> <span> To: </span> <input type="text" placeholder="User name"/> |
