PageRenderTime 51ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

/src/Oro/Bundle/CalendarBundle/Resources/public/js/calendar/event/collection.js

https://github.com/diimpp/platform
JavaScript | 59 lines | 23 code | 6 blank | 30 comment | 0 complexity | 000da826c658ac52576237460b86b35a MD5 | raw file
  1. /*global define*/
  2. define(['backbone', 'routing', 'orocalendar/js/calendar/event/model'
  3. ], function (Backbone, routing, EventModel) {
  4. 'use strict';
  5. /**
  6. * @export orocalendar/js/calendar/event/collection
  7. * @class orocalendar.calendar.event.Collection
  8. * @extends Backbone.Collection
  9. */
  10. return Backbone.Collection.extend({
  11. route: 'oro_api_get_calendarevents',
  12. url: null,
  13. model: EventModel,
  14. /**
  15. * Calendar id
  16. * @property {int}
  17. */
  18. calendar: null,
  19. /**
  20. * Determine whether events from connected calendars should be included or not
  21. * @property {bool}
  22. */
  23. subordinate: false,
  24. /**
  25. * Sets a range of calendar events this collection works with
  26. *
  27. * @param {string} start A date/time specifies the begin of a range. RFC 3339 string
  28. * @param {string} end A date/time specifies the end of a range. RFC 3339 string
  29. */
  30. setRange: function (start, end) {
  31. this.url = routing.generate(
  32. this.route,
  33. {calendar: this.calendar, start: start, end: end, subordinate: this.subordinate}
  34. );
  35. },
  36. /**
  37. * Sets a calendar this collection works with
  38. *
  39. * @param {int} calendarId
  40. */
  41. setCalendar: function (calendarId) {
  42. this.calendar = calendarId;
  43. },
  44. /**
  45. * Gets a calendar this collection works with
  46. *
  47. * @return {int} The calendar id
  48. */
  49. getCalendar: function () {
  50. return this.calendar;
  51. }
  52. });
  53. });