Fix resize issues with etemplate2 / calendar

This commit is contained in:
Nathan Gray 2016-02-10 16:50:42 +00:00
parent c25403bec7
commit c8cf2d30d8
3 changed files with 22 additions and 22 deletions

View File

@ -3219,23 +3219,27 @@ app.classes.calendar = AppJS.extend(
var preferred_width = $j('#calendar-sidebox_date .ui-datepicker-inline').outerWidth();
var font_ratio = 12 / parseFloat($j('#calendar-sidebox_date .ui-datepicker-inline').css('font-size'));
$j(window).on('resize.calendar'+date_widget.dom_id, function() {
var percent = 1+(($j(date_widget.getDOMNode()).width() - preferred_width) / preferred_width);
percent *= font_ratio;
$j('#calendar-sidebox_date .ui-datepicker-inline')
.css('font-size',(percent*100)+'%');
try {
var percent = 1+(($j(date_widget.getDOMNode()).width() - preferred_width) / preferred_width);
percent *= font_ratio;
$j('#calendar-sidebox_date .ui-datepicker-inline')
.css('font-size',(percent*100)+'%');
// Position go and today
var buttons = $j('#calendar-sidebox_date .ui-datepicker-header a span');
if(today.length && go_button.length)
{
go_button.position({my: 'left+15px center', at: 'right center-1',of: $j('#calendar-sidebox_date .ui-datepicker-year')});
today.css({
'left': (buttons.first().offset().left + buttons.last().offset().left)/2 - Math.ceil(today.outerWidth(true)/2),
'top': go_button.css('top')
});
// Position go and today
var buttons = $j('#calendar-sidebox_date .ui-datepicker-header a span');
if(today.length && go_button.length)
{
go_button.position({my: 'left+15px center', at: 'right center-1',of: $j('#calendar-sidebox_date .ui-datepicker-year')});
today.css({
'left': (buttons.first().offset().left + buttons.last().offset().left)/2 - Math.ceil(today.outerWidth(true)/2),
'top': go_button.css('top')
});
}
} catch (e){
// Resize didn't work
}
}).trigger('resize');
}
// Avoid wrapping owner icons if user has group + search

View File

@ -1706,9 +1706,6 @@ var et2_calendar_timegrid = et2_calendar_view.extend([et2_IDetachedDOM, et2_IRes
return;
}
// Set the max width to avoid animations screwing up the width
this.div.css('max-width',$j(this.getInstanceManager().DOMContainer).width());
/*
We expect the timegrid to be in a table with 0 or more other timegrids,
1 per row. We want each timegrid to be as large as possible, but space
@ -1775,7 +1772,7 @@ var et2_calendar_timegrid = et2_calendar_view.extend([et2_IDetachedDOM, et2_IRes
}
// Try to resize width, though animations cause problems
var total_width = this.days.width();
var total_width = $j(this.getInstanceManager().DOMContainer).parent().innerWidth() - this.days.position().left;
var day_width = (total_width > 0 ? total_width : $j(this.getInstanceManager().DOMContainer).width())/this.day_widgets.length;
// update day widgets
for(var i = 0; i < this.day_widgets.length; i++)

View File

@ -148,19 +148,18 @@ etemplate2.prototype.resize = function(e)
var appHeader = $j('#divAppboxHeader');
//Calculate the excess height
excess_height = egw(window).is_popup()? $j(window).height() - $j('.et2_container').height() - appHeader.outerHeight()+11: false;
excess_height = egw(window).is_popup()? $j(window).height() - $j(self.DOMContainer).height() - appHeader.outerHeight()+11: false;
// Recalculate excess height if the appheader is shown
if (appHeader.length > 0 && appHeader.is(':visible')) excess_height -= appHeader.outerHeight()-9;
// Do not resize if the template height is bigger than screen available height
// For templates which have sub templates and they are bigger than screenHeight
if(screen.availHeight < $j('.et2_container').height()) excess_height = 0;
if(screen.availHeight < $j(self.DOMContainer).height()) excess_height = 0;
// Call the "resize" event of all functions which implement the
// "IResizeable" interface
self.widgetContainer.iterateOver(function(_widget) {
if (excess_height != 0 || excess_height === false) _widget.resize(excess_height);
_widget.resize(excess_height);
}, self, et2_IResizeable);
}
},100);