[IMP] mail: add kanban view of channels in discuss client action
This commit is contained in:
@@ -83,6 +83,13 @@ class Channel(models.Model):
|
||||
alias_id = fields.Many2one(
|
||||
'mail.alias', 'Alias', ondelete="restrict", required=True,
|
||||
help="The email address associated with this group. New emails received will automatically create new topics.")
|
||||
is_subscribed = fields.Boolean(
|
||||
'Is Subscribed', compute='_compute_is_subscribed')
|
||||
|
||||
@api.one
|
||||
@api.depends('channel_partner_ids')
|
||||
def _compute_is_subscribed(self):
|
||||
self.is_subscribed = self.env.user.partner_id in self.channel_partner_ids
|
||||
|
||||
@api.one
|
||||
@api.depends('image')
|
||||
|
||||
@@ -117,6 +117,17 @@ var ChatAction = Widget.extend(ControlPanelMixin, {
|
||||
chat_manager.undo_mark_as_read(msgs_ids, channel);
|
||||
});
|
||||
},
|
||||
"click .o_mail_open_channels": function () {
|
||||
this.do_action({
|
||||
name: _t('Public Channels'),
|
||||
type: 'ir.actions.act_window',
|
||||
res_model: "mail.channel",
|
||||
views: [[false, 'kanban'], [false, 'form']],
|
||||
domain: [['public', '!=', 'private']],
|
||||
}, {
|
||||
on_reverse_breadcrumb: this.on_reverse_breadcrumb,
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
on_attach_callback: function () {
|
||||
|
||||
@@ -37,6 +37,9 @@
|
||||
.o_add {
|
||||
padding: 6px;
|
||||
}
|
||||
.o_mail_open_channels {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
.o_mail_chat_channel_item {
|
||||
width: 100%;
|
||||
@@ -191,6 +194,9 @@
|
||||
h4 {
|
||||
font-size: 13px;
|
||||
text-transform: uppercase;
|
||||
&.o_mail_open_channels:hover {
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
.o_add {
|
||||
cursor: pointer;
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
</t>
|
||||
<t t-if="!disable_add_channel || !empty">
|
||||
<div class="o_mail_sidebar_title">
|
||||
<h4><t t-esc="channel_title"/></h4>
|
||||
<h4 t-att-class="channel_type == 'public' ? 'o_mail_open_channels' : ''"><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>
|
||||
|
||||
@@ -49,13 +49,8 @@
|
||||
<field name="priority" eval="10"/>
|
||||
<field name="arch" type="xml">
|
||||
<kanban>
|
||||
<field name="message_follower_ids"/>
|
||||
<field name="message_is_follower"/>
|
||||
<field name="message_needaction_counter"/>
|
||||
<field name="description"/>
|
||||
<field name="alias_id"/>
|
||||
<field name="alias_name"/>
|
||||
<field name="alias_domain"/>
|
||||
<field name="is_subscribed"/>
|
||||
<templates>
|
||||
<t t-name="kanban-description">
|
||||
<div class="oe_group_description" t-if="record.description.raw_value">
|
||||
@@ -63,27 +58,15 @@
|
||||
</div>
|
||||
</t>
|
||||
<t t-name="kanban-box">
|
||||
<div t-attf-class="{record.message_is_follower.raw_value} oe_group_vignette oe_semantic_html_override">
|
||||
<div class="oe_group_image">
|
||||
<a type="open"><img t-att-src="kanban_image('mail.channel', 'image_medium', record.id.value)" class="oe_group_photo" tooltip="kanban-description"/></a>
|
||||
</div>
|
||||
<div class="oe_group_details">
|
||||
<h4><a type="open"><field name="name"/></a></h4>
|
||||
<div class="oe_kanban_alias" t-if="record.alias_name.value and record.alias_domain.value">
|
||||
<small><i class="fa fa-envelope-o"></i> <field name="alias_id"/></small>
|
||||
</div>
|
||||
<div class="oe_grey">
|
||||
<div class="oe_module_vignette oe_kanban_global_click">
|
||||
<img t-att-src="kanban_image('mail.channel', 'image_medium', record.id.value)" class="oe_module_icon"/>
|
||||
<div class="oe_module_desc">
|
||||
<h4>#<field name="name"/></h4>
|
||||
<p class="oe_module_name">
|
||||
<field name="description"/>
|
||||
</div>
|
||||
<div class="oe_kanban_bottom_left">
|
||||
<t t-if="record.message_needaction_counter.raw_value">
|
||||
<span class='oe_kanban_mail_new' title='Important Messages'><i class='fa fa-comments'/><t t-raw="record.message_needaction_counter.raw_value"/></span>
|
||||
</t>
|
||||
</div>
|
||||
<div class="oe_group_button">
|
||||
<button t-if="record.message_is_follower.raw_value" name="action_unfollow" type="object" class="oe_group_join">Unfollow</button>
|
||||
<button t-if="! record.message_is_follower.raw_value" name="action_follow" type="object">Join Group</button>
|
||||
</div>
|
||||
</p>
|
||||
<button type="object" attrs="{'invisible':[('is_subscribed','=',True)]}" class="btn btn-primary pull-right btn-sm" name="channel_join_and_get_info">Join</button>
|
||||
<button type="object" attrs="{'invisible':[('is_subscribed','=',False)]}" class="btn btn-secondary pull-right btn-sm" name="action_unfollow">Leave</button>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
@@ -106,7 +89,7 @@
|
||||
<label for="name"/>
|
||||
</div>
|
||||
<h1>
|
||||
<field name="name" default_focus="1" placeholder="Name" readonly="0"/>
|
||||
#<field name="name" default_focus="1" placeholder="Name" readonly="0"/>
|
||||
</h1>
|
||||
</div>
|
||||
<group>
|
||||
|
||||
Reference in New Issue
Block a user