javascript.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. angular
  2. .module('mwl.calendar.docs') //you will need to declare your module with the dependencies ['mwl.calendar', 'ui.bootstrap', 'ngAnimate']
  3. .controller('KitchenSinkCtrl', function(moment, alert) {
  4. var vm = this;
  5. //These variables MUST be set as a minimum for the calendar to work
  6. vm.calendarView = 'month';
  7. vm.viewDate = new Date();
  8. vm.events = [
  9. {
  10. title: 'An event',
  11. type: 'warning',
  12. startsAt: moment().startOf('week').subtract(2, 'days').add(8, 'hours').toDate(),
  13. endsAt: moment().startOf('week').add(1, 'week').add(9, 'hours').toDate(),
  14. draggable: true,
  15. resizable: true
  16. }, {
  17. title: '<i class="glyphicon glyphicon-asterisk"></i> <span class="text-primary">Another event</span>, with a <i>html</i> title',
  18. type: 'info',
  19. startsAt: moment().subtract(1, 'day').toDate(),
  20. endsAt: moment().add(5, 'days').toDate(),
  21. draggable: true,
  22. resizable: true
  23. }, {
  24. title: 'This is a really long event title that occurs on every year',
  25. type: 'important',
  26. startsAt: moment().startOf('day').add(7, 'hours').toDate(),
  27. endsAt: moment().startOf('day').add(19, 'hours').toDate(),
  28. recursOn: 'year',
  29. draggable: true,
  30. resizable: true
  31. }
  32. ];
  33. vm.isCellOpen = true;
  34. vm.eventClicked = function(event) {
  35. alert.show('Clicked', event);
  36. };
  37. vm.eventEdited = function(event) {
  38. alert.show('Edited', event);
  39. };
  40. vm.eventDeleted = function(event) {
  41. alert.show('Deleted', event);
  42. };
  43. vm.eventTimesChanged = function(event) {
  44. alert.show('Dropped or resized', event);
  45. };
  46. vm.toggle = function($event, field, event) {
  47. $event.preventDefault();
  48. $event.stopPropagation();
  49. event[field] = !event[field];
  50. };
  51. });