From 948bf94f67d7bad975ea81c8bddb72a64cab3b89 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Thu, 12 Nov 2015 18:22:48 +0000 Subject: [PATCH] Fix missing status borders --- calendar/js/et2_widget_event.js | 26 ++++++++++++++++++-------- calendar/templates/default/app.css | 15 ++++++++------- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/calendar/js/et2_widget_event.js b/calendar/js/et2_widget_event.js index 3e5a9c9090..abd18daf65 100644 --- a/calendar/js/et2_widget_event.js +++ b/calendar/js/et2_widget_event.js @@ -220,9 +220,12 @@ var et2_calendar_event = et2_valueWidget.extend([et2_IDetachedDOM], // Remove any resize classes, the handles are gone due to empty() .removeClass('ui-resizable') .addClass(event.class) - .toggleClass('calendar_calEventPrivate', event.private); + .toggleClass('calendar_calEventPrivate', typeof event.private !== 'undefined' && event.private); 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(','); 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.addClass(this._status_class()); + this.div.addClass(status_class); this.title.toggle(!event.whole_day_on_top); 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 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')); - // Set title color based on background brightness + // Most statuses use colored borders + if(status_class === 'calendar_calEventAllAccepted') + { + this.div.css('border-color', this.div.css('background-color')); + } + + // Set title color based on background brightness this.title .css('background-color', this.div.css('background-color')) .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 // 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()); }, @@ -328,12 +338,12 @@ var et2_calendar_event = et2_valueWidget.extend([et2_IDetachedDOM], cat.destroy(); return '
'+ - '
'+ + '
'+ ''+this._get_timespan(this.options.value)+''+ this.icons[0].outerHTML+ '
'+ '
'+ + jQuery.Color(this.title.css('background-color')).lightness("0.9") + '">'+ '

'+ ''+this.div.attr('data-title')+'
'+ this.options.value.description+'

'+ diff --git a/calendar/templates/default/app.css b/calendar/templates/default/app.css index dddba2760b..235f1de43c 100644 --- a/calendar/templates/default/app.css +++ b/calendar/templates/default/app.css @@ -425,11 +425,7 @@ e.g. the div with class calendar_calTimeGrid is generated by the timeGridWidget */ 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{ cursor: pointer; } @@ -454,16 +450,21 @@ e.g. the div with class calendar_calTimeGrid is generated by the timeGridWidget .calendar_calEventAllAnswered { border-style: dotted; border-width: 2px; + border-color: white; } /** * Some participants did NOT answer the invitation */ -.calendar_calEventSomeUnknown { +.calendar_calEventSomeUnknown:not(.calendar_calEventUnknown) { border-style: dashed; 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) */