summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/xml
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2015-10-05 11:16:22 +0200
committerAaron Bohy <aab@odoo.com>2015-10-06 16:24:28 +0200
commit8019c89ea8d019f00b66a3395efb2eb4ce3f32a9 (patch)
tree33e8fc703ba7384246bbd02f866644d93f3e016d /addons/mail/static/src/xml
parent01caecf1c76691593958a73b7a45650693888830 (diff)
[IMP] mail: prepare livechat integration
- Extract sub-templates for client action's sidebar to ease the livechat integration - Handle livechat's channel_type and messages in chat manager - Make scrollBottom work in the frontend
Diffstat (limited to 'addons/mail/static/src/xml')
-rw-r--r--addons/mail/static/src/xml/chat_window.xml3
-rw-r--r--addons/mail/static/src/xml/client_action.xml119
2 files changed, 52 insertions, 70 deletions
diff --git a/addons/mail/static/src/xml/chat_window.xml b/addons/mail/static/src/xml/chat_window.xml
index e94c51767c2..01e475a6eb8 100644
--- a/addons/mail/static/src/xml/chat_window.xml
+++ b/addons/mail/static/src/xml/chat_window.xml
@@ -6,14 +6,13 @@
<div class="o_chat_window">
<div class="o_chat_header">
<span class="o_chat_title">
- <t t-raw="widget.title"/>
+ <t t-esc="widget.title"/>
</span>
<span>
<a href="#" class="o_chat_window_close fa fa-close"></a>
</span>
</div>
<div class="o_chat_content">
- <!-- <t t-call="mail.chat.im.Conversation.messages"/> -->
</div>
<div class="o_chat_input">
<input t-att-placeholder="widget.placeholder"/>
diff --git a/addons/mail/static/src/xml/client_action.xml b/addons/mail/static/src/xml/client_action.xml
index e4e80250b92..63c5c7a1c60 100644
--- a/addons/mail/static/src/xml/client_action.xml
+++ b/addons/mail/static/src/xml/client_action.xml
@@ -1,93 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
- <!--
- ChatMailThread
- Layout of the client action
- param: widget: the widget (ChatMailThread)
- -->
+ <!-- Client Action -->
<t t-name="mail.client_action">
<div class="o_mail_chat">
<div class="o_mail_chat_sidebar"/>
<div class="o_mail_chat_content"/>
</div>
</t>
+ <t t-name="mail.chat.Sidebar">
+ <div class="o_mail_chat_sidebar">
+ <div class="o_mail_chat_channel_item" data-channel-id="channel_inbox">
+ @ Inbox
+ <t t-call="mail.chat.SidebarNeedaction"/>
+ </div>
+ <div class="o_mail_chat_channel_item" data-channel-id="channel_starred">
+ <span class="fa fa-star-o"/> Starred
+ </div>
- <div t-name="mail.chat.Sidebar" class="o_mail_chat_sidebar">
- <div class="o_mail_chat_channel_item" data-channel-id="channel_inbox">
- @ Inbox
- <t t-call="mail.chat.SidebarNeedaction"/>
- </div>
- <div class="o_mail_chat_channel_item" data-channel-id="channel_starred">
- <span class="fa fa-star-o"/> Starred
- </div>
-
- <div class="o_mail_sidebar_title">
- <h4>Channels</h4>
- <span class="fa fa-plus o_add" data-type="public"/>
- </div>
- <t t-foreach="channels" t-as="channel">
- <t t-if="channel.type === 'public'">
- <div class="o_mail_chat_channel_item" t-att-data-channel-id="channel.id">
- <t t-esc="channel.name"/>
- </div>
+ <t t-set="channel_type">public</t>
+ <t t-call="mail.chat.SidebarTitle">
+ <t t-set="channel_title">Channels</t>
+ </t>
+ <t t-call="mail.chat.SidebarItems">
+ <t t-set="input_placeholder">Add a channel</t>
</t>
- </t>
- <div class="o_mail_add_channel" data-type="public">
- <input type="text" placeholder="Add a channel"/>
- </div>
- <div class="o_mail_sidebar_title">
- <h4>Direct Messages</h4>
- <span class="fa fa-plus o_add" data-type="dm"/>
- </div>
- <t t-foreach="channels" t-as="channel">
- <t t-if="channel.type === 'dm'">
- <div class="o_mail_chat_channel_item" t-att-data-channel-id="channel.id">
- <i t-att-class="'fa ' + (channel.status == 'online' ? 'fa-circle' : 'fa-circle-o')"/>
- <t t-esc="channel.name"/>
- <span class="fa fa-times pull-right o_mail_partner_unpin" t-att-title="_t('Close')" t-att-data-channel-id="channel.id"/>
- </div>
+ <t t-set="channel_type">dm</t>
+ <t t-call="mail.chat.SidebarTitle">
+ <t t-set="channel_title">Direct Messages</t>
+ </t>
+ <t t-call="mail.chat.SidebarItems">
+ <t t-set="display_status">true</t>
+ <t t-set="display_close_button">true</t>
+ <t t-set="input_placeholder">Open chat</t>
</t>
- </t>
- <div class="o_mail_add_channel" data-type="dm">
- <input type="text" placeholder="Open chat"/>
- </div>
- <div class="o_mail_sidebar_title">
- <h4>Private Channels</h4>
- <span class="fa fa-plus o_add" data-type="private"/>
- </div>
- <t t-foreach="channels" t-as="channel">
- <t t-if="channel.type === 'private'">
- <div class="o_mail_chat_channel_item" t-att-data-channel-id="channel.id">
- <t t-esc="channel.name"/>
- </div>
+ <t t-set="channel_type">private</t>
+ <t t-call="mail.chat.SidebarTitle">
+ <t t-set="channel_title">Private Channels</t>
+ </t>
+ <t t-call="mail.chat.SidebarItems">
+ <t t-set="input_placeholder">Add a channel</t>
</t>
- </t>
- <div class="o_mail_add_channel" data-type="private">
- <input type="text" placeholder="Add a channel"/>
</div>
-
-
- <!-- <a href="#" class="o_mail_chat_add_more_text"><span class="fa fa-plus"/>Add</a>
- <div class="o_mail_chat_add_more_search_bar" style="display: none;">
- <input type="text"/>
- </div> -->
- <!-- <t t-call="mail.chat.ChatMailThread.channels">
- <t t-set="channel_slot" t-value="'channel_private_group'"/>
- </t> -->
- </div>
-
+ </t>
<t t-name="mail.chat.SidebarNeedaction">
<span t-attf-class="o_mail_sidebar_needaction badge pull-right #{(!needaction_counter ? 'hide' : '')}">
<t t-esc="needaction_counter"/>
</span>
</t>
+ <t t-name="mail.chat.SidebarTitle">
+ <div class="o_mail_sidebar_title">
+ <h4><t t-esc="channel_title"/></h4>
+ <span t-if="!disable_add_channel" class="fa fa-plus o_add" t-att-title="_t('Add')" t-attf-data-type="#{channel_type}"/>
+ </div>
+ </t>
+ <t t-name="mail.chat.SidebarItems">
+ <t t-foreach="channels" t-as="channel">
+ <div t-if="channel.type === channel_type" class="o_mail_chat_channel_item" t-att-data-channel-id="channel.id">
+ <i t-if="display_status" t-att-class="'fa ' + (channel.status == 'online' ? 'fa-circle' : 'fa-circle-o')"/>
+ <t t-esc="channel.name"/>
+ <span t-if="display_close_button" class="fa fa-times pull-right o_mail_partner_unpin" t-att-title="_t('Close')" t-att-data-channel-id="channel.id"/>
+ </div>
+ </t>
+ <div t-if="!disable_add_channel" class="o_mail_add_channel" t-attf-data-type="#{channel_type}">
+ <input type="text" t-attf-placeholder="#{input_placeholder}"/>
+ </div>
+ </t>
- <!--
- Buttons of the Control Panel
- -->
+ <!-- Buttons of the Control Panel -->
<t t-name="mail.chat.ControlButtons">
<div>
<button type="button" class="btn btn-primary btn-sm o_mail_chat_button_invite" t-att-title='_t("Invite people")'>Invite</button>
@@ -95,6 +77,7 @@
</div>
</t>
+ <!-- Invite dialog's content -->
<div t-name="mail.PartnerInviteDialog">
<input type="text" class="o_mail_chat_partner_invite_input" id="mail_search_partners"/>
</div>