Created
May 4, 2013 18:17
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(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 | |
| }); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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