Skip to content

Instantly share code, notes, and snippets.

@siguremon
Created May 4, 2013 18:17
Show Gist options
  • Select an option

  • Save siguremon/5518280 to your computer and use it in GitHub Desktop.

Select an option

Save siguremon/5518280 to your computer and use it in GitHub Desktop.
Ruby on Railsとfullcalendar pluginでGoogleカレンダークローンを作る(2) ref: http://qiita.com/items/10216d15471dfe5ba572
$(document).ready(function() {
var select = function(start, end, allDay) {
var title = window.prompt("title");
var data = {event: {title: title,
start: start,
end: end,
allDay: allDay}};
$.ajax({
type: "POST",
url: "/events",
data: data,
success: function() {
calendar.fullCalendar('refetchEvents');
}
});
calendar.fullCalendar('unselect');
};
var calendar = $('#calendar').fullCalendar({
events: '/events.json',
selectable: true,
selectHelper: true,
ignoreTimezone: false,
select: select
});
});
bundle exec rails g scaffold event title start:datetime end:datetime color allDay:boolean
bundle exec rake db:migrate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment