Could anyone please tell me coffeescript doesn’t treat that method `drop as another parameter?
$('#id-calendar').fullCalendar
aspectRatio: 0.5
editable: true
droppable: true
defaultView: 'agendaWeek'
slotMinutes: 120
minTime: 8
maxTime: 20
firstDay: startDate()
drop = (date, allDay, jsEvent, ui) ->
console.log(date)
console.log(allDay)
console.log(jsEvent)
console.log(ui)
originalEventObject = $(this).data('eventObject')
copiedEventObject = $.extend({}, originalEventObject)
copiedEventObject.start = date
copiedEventObject.allDay = allDay
$('#id-calendar').fullCalendar('renderEvent', copiedEventObject, true)
$(this).remove()
return true
The output is:
var drop;
$(document).ready(function() {
var startDate;
startDate = function() {
var day, today;
today = new Date();
day = today.getDay();
switch (day - 2) {
case -1:
return 6;
case -2:
return 5;
default:
return day - 2;
}
};
return $('#external-events div.external-event').each(function() {
var eventObject;
eventObject = {
title: $.trim($(this).text())
};
$(this).data('eventObject', eventObject);
return $(this).draggable({
zIndex: 999,
evert: true,
revertDuration: 0
});
});
});
$('#id-calendar').fullCalendar({
aspectRatio: 0.5,
editable: true,
droppable: true,
defaultView: 'agendaWeek',
slotMinutes: 120,
minTime: 8,
maxTime: 20,
firstDay: startDate()
}, drop = function(date, allDay, jsEvent, ui) { === BUG
var copiedEventObject, originalEventObject;
console.log(date);
console.log(allDay);
console.log(jsEvent);
console.log(ui);
originalEventObject = $(this).data('eventObject');
copiedEventObject = $.extend({}, originalEventObject);
copiedEventObject.start = date;
copiedEventObject.allDay = allDay;
$('#id-calendar').fullCalendar('renderEvent', copiedEventObject, true);
$(this).remove();
return true;
});
It should be
and not
drop =.