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,12 +2100,22 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view.
if(!widget.disabled) rowCount++; if(!widget.disabled) rowCount++;
},this, et2_calendar_timegrid); },this, et2_calendar_timegrid);
// Take the whole tab height // Take the whole tab height, or home portlet
var height = jQuery(this.getInstanceManager().DOMContainer).parent().innerHeight(); if(this.getInstanceManager().app === 'home')
{
var height = jQuery(this.getParent().getDOMNode()).parentsUntil('.et2_portlet').last().parent().innerHeight();
// Allow for toolbar // Allow for portlet header
height -= jQuery('#calendar-toolbar',this.div.parents('.egw_fw_ui_tab_content')).outerHeight(true); 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); this.options.height = Math.floor(height / rowCount);
// Allow for borders & padding // Allow for borders & padding
@ -2118,7 +2128,16 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view.
this.gridHeader.outerHeight(); this.gridHeader.outerHeight();
var too_small = needed > this.options.height && this.options.granularity != 0; 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({ .css({
'overflow-y': too_small || _too_small ? 'auto' : 'hidden', 'overflow-y': too_small || _too_small ? 'auto' : 'hidden',
'overflow-x': '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 // 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 // Space for todos, if there
total_width -= jQuery(this.getInstanceManager().DOMContainer).siblings().has(':visible').not('#calendar-toolbar').outerWidth() 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 // update day widgets
for(var i = 0; i < this.day_widgets.length; i++) for(var i = 0; i < this.day_widgets.length; i++)
{ {