What’s a good way to learn how to convert javascript to coffeescript?
I’m adding Fullcalendar to my RoR app. The following code is from one of the Fullcalendar demos.
select: function(start, end, allDay) {
var title = prompt('Event Title:');
if (title) {
calendar.fullCalendar('renderEvent',
{
title: title,
start: start,
end: end,
allDay: allDay
},
true // make the event "stick"
);
}
calendar.fullCalendar('unselect');
},
I need to learn how to turn that code into coffeescript.
Thanks!
The CoffeeScript page has a good comparison.
In rails you can append .coffee to your javascript filename and sprockets will then compile the CoffeeScript into javascript.
It should look something like this: