Fixes for errors when closing calendar tab, which broke tabs at the framework level

This commit is contained in:
Nathan Gray 2016-01-28 16:59:23 +00:00
parent c3f12efd2e
commit b5be17ad9c
2 changed files with 24 additions and 13 deletions

View File

@ -3176,7 +3176,7 @@ app.classes.calendar = AppJS.extend(
}
});
// Dynamic resize to fill sidebox
// Dynamic resize of sidebox calendar to fill sidebox
var preferred_width = $j('#calendar-sidebox_date .ui-datepicker-inline').outerWidth();
var font_ratio = parseFloat($j(this.sidebox_et2.getDOMNode()).css('font-size')) / parseFloat($j('#calendar-sidebox_date .ui-datepicker-inline').css('font-size'));
@ -3187,15 +3187,17 @@ app.classes.calendar = AppJS.extend(
.css('font-size',(percent*100)+'%');
// Position today
var buttons = $j('#calendar-sidebox_date .ui-datepicker-header a');
var left = Infinity;
var total = 0;
buttons.each(function() {
total += $j(this).position().left;
});
// Why doesn't this work properly?
var today = $j('#calendar-sidebox_header_today')
.position({my: 'center left', at: 'center right',of: buttons});
today.css('left',(total/buttons.length)/*+(today.width()/2)*/)
var today = $j('#calendar-sidebox_header_today');
if(today.length)
{
today.position({my: 'center left', at: 'center right',of: buttons});
today.css('left',(total/buttons.length));
}
}).trigger('resize');
}

View File

@ -134,7 +134,10 @@ var et2_calendar_timegrid = et2_calendar_view.extend([et2_IDetachedDOM, et2_IRes
destroy: function() {
// Stop listening to tab changes
$j(framework.getApplicationByName('calendar').tab.contentDiv).off('show.' + this.id);
if(framework.getApplicationByName('calendar').tab)
{
$j(framework.getApplicationByName('calendar').tab.contentDiv).off('show.' + this.id);
}
this._super.apply(this, arguments);
@ -163,13 +166,19 @@ var et2_calendar_timegrid = et2_calendar_view.extend([et2_IDetachedDOM, et2_IRes
this._super.apply(this, arguments);
// Listen to tab show to make sure we scroll to the day start, not top
$j(framework.getApplicationByName('calendar').tab.contentDiv)
.on('show.' + this.id, jQuery.proxy(
function()
{
this.scrolling.scrollTop(this._top_time);
},this)
);
if(framework.getApplicationByName('calendar').tab)
{
$j(framework.getApplicationByName('calendar').tab.contentDiv)
.on('show.' + this.id, jQuery.proxy(
function()
{
if(this.scrolling)
{
this.scrolling.scrollTop(this._top_time);
}
},this)
);
}
// Need to get the correct internal sizing
this.resize();