summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2015-10-16 12:06:22 +0200
committerGéry Debongnie <ged@odoo.com>2015-10-16 15:52:01 +0200
commit765cfa040d2be43d76c9248bc1fa33137252c493 (patch)
tree1f10422ddfbc1eaa9dd854c831c5ff2db64bd796
parent4884b41f5570b1025127f661a3243e83962d508a (diff)
[IMP] mail: client action: sidebar: hide livechat when empty
Channel types that disable the 'add a channel' feature like the livechat are now only rendered in the sidebar of the client action if there exists at least one channel of that type.
-rw-r--r--addons/mail/static/src/xml/client_action.xml20
1 files changed, 16 insertions, 4 deletions
diff --git a/addons/mail/static/src/xml/client_action.xml b/addons/mail/static/src/xml/client_action.xml
index 728e0716960..635fceb36a9 100644
--- a/addons/mail/static/src/xml/client_action.xml
+++ b/addons/mail/static/src/xml/client_action.xml
@@ -50,10 +50,22 @@
</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>
+ <!-- Don't display the channel type if there is no channel of such type
+ and the 'add a channel' option is disabled for this type -->
+ <t t-if="disable_add_channel">
+ <t t-set="empty" t-value="true"/>
+ <t t-foreach="channels" t-as="channel">
+ <t t-if="channel.type === channel_type">
+ <t t-set="empty" t-value="false"/>
+ </t>
+ </t>
+ </t>
+ <t t-if="!disable_add_channel || !empty">
+ <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 t-name="mail.chat.SidebarItems">
<t t-foreach="channels" t-as="channel">