');
placeHolder.attr('data-template', 'core_calendar/threemonth_month');
placeHolder.attr('data-includenavigation', false);
placeHolder.attr('data-mini', true);
var placeHolderContainer = $('');
placeHolderContainer.hide();
placeHolderContainer.append(placeHolder);
var requestYear;
var requestMonth;
var oldMonth;
if (newParent.is(previousMonth)) {
// Fetch the new previous month.
placeHolderContainer.insertBefore(previousMonth);
requestYear = previousMonth.data('previousYear');
requestMonth = previousMonth.data('previousMonth');
oldMonth = nextMonth;
} else if (newParent.is(nextMonth)) {
// Fetch the new next month.
placeHolderContainer.insertAfter(nextMonth);
requestYear = nextMonth.data('nextYear');
requestMonth = nextMonth.data('nextMonth');
oldMonth = previousMonth;
}
return CalendarViewManager.refreshMonthContent(
placeHolder,
requestYear,
requestMonth,
courseId,
categoryId,
placeHolder
)
.then(function() {
var slideUpPromise = $.Deferred();
var slideDownPromise = $.Deferred();
oldMonth.slideUp('fast', function() {
$(this).remove();
slideUpPromise.resolve();
});
placeHolderContainer.slideDown('fast', function() {
slideDownPromise.resolve();
});
return $.when(slideUpPromise, slideDownPromise);
});
};
};
return {
init: function(root) {
root = $(root);
registerCalendarEventListeners(root);
}
};
});