Fix missing status borders

This commit is contained in:
Nathan Gray 2015-11-12 18:22:48 +00:00
parent 9f8a08fb4a
commit 948bf94f67
2 changed files with 26 additions and 15 deletions

View File

@ -220,9 +220,12 @@ var et2_calendar_event = et2_valueWidget.extend([et2_IDetachedDOM],
// Remove any resize classes, the handles are gone due to empty() // Remove any resize classes, the handles are gone due to empty()
.removeClass('ui-resizable') .removeClass('ui-resizable')
.addClass(event.class) .addClass(event.class)
.toggleClass('calendar_calEventPrivate', event.private); .toggleClass('calendar_calEventPrivate', typeof event.private !== 'undefined' && event.private);
this.options.class = event.class; this.options.class = event.class;
if(event.category) var status_class = this._status_class();
// Add category classes, if real categories are set
if(event.category && event.category != '0')
{ {
var cats = event.category.split(','); var cats = event.category.split(',');
for(var i = 0; i < cats.length; i++) for(var i = 0; i < cats.length; i++)
@ -232,7 +235,7 @@ var et2_calendar_event = et2_valueWidget.extend([et2_IDetachedDOM],
} }
this.div.toggleClass('calendar_calEventUnknown', event.participants[egw.user('account_id')] ? event.participants[egw.user('account_id')][0] === 'U' : false); this.div.toggleClass('calendar_calEventUnknown', event.participants[egw.user('account_id')] ? event.participants[egw.user('account_id')][0] === 'U' : false);
this.div.addClass(this._status_class()); this.div.addClass(status_class);
this.title.toggle(!event.whole_day_on_top); this.title.toggle(!event.whole_day_on_top);
this.body.toggleClass('calendar_calEventBodySmall', event.whole_day_on_top || false); this.body.toggleClass('calendar_calEventBodySmall', event.whole_day_on_top || false);
@ -248,8 +251,13 @@ var et2_calendar_event = et2_valueWidget.extend([et2_IDetachedDOM],
// Colors - don't make them transparent if there is no color // Colors - don't make them transparent if there is no color
if(jQuery.Color("rgba(0,0,0,0)").toRgbaString() != jQuery.Color(this.div,'background-color').toRgbaString()) if(jQuery.Color("rgba(0,0,0,0)").toRgbaString() != jQuery.Color(this.div,'background-color').toRgbaString())
{ {
this.div.css('border-color', this.div.css('background-color')); // Most statuses use colored borders
// Set title color based on background brightness if(status_class === 'calendar_calEventAllAccepted')
{
this.div.css('border-color', this.div.css('background-color'));
}
// Set title color based on background brightness
this.title this.title
.css('background-color', this.div.css('background-color')) .css('background-color', this.div.css('background-color'))
.css('color', jQuery.Color(this.div.css('background-color')).lightness() > 0.45 ? 'black':'white'); .css('color', jQuery.Color(this.div.css('background-color')).lightness() > 0.45 ? 'black':'white');
@ -271,7 +279,9 @@ var et2_calendar_event = et2_valueWidget.extend([et2_IDetachedDOM],
} }
this.body this.body
// Set background color to a lighter version of the header color // Set background color to a lighter version of the header color
.css('background-color',jQuery.Color(this.title.css('background-color')).lightness("+=0.3")); .css('background-color',jQuery.Color(this.title.css('background-color')).lightness(
Math.max(0.8, parseFloat(jQuery.Color(this.title.css('background-color')).lightness()))
));
this.set_statustext(this._tooltip()); this.set_statustext(this._tooltip());
}, },
@ -328,12 +338,12 @@ var et2_calendar_event = et2_valueWidget.extend([et2_IDetachedDOM],
cat.destroy(); cat.destroy();
return '<div class="calendar_calEventTooltip ' + this._status_class() + '" style="border-color: '+border+'; background: '+bg_color+';">'+ return '<div class="calendar_calEventTooltip ' + this._status_class() + '" style="border-color: '+border+'; background: '+bg_color+';">'+
'<div class="calendar_calEventHeaderSmall" style="background-color: '+border+';">'+ '<div class="calendar_calEventHeaderSmall" style="background-color: '+this.title.css('background-color')+';">'+
'<font style="color:'+header_color+'">'+this._get_timespan(this.options.value)+'</font>'+ '<font style="color:'+header_color+'">'+this._get_timespan(this.options.value)+'</font>'+
this.icons[0].outerHTML+ this.icons[0].outerHTML+
'</div>'+ '</div>'+
'<div class="calendar_calEventBodySmall" style="background-color: '+ '<div class="calendar_calEventBodySmall" style="background-color: '+
jQuery.Color(this.title.css('background-color')).lightness("+=0.3") + '">'+ jQuery.Color(this.title.css('background-color')).lightness("0.9") + '">'+
'<p style="margin: 0px;">'+ '<p style="margin: 0px;">'+
'<span class="calendar_calEventTitle">'+this.div.attr('data-title')+'</span><br>'+ '<span class="calendar_calEventTitle">'+this.div.attr('data-title')+'</span><br>'+
this.options.value.description+'</p>'+ this.options.value.description+'</p>'+

View File

@ -425,11 +425,7 @@ e.g. the div with class calendar_calTimeGrid is generated by the timeGridWidget
*/ */
border-color: #808080; border-color: #808080;
} }
.calendar_calEvent:not([class*="cat_"]) {
/* Defaults for no category, so we don't override it */
background-color: #808080;
border-color: #808080;
}
.calendar_calEvent:hover{ .calendar_calEvent:hover{
cursor: pointer; cursor: pointer;
} }
@ -454,16 +450,21 @@ e.g. the div with class calendar_calTimeGrid is generated by the timeGridWidget
.calendar_calEventAllAnswered { .calendar_calEventAllAnswered {
border-style: dotted; border-style: dotted;
border-width: 2px; border-width: 2px;
border-color: white;
} }
/** /**
* Some participants did NOT answer the invitation * Some participants did NOT answer the invitation
*/ */
.calendar_calEventSomeUnknown { .calendar_calEventSomeUnknown:not(.calendar_calEventUnknown) {
border-style: dashed; border-style: dashed;
border-width: 1px; border-width: 1px;
border-color: white;
}
.calendar_calEvent:not([class*="cat_"]) {
/* Defaults for no category, so we don't override it */
background-color: #808080;
} }
/** /**
* Events in the header (all day) * Events in the header (all day)
*/ */