[IMP] web: Improve calendar display when no partner is set on event

Task:- 1906798
PR:- #28669
Co-authored By:-  Mohammed Shekha <msh@odoo.com>
This commit is contained in:
Vandan Shah
2019-02-05 11:45:29 +00:00
committed by Yannick Tivisse
parent 3272d2a384
commit f757b5eccd
2 changed files with 5 additions and 4 deletions
+2 -2
View File
@@ -14,7 +14,7 @@
<t t-name="calendar-box">
<t t-set="color" t-value="widget.getColor(event.color_index)"/>
<div t-att-style="typeof color === 'string' ? ('background-color:'+color)+';' : ''" t-attf-class="#{record.is_highlighted &amp;&amp; record.is_highlighted.value ? 'o_event_hightlight' : ''} #{typeof color === 'number' ? 'o_calendar_color_'+color : ''}">
<div t-att-style="typeof color === 'string' ? ('background-color:'+color)+';' : ''" t-attf-class="#{!event.color_index ? 'text-white' : ''} #{record.is_highlighted &amp;&amp; record.is_highlighted.value ? 'o_event_hightlight' : ''} #{typeof color === 'number' ? 'o_calendar_color_'+color : ''}">
<div class="fc-time"/>
<div class="o_fields">
<t t-foreach="widget.displayFields" t-as="name">
@@ -52,7 +52,7 @@
<t t-if="filter.value == 'all'">
<span><i class="fa fa-users fa-fw o_cal_avatar" role="img" aria-label="Avatar" title="Avatar"/></span>
</t>
<t t-if="widget.avatar_field &amp;&amp; (filter.value != 'all')">
<t t-if="widget.avatar_field &amp;&amp; (filter.value &amp;&amp; filter.value != 'all')">
<img t-attf-src="/web/image/#{widget.avatar_model}/#{filter.value}/#{widget.avatar_field}" class="o_cal_avatar" alt="Avatar"/>
</t>
<t t-set="color" t-value="widget.getColor(filter.color_index)"/>
@@ -125,7 +125,7 @@ QUnit.module('Views', {
};
QUnit.test('simple calendar rendering', function (assert) {
assert.expect(24);
assert.expect(25);
var done = assert.async();
this.data.event.records.push({
@@ -191,9 +191,10 @@ QUnit.module('Views', {
assert.ok($typeFilter.length, "should display 'user' filter");
assert.strictEqual($typeFilter.find('.o_calendar_filter_item').length, 3, "should display 3 filter items for 'user'");
// filters which has no value should show with string "Undefined" and should show at the last
// filters which has no value should show with string "Undefined", should not have any user image and should show at the last
assert.strictEqual($typeFilter.find('.o_calendar_filter_item:last').data('value'), false, "filters having false value should be displayed at last in filter items");
assert.strictEqual($typeFilter.find('.o_calendar_filter_item:last span').text(), "Undefined", "filters having false value should display 'Undefined' string");
assert.strictEqual($typeFilter.find('.o_calendar_filter_item:last label img').length, 0, "filters having false value should not have any user image");
var $attendeesFilter = $sidebar.find('.o_calendar_filter:has(h3:contains(attendees))');
assert.ok($attendeesFilter.length, "should display 'attendees' filter");