fullcalendar.api.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /**
  2. * FullCalendar plugin implementation.
  3. */
  4. Drupal.fullcalendar.plugins.awesome = {
  5. /**
  6. * Add in FullCalendar options.
  7. *
  8. * @param fullcalendar
  9. * The fullcalendar object.
  10. *
  11. * @see http://arshaw.com/fullcalendar/docs
  12. */
  13. options: function (fullcalendar) {
  14. var settings = Drupal.settings.fullcalendar[fullcalendar.dom_id].awesome;
  15. var options = $.extend(
  16. {
  17. theme: false,
  18. minTime: 9,
  19. maxTime: 17
  20. },
  21. settings
  22. );
  23. return options;
  24. },
  25. /**
  26. * Respond to a jQuery UI draggable event being dropped onto the calendar.
  27. *
  28. * @param date
  29. * The JavaScript Date object of where the event was dropped.
  30. * @param allDay
  31. * A Boolean of where the event was dropped, TRUE for an all-day cell, or
  32. * FALSE for a slot with a specific time.
  33. * @param jsEvent
  34. * The primitive JavaScript event, with information like mouse coordinates.
  35. * @param ui
  36. * The jQuery UI information.
  37. * @param object
  38. * The DOM element that has been dropped.
  39. * @param fullcalendar
  40. * The fullcalendar object.
  41. */
  42. drop: function (date, allDay, jsEvent, ui, object, fullcalendar) {
  43. var eventObject = $.extend({}, $(object).data('eventObject'));
  44. eventObject.start = date;
  45. eventObject.allDay = allDay ? 1 : 0;
  46. fullcalendar.$calendar.find('.fullcalendar').fullCalendar('renderEvent', eventObject, true);
  47. }
  48. };