CC-5371 : Fail to extend/shrink show by drag

window rezie event was triggered when resizing the show, caused problem.
Using the windowResize callback provided by fullcalendar now.
This commit is contained in:
Naomi 2013-10-10 17:38:49 -04:00
parent 17fd06090f
commit 2ef95db747
7 changed files with 27 additions and 253 deletions

View file

@ -749,27 +749,3 @@ function alertShowErrorAndReload(){
alert($.i18n._("The show instance doesn't exist anymore!"));
window.location.reload();
}
function windowResize() {
var windowWidth = $(this).width();
// margin on showform are 16 px on each side
if(!$("#schedule-add-show").is(':hidden')){
var calendarWidth = 100-(($("#schedule-add-show").width() + (16 * 4))/windowWidth*100);
var widthPercent = parseInt(calendarWidth)+"%";
$("#schedule_calendar").css("width", widthPercent);
} else {
$("#schedule_calendar").css("width", 98.5+"%");
}
// 200 px for top dashboard and 50 for padding on main content
// this calculation was copied from schedule.js line 326
var mainHeight = document.documentElement.clientHeight - 200 - 50;
$('#schedule_calendar').fullCalendar('option', 'contentHeight', mainHeight);
}
var scheduleResizeTimeout;
$(window).resize(function(){
clearTimeout(scheduleResizeTimeout);
scheduleResizeTimeout = setTimeout(windowResize, 100);
});

View file

@ -374,6 +374,24 @@ function eventResize( event, dayDelta, minuteDelta, revertFunc, jsEvent, ui, vie
});
}
function windowResize() {
var windowWidth = $(this).width();
// margin on showform are 16 px on each side
if(!$("#schedule-add-show").is(':hidden')){
var calendarWidth = 100-(($("#schedule-add-show").width() + (16 * 4))/windowWidth*100);
var widthPercent = parseInt(calendarWidth)+"%";
$("#schedule_calendar").css("width", widthPercent);
} else {
$("#schedule_calendar").css("width", 98.5+"%");
}
// 200 px for top dashboard and 50 for padding on main content
// this calculation was copied from schedule.js line 326
var mainHeight = document.documentElement.clientHeight - 200 - 50;
$('#schedule_calendar').fullCalendar('option', 'contentHeight', mainHeight);
}
function preloadEventFeed () {
var url = baseUrl+'Schedule/event-feed-preload';
var d = new Date();

View file

@ -319,7 +319,8 @@ function createFullCalendar(data){
eventRender: eventRender,
eventAfterRender: eventAfterRender,
eventDrop: eventDrop,
eventResize: eventResize
eventResize: eventResize,
windowResize: windowResize
});
}