summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/xml/activity_view.xml
diff options
context:
space:
mode:
authormcm-odoo <mcm@odoo.com>2020-01-08 08:47:56 +0000
committerMichael Mattiello (mcm) <mcm@odoo.com>2020-01-28 07:42:56 +0000
commit5aa0822a9d098ab1b065d3536f9ced18a5ae54b8 (patch)
treedc72159c5cccfb95dd0ea6627b8f0827b7b5239e /addons/mail/static/src/xml/activity_view.xml
parent7e405102d2922ccb734973451c6cb05e99cb73e5 (diff)
[REF] mail: migrate activity renderer to owl
In order to prepare the future, we want to convert everything in Owl. This commit converts the activity renderer. closes odoo/odoo#42278 Task: 2149408 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Diffstat (limited to 'addons/mail/static/src/xml/activity_view.xml')
-rw-r--r--addons/mail/static/src/xml/activity_view.xml85
1 files changed, 62 insertions, 23 deletions
diff --git a/addons/mail/static/src/xml/activity_view.xml b/addons/mail/static/src/xml/activity_view.xml
index 2db197373b7..c40d6d73b7d 100644
--- a/addons/mail/static/src/xml/activity_view.xml
+++ b/addons/mail/static/src/xml/activity_view.xml
@@ -1,54 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
-<t t-name="mail.ActivityViewHeader">
+<t t-name="mail.ActivityViewHeader" owl="1">
<thead>
<tr>
<th></th>
- <th t-foreach="types" t-as="type" class="o_activity_type_cell" t-att-data-activity-type-id="type[0]" t-attf-width="#{100/types.length}%">
+ <th t-foreach="props.activity_types" t-as="type" t-key="type[0]"
+ class="o_activity_type_cell" t-attf-class="{{ activeFilter.activityTypeId === type[0] ? 'o_activity_filter_' + activeFilter.state : '' }}"
+ t-att-data-activity-type-id="type[0]" t-attf-width="{{100/props.activity_types.length}}%">
<div>
- <span><t t-esc="type[1]"/></span>
+ <span t-esc="type[1]"/>
<span t-if="type[2].length > 0" class="dropdown pull-right">
<i class="fa fa-ellipsis-v fa-fw" data-toggle="dropdown"/>
<div class="dropdown-menu">
- <div t-foreach="type[2]" t-as="template" title="This action will send an email." class="o_template_element o_send_mail_template" t-att-data-template-id="template.id">
- <i class="fa fa-envelope fa-fw"/> <t t-esc="template.name"/>
- </div>
+ <t t-foreach="type[2]" t-as="template" t-key="template.id">
+ <div title="This action will send an email."
+ class="o_template_element o_send_mail_template"
+ t-att-data-activity-type-id="type[0]"
+ t-att-data-template-id="template.id"
+ t-on-click="_onSendMailTemplateClicked">
+ <i class="fa fa-envelope fa-fw"/> <t t-esc="template.name"/>
+ </div>
+ </t>
</div>
</span>
</div>
- <div t-if="activityTypeIDs.length and !_.contains(activityTypeIDs, type[0])" class="mt24"/>
+ <KanbanColumnProgressBarAdapter Component="widgetComponents.KanbanColumnProgressBar"
+ widgetArgs="[getProgressBarOptions(type[0]), getProgressBarColumnState(type[0])]"
+ t-if="activityTypeIds.includes(type[0])"
+ t-on-set-progress-bar-state="_onSetProgressBarState"/>
+ <div t-else="" class="mt24"/>
</th>
</tr>
</thead>
</t>
-<t t-name="mail.ActivityViewRow">
- <td t-att-data-res-id="resId" t-att-data-activity-type-id="activityTypeId"
- t-attf-class="o_activity_summary_cell #{activityGroup.state ? activityGroup.state : 'o_activity_empty_cell'} #{_.contains(widget.filteredResIDs, resId) ? 'o_activity_filter_' + widget.activeFilter : ''}">
- <i t-if="!activityGroup.state" title="Create" class="text-center fa fa-plus"/>
+<t t-name="mail.ActivityViewBody" owl="1">
+ <tbody>
+ <t t-foreach="activityResIds" t-as="resId" t-key="resId">
+ <t t-call="mail.ActivityViewRow"/>
+ </t>
+ </tbody>
+</t>
+
+<t t-name="mail.ActivityViewRow" owl="1">
+ <tr class="o_data_row" t-att-data-res-id="resId">
+ <t t-set="record" t-value="props.data.find(data => data.res_id === resId)"/>
+ <td t-attf-class="{{ activeFilter.resIds.includes(resId) ? 'o_activity_filter_' + activeFilter.state : '' }}">
+ <ActivityRecordAdapter Component="widgetComponents.ActivityRecord"
+ widgetArgs="[record, { qweb: qweb }]"/>
+ </td>
+ <t t-foreach="props.activity_types" t-as="type" t-key="type[0]">
+ <t t-call="mail.ActivityViewCell"/>
+ </t>
+ </tr>
+</t>
+
+<t t-name="mail.ActivityViewCell" owl="1">
+ <t t-set="activityGroup" t-value="props.grouped_activities[resId] and props.grouped_activities[resId][type[0]] or {count: 0, ids: [], state: false}"/>
+ <td t-if="activityGroup.state" t-att-data-res-id="resId" t-att-data-activity-type-id="type[0]"
+ t-attf-class="o_activity_summary_cell {{activityGroup.state}} {{ activeFilter.resIds.includes(resId) ? 'o_activity_filter_' + activeFilter.state : '' }}">
+ <ActivityCellAdapter Component="widgetComponents.ActivityCell"
+ widgetArgs="['activity_ids', props.getKanbanActivityData(activityGroup, resId)]"/>
+ </td>
+ <td t-else="" t-att-data-res-id="resId" t-att-data-activity-type-id="type[0]"
+ class="o_activity_summary_cell o_activity_empty_cell"
+ t-attf-class="{{ activeFilter.resIds.includes(resId) ? 'o_activity_filter_' + activeFilter.state : '' }}"
+ t-on-click.prevent.stop="_onEmptyCellClicked">
+ <i title="Create" class="text-center fa fa-plus"/>
</td>
</t>
-<t t-name="mail.ActivityViewFooter">
+<t t-name="mail.ActivityViewFooter" owl="1">
<tfoot>
<tr class="o_data_row">
- <td class="o_record_selector p-3">
+ <td class="o_record_selector p-3" t-on-click.prevent.stop="trigger('schedule_activity')">
<span class="fa fa-plus pr-2"/><span>Schedule activity</span>
</td>
</tr>
</tfoot>
</t>
-<t t-name="mail.ActivityView">
- <div t-if="isEmpty" class="o_view_nocontent" role="alert">
- <div class="o_nocontent_help">
- <p class="o_view_nocontent_empty_folder">
- No data to display
- </p>
- </div>
- </div>
- <table t-else="" class="table-bordered mb-5"/>
-</t>
+<div t-name="mail.ActivityRenderer" class="o_activity_view" owl="1">
+ <t t-if="!props.activity_types.length" t-call="web.NoContentHelper"/>
+ <table t-else="" class="table-bordered mb-5">
+ <t t-call="mail.ActivityViewHeader"/>
+ <t t-call="mail.ActivityViewBody"/>
+ <t t-call="mail.ActivityViewFooter"/>
+ </table>
+</div>
</templates>