fullcalendar.io-rails 2.3.1 → 2.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/lib/fullcalendar.io/rails/version.rb +1 -1
  3. data/vendor/assets/javascripts/fullcalendar.js +415 -326
  4. data/vendor/assets/javascripts/fullcalendar/gcal.js +1 -1
  5. data/vendor/assets/javascripts/fullcalendar/lang-all.js +4 -4
  6. data/vendor/assets/javascripts/fullcalendar/lang/ar-ma.js +1 -1
  7. data/vendor/assets/javascripts/fullcalendar/lang/ar-sa.js +1 -1
  8. data/vendor/assets/javascripts/fullcalendar/lang/ar-tn.js +1 -1
  9. data/vendor/assets/javascripts/fullcalendar/lang/ar.js +1 -1
  10. data/vendor/assets/javascripts/fullcalendar/lang/bg.js +1 -1
  11. data/vendor/assets/javascripts/fullcalendar/lang/ca.js +1 -1
  12. data/vendor/assets/javascripts/fullcalendar/lang/cs.js +1 -1
  13. data/vendor/assets/javascripts/fullcalendar/lang/da.js +1 -1
  14. data/vendor/assets/javascripts/fullcalendar/lang/de-at.js +1 -1
  15. data/vendor/assets/javascripts/fullcalendar/lang/de.js +1 -1
  16. data/vendor/assets/javascripts/fullcalendar/lang/el.js +1 -1
  17. data/vendor/assets/javascripts/fullcalendar/lang/en-au.js +1 -1
  18. data/vendor/assets/javascripts/fullcalendar/lang/en-ca.js +1 -1
  19. data/vendor/assets/javascripts/fullcalendar/lang/en-gb.js +1 -1
  20. data/vendor/assets/javascripts/fullcalendar/lang/es.js +1 -1
  21. data/vendor/assets/javascripts/fullcalendar/lang/fa.js +1 -1
  22. data/vendor/assets/javascripts/fullcalendar/lang/fi.js +1 -1
  23. data/vendor/assets/javascripts/fullcalendar/lang/fr-ca.js +1 -1
  24. data/vendor/assets/javascripts/fullcalendar/lang/fr.js +1 -1
  25. data/vendor/assets/javascripts/fullcalendar/lang/he.js +1 -1
  26. data/vendor/assets/javascripts/fullcalendar/lang/hi.js +1 -1
  27. data/vendor/assets/javascripts/fullcalendar/lang/hr.js +1 -1
  28. data/vendor/assets/javascripts/fullcalendar/lang/hu.js +1 -1
  29. data/vendor/assets/javascripts/fullcalendar/lang/id.js +1 -1
  30. data/vendor/assets/javascripts/fullcalendar/lang/is.js +1 -1
  31. data/vendor/assets/javascripts/fullcalendar/lang/it.js +1 -1
  32. data/vendor/assets/javascripts/fullcalendar/lang/ja.js +1 -1
  33. data/vendor/assets/javascripts/fullcalendar/lang/ko.js +1 -1
  34. data/vendor/assets/javascripts/fullcalendar/lang/lt.js +1 -1
  35. data/vendor/assets/javascripts/fullcalendar/lang/lv.js +1 -1
  36. data/vendor/assets/javascripts/fullcalendar/lang/nb.js +1 -1
  37. data/vendor/assets/javascripts/fullcalendar/lang/nl.js +1 -1
  38. data/vendor/assets/javascripts/fullcalendar/lang/pl.js +1 -1
  39. data/vendor/assets/javascripts/fullcalendar/lang/pt-br.js +1 -1
  40. data/vendor/assets/javascripts/fullcalendar/lang/pt.js +1 -1
  41. data/vendor/assets/javascripts/fullcalendar/lang/ro.js +1 -1
  42. data/vendor/assets/javascripts/fullcalendar/lang/ru.js +1 -1
  43. data/vendor/assets/javascripts/fullcalendar/lang/sk.js +1 -1
  44. data/vendor/assets/javascripts/fullcalendar/lang/sl.js +1 -1
  45. data/vendor/assets/javascripts/fullcalendar/lang/sr-cyrl.js +1 -1
  46. data/vendor/assets/javascripts/fullcalendar/lang/sr.js +1 -1
  47. data/vendor/assets/javascripts/fullcalendar/lang/sv.js +1 -1
  48. data/vendor/assets/javascripts/fullcalendar/lang/th.js +1 -1
  49. data/vendor/assets/javascripts/fullcalendar/lang/tr.js +1 -1
  50. data/vendor/assets/javascripts/fullcalendar/lang/uk.js +1 -1
  51. data/vendor/assets/javascripts/fullcalendar/lang/vi.js +1 -1
  52. data/vendor/assets/javascripts/fullcalendar/lang/zh-cn.js +1 -1
  53. data/vendor/assets/javascripts/fullcalendar/lang/zh-tw.js +1 -1
  54. data/vendor/assets/stylesheets/fullcalendar.css +10 -2
  55. data/vendor/assets/stylesheets/fullcalendar.print.css +1 -1
  56. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 88164832c9115792cdcd55f5019c3a5191ef95a3
4
- data.tar.gz: 5f9ed3931f87d281d69797921c0d042639440698
3
+ metadata.gz: 3e0c3f8226be35a93a659007d0fa20fd66a6ff65
4
+ data.tar.gz: ae678572c60154cf91d4519c95315749b13fa9e8
5
5
  SHA512:
6
- metadata.gz: 60ba5deb818771fe237a523b5a996bbf20a02e188cccf4a22f750137320357e70669b0f3b1e7991d09d63e4b027621bbc678f4af887a696b61864c9f6169ce72
7
- data.tar.gz: 4ecff0028ae9d6a1de327685f474347b69008888e0c2962b437501e71643bbe68958ab312c09de7ac6ff7cb6bff36cce70648a193569c6ad1d6729b20b6a81d3
6
+ metadata.gz: ac1647ad46ab72f4aedd60e60825dd7cbb1e76a255969f4a0bc2700e04772e0e2d6e213a3e17b121ae62f3712963cc9e036e35cf38e28cb809ef85e093477d4e
7
+ data.tar.gz: 1b987ab4011b943ac1fef1f48f7b9111de448f46efbd0abe68cf62fa52bc4fd46072d9aa66a5ebbb56f58849890e81251176338a7ae0128411d164b4c2a28cb8
@@ -1,5 +1,5 @@
1
1
  module Fullcalendario
2
2
  module Rails
3
- VERSION = "2.3.1"
3
+ VERSION = "2.3.2"
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * FullCalendar v2.3.1
2
+ * FullCalendar v2.3.2
3
3
  * Docs & License: http://fullcalendar.io/
4
4
  * (c) 2015 Adam Shaw
5
5
  */
@@ -18,7 +18,7 @@
18
18
 
19
19
  ;;
20
20
 
21
- var fc = $.fullCalendar = { version: "2.3.1" };
21
+ var fc = $.fullCalendar = { version: "2.3.2" };
22
22
  var fcViews = fc.views = {};
23
23
 
24
24
 
@@ -45,7 +45,7 @@ $.fn.fullCalendar = function(options) {
45
45
  }
46
46
  // a new calendar initialization
47
47
  else if (!calendar) { // don't initialize twice
48
- calendar = new fc.CalendarBase(element, options);
48
+ calendar = new Calendar(element, options);
49
49
  element.data('fullCalendar', calendar);
50
50
  calendar.render();
51
51
  }
@@ -63,41 +63,9 @@ var complexOptions = [ // names of options that are objects whose properties sho
63
63
  ];
64
64
 
65
65
 
