From cbfb3816a90e445c1f0157ea2dc522a7cab3c58b Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Wed, 13 Jan 2016 16:30:41 +0000 Subject: [PATCH] Fix updating while not visible gave wrong values --- calendar/js/et2_widget_event.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/calendar/js/et2_widget_event.js b/calendar/js/et2_widget_event.js index ad2c6d839c..ebb579362b 100644 --- a/calendar/js/et2_widget_event.js +++ b/calendar/js/et2_widget_event.js @@ -284,6 +284,11 @@ var et2_calendar_event = et2_valueWidget.extend([et2_IDetachedDOM], var title = !event.is_private ? event['title'] : egw.lang('private'); // If there isn't enough height for header + 1 line in the body, it's small var small_height = this.div.innerHeight() <= this.title.height() * 2; + if(!this.title.height()) + { + // Handle sizing while hidden, such as when calendar is not the active tab + small_height = egw.getHiddenDimensions(this.div).h < egw.getHiddenDimensions(this.title).h * 2 + } this.div.attr('data-title', title); this.title.text(small_height ? title : this._get_timespan(event)); @@ -359,6 +364,7 @@ var et2_calendar_event = et2_valueWidget.extend([et2_IDetachedDOM], var border = this.div.css('borderTopColor'); var bg_color = this.div.css('background-color'); var header_color = this.title.css('color'); + var timespan = this._get_timespan(this.options.value); this._parent.date_helper.set_value(this.options.value.start.valueOf ? new Date(this.options.value.start) : this.options.value.start); var start = this._parent.date_helper.input_date.val(); @@ -366,7 +372,7 @@ var et2_calendar_event = et2_valueWidget.extend([et2_IDetachedDOM], var end = this._parent.date_helper.input_date.val(); var times = !this.options.value.multiday ? - ''+this.egw().lang('Time')+':' + this._get_timespan(this.options.value) : + ''+this.egw().lang('Time')+':' + timespan : ''+this.egw().lang('Start') + ':' +start+ ''+this.egw().lang('End') + ':' + end var cat = et2_createWidget('select-cat',{'readonly':true},this); @@ -383,7 +389,7 @@ var et2_calendar_event = et2_valueWidget.extend([et2_IDetachedDOM], return '
'+ '
'+ - ''+this._get_timespan(this.options.value)+''+ + ''+timespan+''+ this.icons[0].outerHTML+ '
'+ '