Better sizing for calendar in home

This commit is contained in:
nathangray 2016-07-21 16:53:39 -06:00
parent 519eaf2b3c
commit 386368da6e

View File

@ -2100,11 +2100,21 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view.
if(!widget.disabled) rowCount++;
},this, et2_calendar_timegrid);
// Take the whole tab height
// Take the whole tab height, or home portlet
if(this.getInstanceManager().app === 'home')
{
var height = jQuery(this.getParent().getDOMNode()).parentsUntil('.et2_portlet').last().parent().innerHeight();
// Allow for portlet header
height -= jQuery('.ui-widget-header',this.div.parents('.egw_fw_ui_tab_content')).outerHeight(true);
}
else
{
var height = jQuery(this.getInstanceManager().DOMContainer).parent().innerHeight();
// Allow for toolbar
height -= jQuery('#calendar-toolbar',this.div.parents('.egw_fw_ui_tab_content')).outerHeight(true);
}
this.options.height = Math.floor(height / rowCount);
@ -2118,7 +2128,16 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view.
this.gridHeader.outerHeight();
var too_small = needed > this.options.height && this.options.granularity != 0;
jQuery(this.getInstanceManager().DOMContainer)
if(this.getInstanceManager().app === 'home')
{
var modify_node = jQuery(this.getParent().getDOMNode()).parentsUntil('.et2_portlet').last();
}
else
{
var modify_node = jQuery(this.getInstanceManager().DOMContainer);
}
modify_node
.css({
'overflow-y': too_small || _too_small ? 'auto' : 'hidden',
'overflow-x': 'hidden',
@ -2153,11 +2172,11 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view.
}
// Try to resize width, though animations cause problems
var total_width = jQuery(this.getInstanceManager().DOMContainer).parent().innerWidth() - this.days.position().left;
var total_width = modify_node.parent().innerWidth() - this.days.position().left;
// Space for todos, if there
total_width -= jQuery(this.getInstanceManager().DOMContainer).siblings().has(':visible').not('#calendar-toolbar').outerWidth()
var day_width = (total_width > 0 ? total_width : jQuery(this.getInstanceManager().DOMContainer).width())/this.day_widgets.length;
var day_width = (total_width > 0 ? total_width : modify_node.width())/this.day_widgets.length;
// update day widgets
for(var i = 0; i < this.day_widgets.length; i++)
{