66
- // Recursively combines all passed-in option-hash arguments into a new single option-hash.
67
- // Given option-hashes are ordered from lowest to highest priority.
68
- function mergeOptions() {
69
- var chain = Array.prototype.slice.call(arguments); // convert to a real array
70
- var complexVals = {}; // hash for each complex option's combined values
71
- var i, name;
72
- var combinedVal;
73
- var j;
74
- var val;
75
-
76
- // for each complex option, loop through each option-hash and accumulate the combined values
77
- for (i = 0; i < complexOptions.length; i++) {
78
- name = complexOptions[i];
79
- combinedVal = null; // an object holding the merge of all the values
80
-
81
- for (j = 0; j < chain.length; j++) {
82
- val = chain[j][name];
83
-
84
- if ($.isPlainObject(val)) {
85
- combinedVal = $.extend(combinedVal || {}, val); // merge new properties
86
- }
87
- else if (val != null) { // a non-null non-undefined atomic option
88
- combinedVal = null; // signal to use the atomic value
89
- }
90
- }
91
-
92
- // if not null, the final value was a combination of other objects. record it
93
- if (combinedVal !== null) {
94
- complexVals[name] = combinedVal;
95
- }
96
- }
97
-
98
- chain.unshift({}); // $.extend will mutate this with the result
99
- chain.push(complexVals); // computed complex values are applied last
100
- return $.extend.apply($, chain); // combine
66
+ // Merges an array of option objects into a single object
67
+ function mergeOptions(optionObjs) {
68
+ return mergeProps(optionObjs, complexOptions);
101
69
  }
102
70
 
103
71
 
@@ -160,6 +128,7 @@ fc.isInt = isInt;
160
128
  fc.htmlEscape = htmlEscape;
161
129
  fc.cssToStr = cssToStr;
162
130
  fc.proxy = proxy;
131
+ fc.capitaliseFirstLetter = capitaliseFirstLetter;
163
132
 
164
133
 
165
134
  /* FullCalendar-specific DOM Utilities
@@ -637,6 +606,55 @@ function isTimeString(str) {
637
606
  var hasOwnPropMethod = {}.hasOwnProperty;
638
607
 
639
608
 
609
+ // Merges an array of objects into a single object.
610
+ // The second argument allows for an array of property names who's object values will be merged together.
611
+ function mergeProps(propObjs, complexProps) {
612
+ var dest = {};
613
+ var i, name;
614
+ var complexObjs;
615
+ var j, val;
616
+ var props;
617
+
618
+ if (complexProps) {
619
+ for (i = 0; i < complexProps.length; i++) {
620
+ name = complexProps[i];
621
+ complexObjs = [];
622
+
623
+ // collect the trailing object values, stopping when a non-object is discovered
624
+ for (j = propObjs.length - 1; j >= 0; j--) {
625
+ val = propObjs[j][name];
626
+
627
+ if (typeof val === 'object') {
628
+ complexObjs.unshift(val);
629
+ }
630
+ else if (val !== undefined) {
631
+ dest[name] = val; // if there were no objects, this value will be used
632
+ break;
633
+ }
634
+ }
635
+
636
+ // if the trailing values were objects, use the merged value
637
+ if (complexObjs.length) {
638
+ dest[name] = mergeProps(complexObjs);
639
+ }
640
+ }
641
+ }
642
+
643
+ // copy values into the destination, going from last to first
644
+ for (i = propObjs.length - 1; i >= 0; i--) {
645
+ props = propObjs[i];
646
+
647
+ for (name in props) {
648
+ if (!(name in dest)) { // if already assigned by previous props or complex props, don't reassign
649
+ dest[name] = props[name];
650
+ }
651
+ }
652
+ }
653
+
654
+ return dest;
655
+ }
656
+
657
+
640
658
  // Create an object that has the given prototype. Just like Object.create
641
659
  function createObject(proto) {
642
660
  var f = function() {};
@@ -1570,7 +1588,7 @@ Class.extend = function(members) {
1570
1588
  // adds new member variables/methods to the class's prototype.
1571
1589
  // can be called with another class, or a plain object hash containing new members.
1572
1590
  Class.mixin = function(members) {
1573
- copyOwnProps(members.prototype || members, this.prototype);
1591
+ copyOwnProps(members.prototype || members, this.prototype); // TODO: copyNativeMethods?
1574
1592
  };
1575
1593
  ;;
1576
1594
 
@@ -1662,7 +1680,7 @@ var Popover = Class.extend({
1662
1680
 
1663
1681
 
1664
1682
  // Hides and unregisters any handlers
1665
- destroy: function() {
1683
+ removeElement: function() {
1666
1684
  this.hide();
1667
1685
 
1668
1686
  if (this.el) {
@@ -1774,6 +1792,7 @@ var GridCoordMap = Class.extend({
1774
1792
 
1775
1793
  // Queries the grid for the coordinates of all the cells
1776
1794
  build: function() {
1795
+ this.grid.build();
1777
1796
  this.rowCoords = this.grid.computeRowCoords();
1778
1797
  this.colCoords = this.grid.computeColCoords();
1779
1798
  this.computeBounds();
@@ -1782,6 +1801,7 @@ var GridCoordMap = Class.extend({
1782
1801
 
1783
1802
  // Clears the coordinates data to free up memory
1784
1803
  clear: function() {
1804
+ this.grid.clear();
1785
1805
  this.rowCoords = null;
1786
1806
  this.colCoords = null;
1787
1807
  },
@@ -2549,7 +2569,7 @@ var MouseFollower = Class.extend({
2549
2569
 
2550
2570
  function complete() {
2551
2571
  this.isAnimating = false;
2552
- _this.destroyEl();
2572
+ _this.removeElement();
2553
2573
 
2554
2574
  this.top0 = this.left0 = null; // reset state for future updatePosition calls
2555
2575
 
@@ -2607,7 +2627,7 @@ var MouseFollower = Class.extend({
2607
2627
 
2608
2628
 
2609
2629
  // Removes the tracking element if it has already been created
2610
- destroyEl: function() {
2630
+ removeElement: function() {
2611
2631
  if (this.el) {
2612
2632
  this.el.remove();
2613
2633
  this.el = null;
@@ -2787,8 +2807,6 @@ var Grid = fc.Grid = RowRenderer.extend({
2787
2807
 
2788
2808
  rowCnt: 0, // number of rows
2789
2809
  colCnt: 0, // number of cols
2790
- rowData: null, // array of objects, holding misc data for each row
2791
- colData: null, // array of objects, holding misc data for each column
2792
2810
 
2793
2811
  el: null, // the containing element
2794
2812
  coordMap: null, // a GridCoordMap that converts pixel values to datetimes
@@ -2854,18 +2872,27 @@ var Grid = fc.Grid = RowRenderer.extend({
2854
2872
  ------------------------------------------------------------------------------------------------------------------*/
2855
2873
 
2856
2874
 
2857
- // Tells the grid about what period of time to display. Grid will subsequently compute dates for cell system.
2875
+ // Tells the grid about what period of time to display.
2876
+ // Any date-related cell system internal data should be generated.
2858
2877
  setRange: function(range) {
2859
- var view = this.view;
2860
- var displayEventTime;
2861
- var displayEventEnd;
2862
-
2863
2878
  this.start = range.start.clone();
2864
2879
  this.end = range.end.clone();
2865
2880
 
2866
- this.rowData = [];
2867
- this.colData = [];
2868
- this.updateCells();
2881
+ this.rangeUpdated();
2882
+ this.processRangeOptions();
2883
+ },
2884
+
2885
+
2886
+ // Called when internal variables that rely on the range should be updated
2887
+ rangeUpdated: function() {
2888
+ },
2889
+
2890
+
2891
+ // Updates values that rely on options and also relate to range
2892
+ processRangeOptions: function() {
2893
+ var view = this.view;
2894
+ var displayEventTime;
2895
+ var displayEventEnd;
2869
2896
 
2870
2897
  // Populate option-derived settings. Look for override first, then compute if necessary.
2871
2898
  this.colHeadFormat = view.opt('columnFormat') || this.computeColHeadFormat();
@@ -2890,9 +2917,15 @@ var Grid = fc.Grid = RowRenderer.extend({
2890
2917
  },
2891
2918
 
2892
2919
 
2893
- // Responsible for setting rowCnt/colCnt and any other row/col data
2894
- updateCells: function() {
2895
- // subclasses must implement
2920
+ // Called before the grid's coordinates will need to be queried for cells.
2921
+ // Any non-date-related cell system internal data should be built.
2922
+ build: function() {
2923
+ },
2924
+
2925
+
2926
+ // Called after the grid's coordinates are done being relied upon.
2927
+ // Any non-date-related cell system internal data should be cleared.
2928
+ clear: function() {
2896
2929
  },
2897
2930
 
2898
2931
 
@@ -2964,13 +2997,13 @@ var Grid = fc.Grid = RowRenderer.extend({
2964
2997
 
2965
2998
  // Retrieves misc data about the given row
2966
2999
  getRowData: function(row) {
2967
- return this.rowData[row] || {};
3000
+ return {};
2968
3001
  },
2969
3002
 
2970
3003
 
2971
3004
  // Retrieves misc data baout the given column
2972
3005
  getColData: function(col) {
2973
- return this.colData[col] || {};
3006
+ return {};
2974
3007
  },
2975
3008
 
2976
3009
 
@@ -3067,7 +3100,7 @@ var Grid = fc.Grid = RowRenderer.extend({
3067
3100
 
3068
3101
 
3069
3102
  // Removes the grid's container element from the DOM. Undoes any other DOM-related attachments.
3070
- // DOES NOT remove any content before hand (doens't clear events or call destroyDates), unlike View
3103
+ // DOES NOT remove any content beforehand (doesn't clear events or call unrenderDates), unlike View
3071
3104
  removeElement: function() {
3072
3105
  this.unbindGlobalHandlers();
3073
3106
 
@@ -3091,7 +3124,7 @@ var Grid = fc.Grid = RowRenderer.extend({
3091
3124
 
3092
3125
 
3093
3126
  // Unrenders the grid's date-related content
3094
- destroyDates: function() {
3127
+ unrenderDates: function() {
3095
3128
  // subclasses should implement
3096
3129
  },
3097
3130
 
@@ -3146,12 +3179,12 @@ var Grid = fc.Grid = RowRenderer.extend({
3146
3179
  cellOut: function(cell) {
3147
3180
  dayClickCell = null;
3148
3181
  selectionRange = null;
3149
- _this.destroySelection();
3182
+ _this.unrenderSelection();
3150
3183
  enableCursor();
3151
3184
  },
3152
3185
  listenStop: function(ev) {
3153
3186
  if (dayClickCell) {
3154
- view.trigger('dayClick', _this.getCellDayEl(dayClickCell), dayClickCell.start, ev);
3187
+ view.triggerDayClick(dayClickCell, _this.getCellDayEl(dayClickCell), ev);
3155
3188
  }
3156
3189
  if (selectionRange) {
3157
3190
  // the selection will already have been rendered. just report it
@@ -3208,7 +3241,7 @@ var Grid = fc.Grid = RowRenderer.extend({
3208
3241
 
3209
3242
 
3210
3243
  // Unrenders a mock event
3211
- destroyHelper: function() {
3244
+ unrenderHelper: function() {
3212
3245
  // subclasses must implement
3213
3246
  },
3214
3247
 
@@ -3219,13 +3252,13 @@ var Grid = fc.Grid = RowRenderer.extend({
3219
3252
 
3220
3253
  // Renders a visual indication of a selection. Will highlight by default but can be overridden by subclasses.
3221
3254
  renderSelection: function(range) {
3222
- this.renderHighlight(range);
3255
+ this.renderHighlight(this.selectionRangeToSegs(range));
3223
3256
  },
3224
3257
 
3225
3258
 
3226
3259
  // Unrenders any visual indications of a selection. Will unrender a highlight by default.
3227
- destroySelection: function() {
3228
- this.destroyHighlight();
3260
+ unrenderSelection: function() {
3261
+ this.unrenderHighlight();
3229
3262
  },
3230
3263
 
3231
3264
 
@@ -3256,19 +3289,24 @@ var Grid = fc.Grid = RowRenderer.extend({
3256
3289
  },
3257
3290
 
3258
3291
 
3292
+ selectionRangeToSegs: function(range) {
3293
+ return this.rangeToSegs(range);
3294
+ },
3295
+
3296
+
3259
3297
  /* Highlight
3260
3298
  ------------------------------------------------------------------------------------------------------------------*/
3261
3299
 
3262
3300
 
3263
- // Renders an emphasis on the given date range. `start` is inclusive. `end` is exclusive.
3264
- renderHighlight: function(range) {
3265
- this.renderFill('highlight', this.rangeToSegs(range));
3301
+ // Renders an emphasis on the given date range. Given an array of segments.
3302
+ renderHighlight: function(segs) {
3303
+ this.renderFill('highlight', segs);
3266
3304
  },
3267
3305
 
3268
3306
 
3269
3307
  // Unrenders the emphasis on a date range
3270
- destroyHighlight: function() {
3271
- this.destroyFill('highlight');
3308
+ unrenderHighlight: function() {
3309
+ this.unrenderFill('highlight');
3272
3310
  },
3273
3311
 
3274
3312
 
@@ -3283,7 +3321,7 @@ var Grid = fc.Grid = RowRenderer.extend({
3283
3321
 
3284
3322
 
3285
3323
  // Renders a set of rectangles over the given segments of time.
3286
- // Returns a subset of segs, the segs that were actually rendered.
3324
+ // MUST RETURN a subset of segs, the segs that were actually rendered.
3287
3325
  // Responsible for populating this.elsByFill. TODO: better API for expressing this requirement
3288
3326
  renderFill: function(type, segs) {
3289
3327
  // subclasses must implement
@@ -3291,7 +3329,7 @@ var Grid = fc.Grid = RowRenderer.extend({
3291
3329
 
3292
3330
 
3293
3331
  // Unrenders a specific type of fill that is currently rendered on the grid
3294
- destroyFill: function(type) {
3332
+ unrenderFill: function(type) {
3295
3333
  var el = this.elsByFill[type];
3296
3334
 
3297
3335
  if (el) {
@@ -3484,11 +3522,11 @@ Grid.mixin({
3484
3522
 
3485
3523
 
3486
3524
  // Unrenders all events currently rendered on the grid
3487
- destroyEvents: function() {
3525
+ unrenderEvents: function() {
3488
3526
  this.triggerSegMouseout(); // trigger an eventMouseout if user's mouse is over an event
3489
3527
 
3490
- this.destroyFgSegs();
3491
- this.destroyBgSegs();
3528
+ this.unrenderFgSegs();
3529
+ this.unrenderBgSegs();
3492
3530
 
3493
3531
  this.segs = null;
3494
3532
  },
@@ -3511,7 +3549,7 @@ Grid.mixin({
3511
3549
 
3512
3550
 
3513
3551
  // Unrenders all currently rendered foreground segments
3514
- destroyFgSegs: function() {
3552
+ unrenderFgSegs: function() {
3515
3553
  // subclasses must implement
3516
3554
  },
3517
3555
 
@@ -3568,8 +3606,8 @@ Grid.mixin({
3568
3606
 
3569
3607
 
3570
3608
  // Unrenders all the currently rendered background event segments
3571
- destroyBgSegs: function() {
3572
- this.destroyFill('bgEvent');
3609
+ unrenderBgSegs: function() {
3610
+ this.unrenderFill('bgEvent');
3573
3611
  },
3574
3612
 
3575
3613
 
@@ -3749,7 +3787,7 @@ Grid.mixin({
3749
3787
  }
3750
3788
  },
3751
3789
  cellOut: function() { // called before mouse moves to a different cell OR moved out of all cells
3752
- view.destroyDrag(); // unrender whatever was done in renderDrag
3790
+ view.unrenderDrag(); // unrender whatever was done in renderDrag
3753
3791
  mouseFollower.show(); // show in case we are moving out of all cells
3754
3792
  dropLocation = null;
3755
3793
  },
@@ -3759,7 +3797,7 @@ Grid.mixin({
3759
3797
  dragStop: function(ev) {
3760
3798
  // do revert animation if hasn't changed. calls a callback when finished (whether animation or not)
3761
3799
  mouseFollower.stop(!dropLocation, function() {
3762
- view.destroyDrag();
3800
+ view.unrenderDrag();
3763
3801
  view.showEvent(event);
3764
3802
  _this.segDragStop(seg, ev);
3765
3803
 
@@ -3903,11 +3941,11 @@ Grid.mixin({
3903
3941
  },
3904
3942
  cellOut: function() {
3905
3943
  dropLocation = null; // signal unsuccessful
3906
- _this.destroyDrag();
3944
+ _this.unrenderDrag();
3907
3945
  enableCursor();
3908
3946
  },
3909
3947
  dragStop: function() {
3910
- _this.destroyDrag();
3948
+ _this.unrenderDrag();
3911
3949
  enableCursor();
3912
3950
 
3913
3951
  if (dropLocation) { // element was dropped on a valid date/time cell
@@ -3964,7 +4002,7 @@ Grid.mixin({
3964
4002
 
3965
4003
 
3966
4004
  // Unrenders a visual indication of an event or external element being dragged
3967
- destroyDrag: function() {
4005
+ unrenderDrag: function() {
3968
4006
  // subclasses must implement
3969
4007
  },
3970
4008
 
@@ -4019,7 +4057,7 @@ Grid.mixin({
4019
4057
  resizeLocation = null;
4020
4058
  },
4021
4059
  cellDone: function() { // resets the rendering to show the original event
4022
- _this.destroyEventResize();
4060
+ _this.unrenderEventResize();
4023
4061
  view.showEvent(event);
4024
4062
  enableCursor();
4025
4063
  },
@@ -4118,7 +4156,7 @@ Grid.mixin({
4118
4156
 
4119
4157
 
4120
4158
  // Unrenders a visual indication of an event being resized.
4121
- destroyEventResize: function() {
4159
+ unrenderEventResize: function() {
4122
4160
  // subclasses must implement
4123
4161
  },
4124
4162
 
@@ -4334,6 +4372,8 @@ Grid.mixin({
4334
4372
  var segs;
4335
4373
  var i, seg;
4336
4374
 
4375
+ eventRange = this.view.calendar.ensureVisibleEventRange(eventRange);
4376
+
4337
4377
  if (rangeToSegsFunc) {
4338
4378
  segs = rangeToSegsFunc(eventRange);
4339
4379
  }
@@ -4513,8 +4553,8 @@ var DayGrid = Grid.extend({
4513
4553
  },
4514
4554
 
4515
4555
 
4516
- destroyDates: function() {
4517
- this.destroySegPopover();
4556
+ unrenderDates: function() {
4557
+ this.removeSegPopover();
4518
4558
  },
4519
4559
 
4520
4560
 
@@ -4598,8 +4638,7 @@ var DayGrid = Grid.extend({
4598
4638
  ------------------------------------------------------------------------------------------------------------------*/
4599
4639
 
4600
4640
 
4601
- // Initializes row/col information
4602
- updateCells: function() {
4641
+ rangeUpdated: function() {
4603
4642
  var cellDates;
4604
4643
  var firstDay;
4605
4644
  var rowCnt;
@@ -4782,9 +4821,7 @@ var DayGrid = Grid.extend({
4782
4821
  renderDrag: function(dropLocation, seg) {
4783
4822
 
4784
4823
  // always render a highlight underneath
4785
- this.renderHighlight(
4786
- this.view.calendar.ensureVisibleEventRange(dropLocation) // needs to be a proper range
4787
- );
4824
+ this.renderHighlight(this.eventRangeToSegs(dropLocation));
4788
4825
 
4789
4826
  // if a segment from the same calendar but another component is being dragged, render a helper event
4790
4827
  if (seg && !seg.el.closest(this.el).length) {
@@ -4798,9 +4835,9 @@ var DayGrid = Grid.extend({
4798
4835
 
4799
4836
 
4800
4837
  // Unrenders any visual indication of a hovering event
4801
- destroyDrag: function() {
4802
- this.destroyHighlight();
4803
- this.destroyHelper();
4838
+ unrenderDrag: function() {
4839
+ this.unrenderHighlight();
4840
+ this.unrenderHelper();
4804
4841
  },
4805
4842
 
4806
4843
 
@@ -4810,15 +4847,15 @@ var DayGrid = Grid.extend({
4810
4847
 
4811
4848
  // Renders a visual indication of an event being resized
4812
4849
  renderEventResize: function(range, seg) {
4813
- this.renderHighlight(range);
4850
+ this.renderHighlight(this.eventRangeToSegs(range));
4814
4851
  this.renderRangeHelper(range, seg);
4815
4852
  },
4816
4853
 
4817
4854
 
4818
4855
  // Unrenders a visual indication of an event being resized
4819
- destroyEventResize: function() {
4820
- this.destroyHighlight();
4821
- this.destroyHelper();
4856
+ unrenderEventResize: function() {
4857
+ this.unrenderHighlight();
4858
+ this.unrenderHelper();
4822
4859
  },
4823
4860
 
4824
4861
 
@@ -4862,7 +4899,7 @@ var DayGrid = Grid.extend({
4862
4899
 
4863
4900
 
4864
4901
  // Unrenders any visual indication of a mock helper event
4865
- destroyHelper: function() {
4902
+ unrenderHelper: function() {
4866
4903
  if (this.helperEls) {
4867
4904
  this.helperEls.remove();
4868
4905
  this.helperEls = null;
@@ -4946,9 +4983,9 @@ DayGrid.mixin({
4946
4983
 
4947
4984
 
4948
4985
  // Unrenders all events currently rendered on the grid
4949
- destroyEvents: function() {
4950
- this.destroySegPopover(); // removes the "more.." events popover
4951
- Grid.prototype.destroyEvents.apply(this, arguments); // calls the super-method
4986
+ unrenderEvents: function() {
4987
+ this.removeSegPopover(); // removes the "more.." events popover
4988
+ Grid.prototype.unrenderEvents.apply(this, arguments); // calls the super-method
4952
4989
  },
4953
4990
 
4954
4991
 
@@ -4993,7 +5030,7 @@ DayGrid.mixin({
4993
5030
 
4994
5031
 
4995
5032
  // Unrenders all currently rendered foreground event segments
4996
- destroyFgSegs: function() {
5033
+ unrenderFgSegs: function() {
4997
5034
  var rowStructs = this.rowStructs || [];
4998
5035
  var rowStruct;
4999
5036
 
@@ -5265,9 +5302,9 @@ DayGrid.mixin({
5265
5302
  popoverSegs: null, // an array of segment objects that the segPopover holds. null when not visible
5266
5303
 
5267
5304
 
5268
- destroySegPopover: function() {
5305
+ removeSegPopover: function() {
5269
5306
  if (this.segPopover) {
5270
- this.segPopover.hide(); // will trigger destruction of `segPopover` and `popoverSegs`
5307
+ this.segPopover.hide(); // in handler, will call segPopover's removeElement
5271
5308
  }
5272
5309
  },
5273
5310
 
@@ -5502,8 +5539,8 @@ DayGrid.mixin({
5502
5539
  autoHide: true, // when the user clicks elsewhere, hide the popover
5503
5540
  viewportConstrain: view.opt('popoverViewportConstrain'),
5504
5541
  hide: function() {
5505
- // destroy everything when the popover is hidden
5506
- _this.segPopover.destroy();
5542
+ // kill everything when the popover is hidden
5543
+ _this.segPopover.removeElement();
5507
5544
  _this.segPopover = null;
5508
5545
  _this.popoverSegs = null;
5509
5546
  }
@@ -5633,10 +5670,9 @@ var TimeGrid = Grid.extend({
5633
5670
 
5634
5671
  slotDuration: null, // duration of a "slot", a distinct time segment on given day, visualized by lines
5635
5672
  snapDuration: null, // granularity of time for dragging and selecting
5636
-
5637
5673
  minTime: null, // Duration object that denotes the first visible time of any given day
5638
5674
  maxTime: null, // Duration object that denotes the exclusive visible end time of any given day
5639
-
5675
+ colDates: null, // whole-day dates for each column. left to right
5640
5676
  axisFormat: null, // formatting string for times running along vertical axis
5641
5677
 
5642
5678
  dayEls: null, // cells elements in the day-row background
@@ -5784,36 +5820,37 @@ var TimeGrid = Grid.extend({
5784
5820
  ------------------------------------------------------------------------------------------------------------------*/
5785
5821
 
5786
5822
 
5787
- // Initializes row/col information
5788
- updateCells: function() {
5823
+ rangeUpdated: function() {
5789
5824
  var view = this.view;
5790
- var colData = [];
5825
+ var colDates = [];
5791
5826
  var date;
5792
5827
 
5793
5828
  date = this.start.clone();
5794
5829
  while (date.isBefore(this.end)) {
5795
- colData.push({
5796
- day: date.clone()
5797
- });
5830
+ colDates.push(date.clone());
5798
5831
  date.add(1, 'day');
5799
5832
  date = view.skipHiddenDays(date);
5800
5833
  }
5801
5834
 
5802
5835
  if (this.isRTL) {
5803
- colData.reverse();
5836
+ colDates.reverse();
5804
5837
  }
5805
5838
 
5806
- this.colData = colData;
5807
- this.colCnt = colData.length;
5839
+ this.colDates = colDates;
5840
+ this.colCnt = colDates.length;
5808
5841
  this.rowCnt = Math.ceil((this.maxTime - this.minTime) / this.snapDuration); // # of vertical snaps
5809
5842
  },
5810
5843
 
5811
5844
 
5812
5845
  // Given a cell object, generates its start date. Returns a reference-free copy.
5813
5846
  computeCellDate: function(cell) {
5847
+ var date = this.colDates[cell.col];
5814
5848
  var time = this.computeSnapTime(cell.row);
5815
5849
 
5816
- return this.view.calendar.rezoneDate(cell.day).time(time);
5850
+ date = this.view.calendar.rezoneDate(date); // give it a 00:00 time
5851
+ date.time(time);
5852
+
5853
+ return date;
5817
5854
  },
5818
5855
 
5819
5856
 
@@ -5849,7 +5886,7 @@ var TimeGrid = Grid.extend({
5849
5886
  };
5850
5887
 
5851
5888
  for (col = 0; col < colCnt; col++) {
5852
- colDate = this.colData[col].day; // will be ambig time/timezone
5889
+ colDate = this.colDates[col]; // will be ambig time/timezone
5853
5890
  colRange = {
5854
5891
  start: colDate.clone().time(this.minTime),
5855
5892
  end: colDate.clone().time(this.maxTime)
@@ -5971,17 +6008,15 @@ var TimeGrid = Grid.extend({
5971
6008
  }
5972
6009
  else {
5973
6010
  // otherwise, just render a highlight
5974
- this.renderHighlight(
5975
- this.view.calendar.ensureVisibleEventRange(dropLocation) // needs to be a proper range
5976
- );
6011
+ this.renderHighlight(this.eventRangeToSegs(dropLocation));
5977
6012
  }
5978
6013
  },
5979
6014
 
5980
6015
 
5981
6016
  // Unrenders any visual indication of an event being dragged
5982
- destroyDrag: function() {
5983
- this.destroyHelper();
5984
- this.destroyHighlight();
6017
+ unrenderDrag: function() {
6018
+ this.unrenderHelper();
6019
+ this.unrenderHighlight();
5985
6020
  },
5986
6021
 
5987
6022
 
@@ -5996,8 +6031,8 @@ var TimeGrid = Grid.extend({
5996
6031
 
5997
6032
 
5998
6033
  // Unrenders any visual indication of an event being resized
5999
- destroyEventResize: function() {
6000
- this.destroyHelper();
6034
+ unrenderEventResize: function() {
6035
+ this.unrenderHelper();
6001
6036
  },
6002
6037
 
6003
6038
 
@@ -6036,7 +6071,7 @@ var TimeGrid = Grid.extend({
6036
6071
 
6037
6072
 
6038
6073
  // Unrenders any mock helper event
6039
- destroyHelper: function() {
6074
+ unrenderHelper: function() {
6040
6075
  if (this.helperEl) {
6041
6076
  this.helperEl.remove();
6042
6077
  this.helperEl = null;
@@ -6054,15 +6089,15 @@ var TimeGrid = Grid.extend({
6054
6089
  this.renderRangeHelper(range);
6055
6090
  }
6056
6091
  else {
6057
- this.renderHighlight(range);
6092
+ this.renderHighlight(this.selectionRangeToSegs(range));
6058
6093
  }
6059
6094
  },
6060
6095
 
6061
6096
 
6062
6097
  // Unrenders any visual indication of a selection
6063
- destroySelection: function() {
6064
- this.destroyHelper();
6065
- this.destroyHighlight();
6098
+ unrenderSelection: function() {
6099
+ this.unrenderHelper();
6100
+ this.unrenderHighlight();
6066
6101
  },
6067
6102
 
6068
6103
 
@@ -6101,7 +6136,7 @@ var TimeGrid = Grid.extend({
6101
6136
 
6102
6137
  if (colSegs.length) {
6103
6138
  containerEl = $('<div class="fc-' + className + '-container"/>').appendTo(tdEl);
6104
- dayDate = this.colData[col].day;
6139
+ dayDate = this.colDates[col];
6105
6140
 
6106
6141
  for (i = 0; i < colSegs.length; i++) {
6107
6142
  seg = colSegs[i];
@@ -6150,7 +6185,7 @@ TimeGrid.mixin({
6150
6185
 
6151
6186
 
6152
6187
  // Unrenders all currently rendered foreground event segments
6153
- destroyFgSegs: function(segs) {
6188
+ unrenderFgSegs: function(segs) {
6154
6189
  if (this.eventSkeletonEl) {
6155
6190
  this.eventSkeletonEl.remove();
6156
6191
  this.eventSkeletonEl = null;
@@ -6557,7 +6592,7 @@ var View = fc.View = Class.extend({
6557
6592
  coordMap: null, // a CoordMap object for converting pixel regions to dates
6558
6593
  el: null, // the view's containing element. set by Calendar
6559
6594
 
6560
- isDisplayed: false,
6595
+ displaying: null, // a promise representing the state of rendering. null if no render requested
6561
6596
  isSkeletonRendered: false,
6562
6597
  isEventsRendered: false,
6563
6598
 
@@ -6572,6 +6607,7 @@ var View = fc.View = Class.extend({
6572
6607
  intervalDuration: null,
6573
6608
  intervalUnit: null, // name of largest unit being displayed, like "month" or "week"
6574
6609
 
6610
+ isRTL: false,
6575
6611
  isSelected: false, // boolean whether a range of time is user-selected or not
6576
6612
 
6577
6613
  // subclasses can optionally use a scroll container
@@ -6601,6 +6637,7 @@ var View = fc.View = Class.extend({
6601
6637
  this.nextDayThreshold = moment.duration(this.opt('nextDayThreshold'));
6602
6638
  this.initThemingProps();
6603
6639
  this.initHiddenDays();
6640
+ this.isRTL = this.opt('isRTL');
6604
6641
 
6605
6642
  this.documentMousedownProxy = proxy(this, 'documentMousedown');
6606
6643
 
@@ -6790,7 +6827,7 @@ var View = fc.View = Class.extend({
6790
6827
 
6791
6828
  // clean up the skeleton
6792
6829
  if (this.isSkeletonRendered) {
6793
- this.destroySkeleton();
6830
+ this.unrenderSkeleton();
6794
6831
  this.isSkeletonRendered = false;
6795
6832
  }
6796
6833
 
@@ -6799,62 +6836,83 @@ var View = fc.View = Class.extend({
6799
6836
  this.el.remove();
6800
6837
 
6801
6838
  // NOTE: don't null-out this.el in case the View was destroyed within an API callback.
6802
- // We don't null-out the View's other jQuery element references upon destroy, so why should we kill this.el?
6839
+ // We don't null-out the View's other jQuery element references upon destroy,
6840
+ // so we shouldn't kill this.el either.
6803
6841
  },
6804
6842
 
6805
6843
 
6806
6844
  // Does everything necessary to display the view centered around the given date.
6807
6845
  // Does every type of rendering EXCEPT rendering events.
6846
+ // Is asychronous and returns a promise.
6808
6847
  display: function(date) {
6848
+ var _this = this;
6809
6849
  var scrollState = null;
6810
6850
 
6811
- if (this.isDisplayed) {
6851
+ if (this.displaying) {
6812
6852
  scrollState = this.queryScroll();
6813
6853
  }
6814
6854
 
6815
- this.clear(); // clear the old content
6816
- this.setDate(date);
6817
- this.render();
6818
- this.updateSize();
6819
- this.renderBusinessHours(); // might need coordinates, so should go after updateSize()
6820
- this.isDisplayed = true;
6821
-
6822
- scrollState = this.computeInitialScroll(scrollState);
6823
- this.forceScroll(scrollState);
6824
-
6825
- this.triggerRender();
6855
+ return this.clear().then(function() { // clear the content first (async)
6856
+ return (
6857
+ _this.displaying =
6858
+ $.when(_this.displayView(date)) // displayView might return a promise
6859
+ .then(function() {
6860
+ _this.forceScroll(_this.computeInitialScroll(scrollState));
6861
+ _this.triggerRender();
6862
+ })
6863
+ );
6864
+ });
6826
6865
  },
6827
6866
 
6828
6867
 
6829
6868
  // Does everything necessary to clear the content of the view.
6830
6869
  // Clears dates and events. Does not clear the skeleton.
6831
- clear: function() { // clears the view of *content* but not the skeleton
6832
- if (this.isDisplayed) {
6833
- this.unselect();
6834
- this.clearEvents();
6835
- this.triggerDestroy();
6836
- this.destroyBusinessHours();
6837
- this.destroy();
6838
- this.isDisplayed = false;
6870
+ // Is asychronous and returns a promise.
6871
+ clear: function() {
6872
+ var _this = this;
6873
+ var displaying = this.displaying;
6874
+
6875
+ if (displaying) { // previously displayed, or in the process of being displayed?
6876
+ return displaying.then(function() { // wait for the display to finish
6877
+ _this.displaying = null;
6878
+ _this.clearEvents();
6879
+ return _this.clearView(); // might return a promise. chain it
6880
+ });
6881
+ }
6882
+ else {
6883
+ return $.when(); // an immediately-resolved promise
6839
6884
  }
6840
6885
  },
6841
6886
 
6842
6887
 
6843
- // Renders the view's date-related content, rendering the view's non-content skeleton if necessary
6844
- render: function() {
6888
+ // Displays the view's non-event content, such as date-related content or anything required by events.
6889
+ // Renders the view's non-content skeleton if necessary.
6890
+ // Can be asynchronous and return a promise.
6891
+ displayView: function(date) {
6845
6892
  if (!this.isSkeletonRendered) {
6846
6893
  this.renderSkeleton();
6847
6894
  this.isSkeletonRendered = true;
6848
6895
  }
6896
+ this.setDate(date);
6897
+ if (this.render) {
6898
+ this.render(); // TODO: deprecate
6899
+ }
6849
6900
  this.renderDates();
6901
+ this.updateSize();
6902
+ this.renderBusinessHours(); // might need coordinates, so should go after updateSize()
6850
6903
  },
6851
6904
 
6852
6905
 
6853
- // Unrenders the view's date-related content.
6854
- // Call this instead of destroyDates directly in case the View subclass wants to use a render/destroy pattern
6855
- // where both the skeleton and the content always get rendered/unrendered together.
6856
- destroy: function() {
6857
- this.destroyDates();
6906
+ // Unrenders the view content that was rendered in displayView.
6907
+ // Can be asynchronous and return a promise.
6908
+ clearView: function() {
6909
+ this.unselect();
6910
+ this.triggerUnrender();
6911
+ this.unrenderBusinessHours();
6912
+ this.unrenderDates();
6913
+ if (this.destroy) {
6914
+ this.destroy(); // TODO: deprecate
6915
+ }
6858
6916
  },
6859
6917
 
6860
6918
 
@@ -6865,7 +6923,7 @@ var View = fc.View = Class.extend({
6865
6923
 
6866
6924
 
6867
6925
  // Unrenders the basic structure of the view
6868
- destroySkeleton: function() {
6926
+ unrenderSkeleton: function() {
6869
6927
  // subclasses should implement
6870
6928
  },
6871
6929
 
@@ -6878,7 +6936,7 @@ var View = fc.View = Class.extend({
6878
6936
 
6879
6937
 
6880
6938
  // Unrenders the view's date-related content
6881
- destroyDates: function() {
6939
+ unrenderDates: function() {
6882
6940
  // subclasses should override
6883
6941
  },
6884
6942
 
@@ -6890,7 +6948,7 @@ var View = fc.View = Class.extend({
6890
6948
 
6891
6949
 
6892
6950
  // Unrenders previously-rendered business-hours
6893
- destroyBusinessHours: function() {
6951
+ unrenderBusinessHours: function() {
6894
6952
  // subclasses should implement
6895
6953
  },
6896
6954
 
@@ -6902,7 +6960,7 @@ var View = fc.View = Class.extend({
6902
6960
 
6903
6961
 
6904
6962
  // Signals that the view's content is about to be unrendered
6905
- triggerDestroy: function() {
6963
+ triggerUnrender: function() {
6906
6964
  this.trigger('viewDestroy', this, this, this.el);
6907
6965
  },
6908
6966
 
@@ -6941,8 +6999,8 @@ var View = fc.View = Class.extend({
6941
6999
  scrollState = this.queryScroll();
6942
7000
  }
6943
7001
 
6944
- this.updateHeight();
6945
- this.updateWidth();
7002
+ this.updateHeight(isResize);
7003
+ this.updateWidth(isResize);
6946
7004
 
6947
7005
  if (isResize) {
6948
7006
  this.setScroll(scrollState);
@@ -6951,13 +7009,13 @@ var View = fc.View = Class.extend({
6951
7009
 
6952
7010
 
6953
7011
  // Refreshes the horizontal dimensions of the calendar
6954
- updateWidth: function() {
7012
+ updateWidth: function(isResize) {
6955
7013
  // subclasses should implement
6956
7014
  },
6957
7015
 
6958
7016
 
6959
7017
  // Refreshes the vertical dimensions of the calendar
6960
- updateHeight: function() {
7018
+ updateHeight: function(isResize) {
6961
7019
  var calendar = this.calendar; // we poll the calendar for height information
6962
7020
 
6963
7021
  this.setHeight(
@@ -7052,8 +7110,11 @@ var View = fc.View = Class.extend({
7052
7110
  // Does everything necessary to clear the view's currently-rendered events
7053
7111
  clearEvents: function() {
7054
7112
  if (this.isEventsRendered) {
7055
- this.triggerEventDestroy();
7056
- this.destroyEvents();
7113
+ this.triggerEventUnrender();
7114
+ if (this.destroyEvents) {
7115
+ this.destroyEvents(); // TODO: deprecate
7116
+ }
7117
+ this.unrenderEvents();
7057
7118
  this.isEventsRendered = false;
7058
7119
  }
7059
7120
  },
@@ -7066,7 +7127,7 @@ var View = fc.View = Class.extend({
7066
7127
 
7067
7128
 
7068
7129
  // Removes event elements from the view.
7069
- destroyEvents: function() {
7130
+ unrenderEvents: function() {
7070
7131
  // subclasses should implement
7071
7132
  },
7072
7133
 
@@ -7081,7 +7142,7 @@ var View = fc.View = Class.extend({
7081
7142
 
7082
7143
 
7083
7144
  // Signals that all event elements are about to be removed
7084
- triggerEventDestroy: function() {
7145
+ triggerEventUnrender: function() {
7085
7146
  this.renderedEventSegEach(function(seg) {
7086
7147
  this.trigger('eventDestroy', seg.event, seg.event, seg.el);
7087
7148
  });
@@ -7230,7 +7291,7 @@ var View = fc.View = Class.extend({
7230
7291
 
7231
7292
 
7232
7293
  // Unrenders a visual indication of an event or external-element being dragged.
7233
- destroyDrag: function() {
7294
+ unrenderDrag: function() {
7234
7295
  // subclasses must implement
7235
7296
  },
7236
7297
 
@@ -7308,6 +7369,12 @@ var View = fc.View = Class.extend({
7308
7369
  // Called when a new selection is made. Updates internal state and triggers handlers.
7309
7370
  reportSelection: function(range, ev) {
7310
7371
  this.isSelected = true;
7372
+ this.triggerSelect(range, ev);
7373
+ },
7374
+
7375
+
7376
+ // Triggers handlers to 'select'
7377
+ triggerSelect: function(range, ev) {
7311
7378
  this.trigger('select', null, range.start, range.end, ev);
7312
7379
  },
7313
7380
 
@@ -7317,14 +7384,17 @@ var View = fc.View = Class.extend({
7317
7384
  unselect: function(ev) {
7318
7385
  if (this.isSelected) {
7319
7386
  this.isSelected = false;
7320
- this.destroySelection();
7387
+ if (this.destroySelection) {
7388
+ this.destroySelection(); // TODO: deprecate
7389
+ }
7390
+ this.unrenderSelection();
7321
7391
  this.trigger('unselect', null, ev);
7322
7392
  }
7323
7393
  },
7324
7394
 
7325
7395
 
7326
7396
  // Unrenders a visual indication of selection
7327
- destroySelection: function() {
7397
+ unrenderSelection: function() {
7328
7398
  // subclasses should implement
7329
7399
  },
7330
7400
 
@@ -7345,6 +7415,16 @@ var View = fc.View = Class.extend({
7345
7415
  },
7346
7416
 
7347
7417
 
7418
+ /* Day Click
7419
+ ------------------------------------------------------------------------------------------------------------------*/
7420
+
7421
+
7422
+ // Triggers handlers to 'dayClick'
7423
+ triggerDayClick: function(cell, dayEl, ev) {
7424
+ this.trigger('dayClick', dayEl, cell.start, ev);
7425
+ },
7426
+
7427
+
7348
7428
  /* Date Utils
7349
7429
  ------------------------------------------------------------------------------------------------------------------*/
7350
7430
 
@@ -7443,7 +7523,7 @@ var View = fc.View = Class.extend({
7443
7523
 
7444
7524
  ;;
7445
7525
 
7446
- var Calendar = fc.Calendar = fc.CalendarBase = Class.extend({
7526
+ var Calendar = fc.Calendar = Class.extend({
7447
7527
 
7448
7528
  dirDefaults: null, // option defaults related to LTR or RTL
7449
7529
  langDefaults: null, // option defaults related to current locale
@@ -7452,6 +7532,7 @@ var Calendar = fc.Calendar = fc.CalendarBase = Class.extend({
7452
7532
  viewSpecCache: null, // cache of view definitions
7453
7533
  view: null, // current View object
7454
7534
  header: null,
7535
+ loadingLevel: 0, // number of simultaneous loading tasks
7455
7536
 
7456
7537
 
7457
7538
  // a lot of this class' OOP logic is scoped within this constructor function,
@@ -7459,6 +7540,11 @@ var Calendar = fc.Calendar = fc.CalendarBase = Class.extend({
7459
7540
  constructor: Calendar_constructor,
7460
7541
 
7461
7542
 
7543
+ // Subclasses can override this for initialization logic after the constructor has been called
7544
+ initialize: function() {
7545
+ },
7546
+
7547
+
7462
7548
  // Initializes `this.options` and other important options-related objects
7463
7549
  initOptions: function(overrides) {
7464
7550
  var lang, langDefaults;
@@ -7485,12 +7571,12 @@ var Calendar = fc.Calendar = fc.CalendarBase = Class.extend({
7485
7571
  this.dirDefaults = dirDefaults;
7486
7572
  this.langDefaults = langDefaults;
7487
7573
  this.overrides = overrides;
7488
- this.options = mergeOptions( // merge defaults and overrides. lowest to highest precedence
7574
+ this.options = mergeOptions([ // merge defaults and overrides. lowest to highest precedence
7489
7575
  Calendar.defaults, // global defaults
7490
7576
  dirDefaults,
7491
7577
  langDefaults,
7492
7578
  overrides
7493
- );
7579
+ ]);
7494
7580
  populateInstanceComputableOptions(this.options);
7495
7581
 
7496
7582
  this.viewSpecCache = {}; // somewhat unrelated
@@ -7535,43 +7621,48 @@ var Calendar = fc.Calendar = fc.CalendarBase = Class.extend({
7535
7621
  // Builds an object with information on how to create a given view
7536
7622
  buildViewSpec: function(requestedViewType) {
7537
7623
  var viewOverrides = this.overrides.views || {};
7624
+ var specChain = []; // for the view. lowest to highest priority
7538
7625
  var defaultsChain = []; // for the view. lowest to highest priority
7539
7626
  var overridesChain = []; // for the view. lowest to highest priority
7540
7627
  var viewType = requestedViewType;
7541
- var viewClass;
7542
- var defaults; // for the view
7628
+ var spec; // for the view
7543
7629
  var overrides; // for the view
7544
7630
  var duration;
7545
7631
  var unit;
7546
- var spec;
7547
7632
 
7548
7633
  // iterate from the specific view definition to a more general one until we hit an actual View class
7549
- while (viewType && !viewClass) {
7550
- defaults = fcViews[viewType] || {};
7551
- overrides = viewOverrides[viewType] || {};
7552
- duration = duration || overrides.duration || defaults.duration;
7553
- viewType = overrides.type || defaults.type; // for next iteration
7634
+ while (viewType) {
7635
+ spec = fcViews[viewType];
7636
+ overrides = viewOverrides[viewType];
7637
+ viewType = null; // clear. might repopulate for another iteration
7554
7638
 
7555
- if (typeof defaults === 'function') { // a class
7556
- viewClass = defaults;
7557
- defaultsChain.unshift(viewClass.defaults || {});
7639
+ if (typeof spec === 'function') { // TODO: deprecate
7640
+ spec = { 'class': spec };
7558
7641
  }
7559
- else { // an options object
7560
- defaultsChain.unshift(defaults);
7642
+
7643
+ if (spec) {
7644
+ specChain.unshift(spec);
7645
+ defaultsChain.unshift(spec.defaults || {});
7646
+ duration = duration || spec.duration;
7647
+ viewType = viewType || spec.type;
7648
+ }
7649
+
7650
+ if (overrides) {
7651
+ overridesChain.unshift(overrides); // view-specific option hashes have options at zero-level
7652
+ duration = duration || overrides.duration;
7653
+ viewType = viewType || overrides.type;
7561
7654
  }
7562
- overridesChain.unshift(overrides);
7563
7655
  }
7564
7656
 
7565
- if (viewClass) {
7566
- spec = { 'class': viewClass, type: requestedViewType };
7657
+ spec = mergeProps(specChain);
7658
+ spec.type = requestedViewType;
7659
+ if (!spec['class']) {
7660
+ return false;
7661
+ }
7567
7662
 
7568
- if (duration) {
7569
- duration = moment.duration(duration);
7570
- if (!duration.valueOf()) { // invalid?
7571
- duration = null;
7572
- }
7573
- }
7574
- if (duration) {
7663
+ if (duration) {
7664
+ duration = moment.duration(duration);
7665
+ if (duration.valueOf()) { // valid?
7575
7666
  spec.duration = duration;
7576
7667
  unit = computeIntervalUnit(duration);
7577
7668
 
@@ -7582,29 +7673,28 @@ var Calendar = fc.Calendar = fc.CalendarBase = Class.extend({
7582
7673
  overridesChain.unshift(viewOverrides[unit] || {});
7583
7674
  }
7584
7675
  }
7676
+ }
7585
7677
 
7586
- // collapse into single objects
7587
- spec.defaults = mergeOptions.apply(null, defaultsChain);
7588
- spec.overrides = mergeOptions.apply(null, overridesChain);
7678
+ spec.defaults = mergeOptions(defaultsChain);
7679
+ spec.overrides = mergeOptions(overridesChain);
7589
7680
 
7590
- this.buildViewSpecOptions(spec);
7591
- this.buildViewSpecButtonText(spec, requestedViewType);
7681
+ this.buildViewSpecOptions(spec);
7682
+ this.buildViewSpecButtonText(spec, requestedViewType);
7592
7683
 
7593
- return spec;
7594
- }
7684
+ return spec;
7595
7685
  },
7596
7686
 
7597
7687
 
7598
7688
  // Builds and assigns a view spec's options object from its already-assigned defaults and overrides
7599
7689
  buildViewSpecOptions: function(spec) {
7600
- spec.options = mergeOptions( // lowest to highest priority
7690
+ spec.options = mergeOptions([ // lowest to highest priority
7601
7691
  Calendar.defaults, // global defaults
7602
7692
  spec.defaults, // view's defaults (from ViewSubclass.defaults)
7603
7693
  this.dirDefaults,
7604
7694
  this.langDefaults, // locale and dir take precedence over view's defaults!
7605
7695
  this.overrides, // calendar's overrides (options given to constructor)
7606
7696
  spec.overrides // view's overrides (view-specific options)
7607
- );
7697
+ ]);
7608
7698
  populateInstanceComputableOptions(spec.options);
7609
7699
  },
7610
7700
 
@@ -7647,6 +7737,40 @@ var Calendar = fc.Calendar = fc.CalendarBase = Class.extend({
7647
7737
  // Returns a boolean about whether the view is okay to instantiate at some point
7648
7738
  isValidViewType: function(viewType) {
7649
7739
  return Boolean(this.getViewSpec(viewType));
7740
+ },
7741
+
7742
+
7743
+ // Should be called when any type of async data fetching begins
7744
+ pushLoading: function() {
7745
+ if (!(this.loadingLevel++)) {
7746
+ this.trigger('loading', null, true, this.view);
7747
+ }
7748
+ },
7749
+
7750
+
7751
+ // Should be called when any type of async data fetching completes
7752
+ popLoading: function() {
7753
+ if (!(--this.loadingLevel)) {
7754
+ this.trigger('loading', null, false, this.view);
7755
+ }
7756
+ },
7757
+
7758
+
7759
+ // Given arguments to the select method in the API, returns a range
7760
+ buildSelectRange: function(start, end) {
7761
+
7762
+ start = this.moment(start);
7763
+ if (end) {
7764
+ end = this.moment(end);
7765
+ }
7766
+ else if (start.hasTime()) {
7767
+ end = start.clone().add(this.defaultTimedEventDuration);
7768
+ }
7769
+ else {
7770
+ end = start.clone().add(this.defaultAllDayEventDuration);
7771
+ }
7772
+
7773
+ return { start: start, end: end };
7650
7774
  }
7651
7775
 
7652
7776
  });
@@ -7930,7 +8054,7 @@ function Calendar_constructor(element, overrides) {
7930
8054
  // It is still the "current" view, just not rendered.
7931
8055
  }
7932
8056
 
7933
- header.destroy();
8057
+ header.removeElement();
7934
8058
  content.remove();
7935
8059
  element.removeClass('fc fc-ltr fc-rtl fc-unthemed ui-widget');
7936
8060
 
@@ -7955,7 +8079,7 @@ function Calendar_constructor(element, overrides) {
7955
8079
  function renderView(viewType) {
7956
8080
  ignoreWindowResize++;
7957
8081
 
7958
- // if viewType is changing, destroy the old view
8082
+ // if viewType is changing, remove the old view's rendering
7959
8083
  if (currentView && viewType && currentView.type !== viewType) {
7960
8084
  header.deactivateButton(currentView.type);
7961
8085
  freezeContentHeight(); // prevent a scroll jump when view element is removed
@@ -7982,14 +8106,14 @@ function Calendar_constructor(element, overrides) {
7982
8106
 
7983
8107
  // render or rerender the view
7984
8108
  if (
7985
- !currentView.isDisplayed ||
8109
+ !currentView.displaying ||
7986
8110
  !date.isWithin(currentView.intervalStart, currentView.intervalEnd) // implicit date window change
7987
8111
  ) {
7988
8112
  if (elementVisible()) {
7989
8113
 
7990
8114
  freezeContentHeight();
7991
8115
  currentView.display(date);
7992
- unfreezeContentHeight();
8116
+ unfreezeContentHeight(); // immediately unfreeze regardless of whether display is async
7993
8117
 
7994
8118
  // need to do this after View::render, so dates are calculated
7995
8119
  updateHeaderTitle();
@@ -8157,19 +8281,9 @@ function Calendar_constructor(element, overrides) {
8157
8281
 
8158
8282
 
8159
8283
  function select(start, end) {
8160
-
8161
- start = t.moment(start);
8162
- if (end) {
8163
- end = t.moment(end);
8164
- }
8165
- else if (start.hasTime()) {
8166
- end = start.clone().add(t.defaultTimedEventDuration);
8167
- }
8168
- else {
8169
- end = start.clone().add(t.defaultAllDayEventDuration);
8170
- }
8171
-
8172
- currentView.select({ start: start, end: end }); // accepts a range
8284
+ currentView.select(
8285
+ t.buildSelectRange.apply(t, arguments)
8286
+ );
8173
8287
  }
8174
8288
 
8175
8289
 
@@ -8304,6 +8418,7 @@ function Calendar_constructor(element, overrides) {
8304
8418
  }
8305
8419
  }
8306
8420
 
8421
+ t.initialize();
8307
8422
  }
8308
8423
 
8309
8424
  ;;
@@ -8333,6 +8448,8 @@ Calendar.defaults = {
8333
8448
  weekNumberCalculation: 'local',
8334
8449
 
8335
8450
  //editable: false,
8451
+
8452
+ scrollTime: '06:00:00',
8336
8453
 
8337
8454
  // event ajax
8338
8455
  lazyFetching: true,
@@ -8475,7 +8592,7 @@ fc.lang = function(langCode, newFcOptions) {
8475
8592
 
8476
8593
  // provided new options for this language? merge them in
8477
8594
  if (newFcOptions) {
8478
- fcOptions = langOptionHash[langCode] = mergeOptions(fcOptions, newFcOptions);
8595
+ fcOptions = langOptionHash[langCode] = mergeOptions([ fcOptions, newFcOptions ]);
8479
8596
  }
8480
8597
 
8481
8598
  // compute language options that weren't defined.
@@ -8631,7 +8748,7 @@ function Header(calendar, options) {
8631
8748
 
8632
8749
  // exports
8633
8750
  t.render = render;
8634
- t.destroy = destroy;
8751
+ t.removeElement = removeElement;
8635
8752
  t.updateTitle = updateTitle;
8636
8753
  t.activateButton = activateButton;
8637
8754
  t.deactivateButton = deactivateButton;
@@ -8662,8 +8779,9 @@ function Header(calendar, options) {
8662
8779
  }
8663
8780
 
8664
8781
 
8665
- function destroy() {
8782
+ function removeElement() {
8666
8783
  el.remove();
8784
+ el = $();
8667
8785
  }
8668
8786
 
8669
8787
 
@@ -8884,8 +9002,6 @@ function EventManager(options) { // assumed to be a calendar
8884
9002
 
8885
9003
 
8886
9004
  // imports
8887
- var trigger = t.trigger;
8888
- var getView = t.getView;
8889
9005
  var reportEvents = t.reportEvents;
8890
9006
 
8891
9007
 
@@ -8895,7 +9011,6 @@ function EventManager(options) { // assumed to be a calendar
8895
9011
  var rangeStart, rangeEnd;
8896
9012
  var currentFetchID = 0;
8897
9013
  var pendingSourceCnt = 0;
8898
- var loadingLevel = 0;
8899
9014
  var cache = []; // holds events that have already been expanded
8900
9015
 
8901
9016
 
@@ -9002,7 +9117,7 @@ function EventManager(options) { // assumed to be a calendar
9002
9117
  var events = source.events;
9003
9118
  if (events) {
9004
9119
  if ($.isFunction(events)) {
9005
- pushLoading();
9120
+ t.pushLoading();
9006
9121
  events.call(
9007
9122
  t, // this, the Calendar object
9008
9123
  rangeStart.clone(),
@@ -9010,7 +9125,7 @@ function EventManager(options) { // assumed to be a calendar
9010
9125
  options.timezone,
9011
9126
  function(events) {
9012
9127
  callback(events);
9013
- popLoading();
9128
+ t.popLoading();
9014
9129
  }
9015
9130
  );
9016
9131
  }
@@ -9056,7 +9171,7 @@ function EventManager(options) { // assumed to be a calendar
9056
9171
  data[timezoneParam] = options.timezone;
9057
9172
  }
9058
9173
 
9059
- pushLoading();
9174
+ t.pushLoading();
9060
9175
  $.ajax($.extend({}, ajaxDefaults, source, {
9061
9176
  data: data,
9062
9177
  success: function(events) {
@@ -9073,7 +9188,7 @@ function EventManager(options) { // assumed to be a calendar
9073
9188
  },
9074
9189
  complete: function() {
9075
9190
  applyAll(complete, this, arguments);
9076
- popLoading();
9191
+ t.popLoading();
9077
9192
  }
9078
9193
  }));
9079
9194
  }else{
@@ -9288,25 +9403,6 @@ function EventManager(options) { // assumed to be a calendar
9288
9403
 
9289
9404
 
9290
9405
 
9291
- /* Loading State
9292
- -----------------------------------------------------------------------------*/
9293
-
9294
-
9295
- function pushLoading() {
9296
- if (!(loadingLevel++)) {
9297
- trigger('loading', null, true, getView());
9298
- }
9299
- }
9300
-
9301
-
9302
- function popLoading() {
9303
- if (!(--loadingLevel)) {
9304
- trigger('loading', null, false, getView());
9305
- }
9306
- }
9307
-
9308
-
9309
-
9310
9406
  /* Event Normalization
9311
9407
  -----------------------------------------------------------------------------*/
9312
9408
 
@@ -9991,7 +10087,7 @@ function backupEventDates(event) {
9991
10087
  // It is a manager for a DayGrid subcomponent, which does most of the heavy lifting.
9992
10088
  // It is responsible for managing width/height.
9993
10089
 
9994
- var BasicView = fcViews.basic = View.extend({
10090
+ var BasicView = View.extend({
9995
10091
 
9996
10092
  dayGrid: null, // the main subcomponent that does most of the heavy lifting
9997
10093
 
@@ -10039,7 +10135,7 @@ var BasicView = fcViews.basic = View.extend({
10039
10135
 
10040
10136
 
10041
10137
  // Renders the view into `this.el`, which should already be assigned
10042
- render: function() {
10138
+ renderDates: function() {
10043
10139
 
10044
10140
  this.dayNumbersVisible = this.dayGrid.rowCnt > 1; // TODO: make grid responsible
10045
10141
  this.weekNumbersVisible = this.opt('weekNumbers');
@@ -10059,8 +10155,8 @@ var BasicView = fcViews.basic = View.extend({
10059
10155
 
10060
10156
  // Unrenders the content of the view. Since we haven't separated skeleton rendering from date rendering,
10061
10157
  // always completely kill the dayGrid's rendering.
10062
- destroy: function() {
10063
- this.dayGrid.destroyDates();
10158
+ unrenderDates: function() {
10159
+ this.dayGrid.unrenderDates();
10064
10160
  this.dayGrid.removeElement();
10065
10161
  },
10066
10162
 
@@ -10203,7 +10299,7 @@ var BasicView = fcViews.basic = View.extend({
10203
10299
  unsetScroller(this.scrollerEl);
10204
10300
  uncompensateScroll(this.headRowEl);
10205
10301
 
10206
- this.dayGrid.destroySegPopover(); // kill the "more" popover if displayed
10302
+ this.dayGrid.removeSegPopover(); // kill the "more" popover if displayed
10207
10303
 
10208
10304
  // is the event limit a constant level number?
10209
10305
  if (eventLimit && typeof eventLimit === 'number') {
@@ -10259,8 +10355,8 @@ var BasicView = fcViews.basic = View.extend({
10259
10355
 
10260
10356
 
10261
10357
  // Unrenders all event elements and clears internal segment data
10262
- destroyEvents: function() {
10263
- this.dayGrid.destroyEvents();
10358
+ unrenderEvents: function() {
10359
+ this.dayGrid.unrenderEvents();
10264
10360
 
10265
10361
  // we DON'T need to call updateHeight() because:
10266
10362
  // A) a renderEvents() call always happens after this, which will eventually call updateHeight()
@@ -10278,8 +10374,8 @@ var BasicView = fcViews.basic = View.extend({
10278
10374
  },
10279
10375
 
10280
10376
 
10281
- destroyDrag: function() {
10282
- this.dayGrid.destroyDrag();
10377
+ unrenderDrag: function() {
10378
+ this.dayGrid.unrenderDrag();
10283
10379
  },
10284
10380
 
10285
10381
 
@@ -10294,8 +10390,8 @@ var BasicView = fcViews.basic = View.extend({
10294
10390
 
10295
10391
 
10296
10392
  // Unrenders a visual indications of a selection
10297
- destroySelection: function() {
10298
- this.dayGrid.destroySelection();
10393
+ unrenderSelection: function() {
10394
+ this.dayGrid.unrenderSelection();
10299
10395
  }
10300
10396
 
10301
10397
  });
@@ -10305,7 +10401,7 @@ var BasicView = fcViews.basic = View.extend({
10305
10401
  /* A month view with day cells running in rows (one-per-week) and columns
10306
10402
  ----------------------------------------------------------------------------------------------------------------------*/
10307
10403
 
10308
- var MonthView = fcViews.month = BasicView.extend({
10404
+ var MonthView = BasicView.extend({
10309
10405
 
10310
10406
  // Produces information about what range to display
10311
10407
  computeRange: function(date) {
@@ -10347,28 +10443,28 @@ var MonthView = fcViews.month = BasicView.extend({
10347
10443
 
10348
10444
  });
10349
10445
 
10350
- MonthView.duration = { months: 1 }; // important for prev/next
10446
+ ;;
10351
10447
 
10352
- MonthView.defaults = {
10353
- fixedWeekCount: true
10448
+ fcViews.basic = {
10449
+ 'class': BasicView
10354
10450
  };
10355
- ;;
10356
10451
 
10357
- /* A week view with simple day cells running horizontally
10358
- ----------------------------------------------------------------------------------------------------------------------*/
10452
+ fcViews.basicDay = {
10453
+ type: 'basic',
10454
+ duration: { days: 1 }
10455
+ };
10359
10456
 
10360
10457
  fcViews.basicWeek = {
10361
10458
  type: 'basic',
10362
10459
  duration: { weeks: 1 }
10363
10460
  };
10364
- ;;
10365
-
10366
- /* A view with a single simple day cell
10367
- ----------------------------------------------------------------------------------------------------------------------*/
10368
10461
 
10369
- fcViews.basicDay = {
10370
- type: 'basic',
10371
- duration: { days: 1 }
10462
+ fcViews.month = {
10463
+ 'class': MonthView,
10464
+ duration: { months: 1 }, // important for prev/next
10465
+ defaults: {
10466
+ fixedWeekCount: true
10467
+ }
10372
10468
  };
10373
10469
  ;;
10374
10470
 
@@ -10377,19 +10473,7 @@ fcViews.basicDay = {
10377
10473
  // Is a manager for the TimeGrid subcomponent and possibly the DayGrid subcomponent (if allDaySlot is on).
10378
10474
  // Responsible for managing width/height.
10379
10475
 
10380
- var AGENDA_DEFAULTS = {
10381
- allDaySlot: true,
10382
- allDayText: 'all-day',
10383
- scrollTime: '06:00:00',
10384
- slotDuration: '00:30:00',
10385
- minTime: '00:00:00',
10386
- maxTime: '24:00:00',
10387
- slotEventOverlap: true // a bad name. confused with overlap/constraint system
10388
- };
10389
-
10390
- var AGENDA_ALL_DAY_EVENT_LIMIT = 5;
10391
-
10392
- var AgendaView = fcViews.agenda = View.extend({
10476
+ var AgendaView = View.extend({
10393
10477
 
10394
10478
  timeGrid: null, // the main time-grid subcomponent of this view
10395
10479
  dayGrid: null, // the "all-day" subcomponent. if all-day is turned off, this will be null
@@ -10437,7 +10521,7 @@ var AgendaView = fcViews.agenda = View.extend({
10437
10521
 
10438
10522
 
10439
10523
  // Renders the view into `this.el`, which has already been assigned
10440
- render: function() {
10524
+ renderDates: function() {
10441
10525
 
10442
10526
  this.el.addClass('fc-agenda-view').html(this.renderHtml());
10443
10527
 
@@ -10466,12 +10550,12 @@ var AgendaView = fcViews.agenda = View.extend({
10466
10550
 
10467
10551
  // Unrenders the content of the view. Since we haven't separated skeleton rendering from date rendering,
10468
10552
  // always completely kill each grid's rendering.
10469
- destroy: function() {
10470
- this.timeGrid.destroyDates();
10553
+ unrenderDates: function() {
10554
+ this.timeGrid.unrenderDates();
10471
10555
  this.timeGrid.removeElement();
10472
10556
 
10473
10557
  if (this.dayGrid) {
10474
- this.dayGrid.destroyDates();
10558
+ this.dayGrid.unrenderDates();
10475
10559
  this.dayGrid.removeElement();
10476
10560
  }
10477
10561
  },
@@ -10610,7 +10694,7 @@ var AgendaView = fcViews.agenda = View.extend({
10610
10694
 
10611
10695
  // limit number of events in the all-day area
10612
10696
  if (this.dayGrid) {
10613
- this.dayGrid.destroySegPopover(); // kill the "more" popover if displayed
10697
+ this.dayGrid.removeSegPopover(); // kill the "more" popover if displayed
10614
10698
 
10615
10699
  eventLimit = this.opt('eventLimit');
10616
10700
  if (eventLimit && typeof eventLimit !== 'number') {
@@ -10701,12 +10785,12 @@ var AgendaView = fcViews.agenda = View.extend({
10701
10785
 
10702
10786
 
10703
10787
  // Unrenders all event elements and clears internal segment data
10704
- destroyEvents: function() {
10788
+ unrenderEvents: function() {
10705
10789
 
10706
- // destroy the events in the subcomponents
10707
- this.timeGrid.destroyEvents();
10790
+ // unrender the events in the subcomponents
10791
+ this.timeGrid.unrenderEvents();
10708
10792
  if (this.dayGrid) {
10709
- this.dayGrid.destroyEvents();
10793
+ this.dayGrid.unrenderEvents();
10710
10794
  }
10711
10795
 
10712
10796
  // we DON'T need to call updateHeight() because:
@@ -10730,10 +10814,10 @@ var AgendaView = fcViews.agenda = View.extend({
10730
10814
  },
10731
10815
 
10732
10816
 
10733
- destroyDrag: function() {
10734
- this.timeGrid.destroyDrag();
10817
+ unrenderDrag: function() {
10818
+ this.timeGrid.unrenderDrag();
10735
10819
  if (this.dayGrid) {
10736
- this.dayGrid.destroyDrag();
10820
+ this.dayGrid.unrenderDrag();
10737
10821
  }
10738
10822
  },
10739
10823
 
@@ -10754,35 +10838,40 @@ var AgendaView = fcViews.agenda = View.extend({
10754
10838
 
10755
10839
 
10756
10840
  // Unrenders a visual indications of a selection
10757
- destroySelection: function() {
10758
- this.timeGrid.destroySelection();
10841
+ unrenderSelection: function() {
10842
+ this.timeGrid.unrenderSelection();
10759
10843
  if (this.dayGrid) {
10760
- this.dayGrid.destroySelection();
10844
+ this.dayGrid.unrenderSelection();
10761
10845
  }
10762
10846
  }
10763
10847
 
10764
10848
  });
10765
10849
 
10766
- AgendaView.defaults = AGENDA_DEFAULTS;
10767
-
10768
10850
  ;;
10769
10851
 
10770
- /* A week view with an all-day cell area at the top, and a time grid below
10771
- ----------------------------------------------------------------------------------------------------------------------*/
10852
+ var AGENDA_ALL_DAY_EVENT_LIMIT = 5;
10772
10853
 
10773
- fcViews.agendaWeek = {
10774
- type: 'agenda',
10775
- duration: { weeks: 1 }
10854
+ fcViews.agenda = {
10855
+ 'class': AgendaView,
10856
+ defaults: {
10857
+ allDaySlot: true,
10858
+ allDayText: 'all-day',
10859
+ slotDuration: '00:30:00',
10860
+ minTime: '00:00:00',
10861
+ maxTime: '24:00:00',
10862
+ slotEventOverlap: true // a bad name. confused with overlap/constraint system
10863
+ }
10776
10864
  };
10777
- ;;
10778
-
10779
- /* A day view with an all-day cell area at the top, and a time grid below
10780
- ----------------------------------------------------------------------------------------------------------------------*/
10781
10865
 
10782
10866
  fcViews.agendaDay = {
10783
10867
  type: 'agenda',
10784
10868
  duration: { days: 1 }
10785
10869
  };
10870
+
10871
+ fcViews.agendaWeek = {
10872
+ type: 'agenda',
10873
+ duration: { weeks: 1 }
10874
+ };
10786
10875
  ;;
10787
10876
 
10788
10877
  return fc; // export for Node/CommonJS