fullcalendar-rails 1.5.4.0 → 1.6.1.0
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.
- data/README.md +1 -1
- data/lib/fullcalendar-rails/version.rb +1 -1
- data/vendor/assets/javascripts/fullcalendar.js +398 -240
- data/vendor/assets/javascripts/gcal.js +107 -0
- data/vendor/assets/stylesheets/fullcalendar.css +142 -181
- data/vendor/assets/stylesheets/fullcalendar.print.css +9 -38
- metadata +37 -54
data/README.md
CHANGED
@@ -31,7 +31,7 @@ See the website of the original project for the usage, or my original Rails3 exa
|
|
31
31
|
|
32
32
|
## Versioning
|
33
33
|
|
34
|
-
I am going to version this gem with the version of the fullceldnar code I use, adding an extra digit if I need to release any maintenance versions of the gem itself. Therefore, since this is a first version of this gem and I'm starting by bundling version 1.5.3 of the fullcalendar code, this is version 1.
|
34
|
+
I am going to version this gem with the version of the fullceldnar code I use, adding an extra digit if I need to release any maintenance versions of the gem itself. Therefore, since this is a first version of this gem and I'm starting by bundling version 1.5.3 of the fullcalendar code, this is version 1.6.0.0
|
35
35
|
|
36
36
|
|
37
37
|
## Contributing
|
@@ -1,23 +1,20 @@
|
|
1
|
-
|
2
|
-
*
|
3
|
-
*
|
4
|
-
*
|
5
|
-
|
1
|
+
/*!
|
2
|
+
* FullCalendar v1.6.1
|
3
|
+
* Docs & License: http://arshaw.com/fullcalendar/
|
4
|
+
* (c) 2013 Adam Shaw
|
5
|
+
*/
|
6
|
+
|
7
|
+
/*
|
6
8
|
* Use fullcalendar.css for basic styling.
|
7
9
|
* For event drag & drop, requires jQuery UI draggable.
|
8
10
|
* For event resizing, requires jQuery UI resizable.
|
9
|
-
*
|
10
|
-
* Copyright (c) 2011 Adam Shaw
|
11
|
-
* Dual licensed under the MIT and GPL licenses, located in
|
12
|
-
* MIT-LICENSE.txt and GPL-LICENSE.txt respectively.
|
13
|
-
*
|
14
|
-
* Date: Tue Sep 4 23:38:33 2012 -0700
|
15
|
-
*
|
16
11
|
*/
|
17
12
|
|
18
13
|
(function($, undefined) {
|
19
14
|
|
20
15
|
|
16
|
+
;;
|
17
|
+
|
21
18
|
var defaults = {
|
22
19
|
|
23
20
|
// display
|
@@ -29,6 +26,9 @@ var defaults = {
|
|
29
26
|
right: 'today prev,next'
|
30
27
|
},
|
31
28
|
weekends: true,
|
29
|
+
weekNumbers: false,
|
30
|
+
weekNumberCalculation: 'iso',
|
31
|
+
weekNumberTitle: 'W',
|
32
32
|
|
33
33
|
// editing
|
34
34
|
//editable: false,
|
@@ -66,10 +66,10 @@ var defaults = {
|
|
66
66
|
dayNames: ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],
|
67
67
|
dayNamesShort: ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],
|
68
68
|
buttonText: {
|
69
|
-
prev: '
|
70
|
-
next: '
|
71
|
-
prevYear: '
|
72
|
-
nextYear: '
|
69
|
+
prev: "<span class='fc-text-arrow'>‹</span>",
|
70
|
+
next: "<span class='fc-text-arrow'>›</span>",
|
71
|
+
prevYear: "<span class='fc-text-arrow'>«</span>",
|
72
|
+
nextYear: "<span class='fc-text-arrow'>»</span>",
|
73
73
|
today: 'today',
|
74
74
|
month: 'month',
|
75
75
|
week: 'week',
|
@@ -98,10 +98,10 @@ var rtlDefaults = {
|
|
98
98
|
right: 'title'
|
99
99
|
},
|
100
100
|
buttonText: {
|
101
|
-
prev: '
|
102
|
-
next: '
|
103
|
-
prevYear: '
|
104
|
-
nextYear: '
|
101
|
+
prev: "<span class='fc-text-arrow'>›</span>",
|
102
|
+
next: "<span class='fc-text-arrow'>‹</span>",
|
103
|
+
prevYear: "<span class='fc-text-arrow'>»</span>",
|
104
|
+
nextYear: "<span class='fc-text-arrow'>«</span>"
|
105
105
|
},
|
106
106
|
buttonIcons: {
|
107
107
|
prev: 'circle-triangle-e',
|
@@ -111,7 +111,9 @@ var rtlDefaults = {
|
|
111
111
|
|
112
112
|
|
113
113
|
|
114
|
-
|
114
|
+
;;
|
115
|
+
|
116
|
+
var fc = $.fullCalendar = { version: "1.6.1" };
|
115
117
|
var fcViews = fc.views = {};
|
116
118
|
|
117
119
|
|
@@ -177,6 +179,8 @@ function setDefaults(d) {
|
|
177
179
|
|
178
180
|
|
179
181
|
|
182
|
+
;;
|
183
|
+
|
180
184
|
|
181
185
|
function Calendar(element, options, eventSources) {
|
182
186
|
var t = this;
|
@@ -258,6 +262,9 @@ function Calendar(element, options, eventSources) {
|
|
258
262
|
if (options.isRTL) {
|
259
263
|
element.addClass('fc-rtl');
|
260
264
|
}
|
265
|
+
else {
|
266
|
+
element.addClass('fc-ltr');
|
267
|
+
}
|
261
268
|
if (options.theme) {
|
262
269
|
element.addClass('ui-widget');
|
263
270
|
}
|
@@ -674,6 +681,8 @@ function Calendar(element, options, eventSources) {
|
|
674
681
|
|
675
682
|
}
|
676
683
|
|
684
|
+
;;
|
685
|
+
|
677
686
|
function Header(calendar, options) {
|
678
687
|
var t = this;
|
679
688
|
|
@@ -747,54 +756,47 @@ function Header(calendar, options) {
|
|
747
756
|
var text = smartProperty(options.buttonText, buttonName); // why are we using smartProperty here?
|
748
757
|
var button = $(
|
749
758
|
"<span class='fc-button fc-button-" + buttonName + " " + tm + "-state-default'>" +
|
750
|
-
|
751
|
-
"<span class='fc-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
text
|
757
|
-
) +
|
758
|
-
"</span>" +
|
759
|
-
"<span class='fc-button-effect'><span></span></span>" +
|
760
|
-
"</span>" +
|
759
|
+
(icon ?
|
760
|
+
"<span class='fc-icon-wrap'>" +
|
761
|
+
"<span class='ui-icon ui-icon-" + icon + "'/>" +
|
762
|
+
"</span>" :
|
763
|
+
text
|
764
|
+
) +
|
761
765
|
"</span>"
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
766
|
+
)
|
767
|
+
.click(function() {
|
768
|
+
if (!button.hasClass(tm + '-state-disabled')) {
|
769
|
+
buttonClick();
|
770
|
+
}
|
771
|
+
})
|
772
|
+
.mousedown(function() {
|
773
|
+
button
|
774
|
+
.not('.' + tm + '-state-active')
|
775
|
+
.not('.' + tm + '-state-disabled')
|
776
|
+
.addClass(tm + '-state-down');
|
777
|
+
})
|
778
|
+
.mouseup(function() {
|
779
|
+
button.removeClass(tm + '-state-down');
|
780
|
+
})
|
781
|
+
.hover(
|
782
|
+
function() {
|
771
783
|
button
|
772
784
|
.not('.' + tm + '-state-active')
|
773
785
|
.not('.' + tm + '-state-disabled')
|
774
|
-
.addClass(tm + '-state-
|
775
|
-
}
|
776
|
-
|
777
|
-
button
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
function() {
|
787
|
-
button
|
788
|
-
.removeClass(tm + '-state-hover')
|
789
|
-
.removeClass(tm + '-state-down');
|
790
|
-
}
|
791
|
-
)
|
792
|
-
.appendTo(e);
|
793
|
-
if (!prevButton) {
|
794
|
-
button.addClass(tm + '-corner-left');
|
795
|
-
}
|
796
|
-
prevButton = button;
|
786
|
+
.addClass(tm + '-state-hover');
|
787
|
+
},
|
788
|
+
function() {
|
789
|
+
button
|
790
|
+
.removeClass(tm + '-state-hover')
|
791
|
+
.removeClass(tm + '-state-down');
|
792
|
+
}
|
793
|
+
)
|
794
|
+
.appendTo(e);
|
795
|
+
disableTextSelection(button);
|
796
|
+
if (!prevButton) {
|
797
|
+
button.addClass(tm + '-corner-left');
|
797
798
|
}
|
799
|
+
prevButton = button;
|
798
800
|
}
|
799
801
|
}
|
800
802
|
});
|
@@ -839,6 +841,8 @@ function Header(calendar, options) {
|
|
839
841
|
|
840
842
|
}
|
841
843
|
|
844
|
+
;;
|
845
|
+
|
842
846
|
fc.sourceNormalizers = [];
|
843
847
|
fc.sourceFetchers = [];
|
844
848
|
|
@@ -914,6 +918,16 @@ function EventManager(options, _sources) {
|
|
914
918
|
_fetchEventSource(source, function(events) {
|
915
919
|
if (fetchID == currentFetchID) {
|
916
920
|
if (events) {
|
921
|
+
|
922
|
+
if (options.eventDataTransform) {
|
923
|
+
events = $.map(events, options.eventDataTransform);
|
924
|
+
}
|
925
|
+
if (source.eventDataTransform) {
|
926
|
+
events = $.map(events, source.eventDataTransform);
|
927
|
+
}
|
928
|
+
// TODO: this technique is not ideal for static array event sources.
|
929
|
+
// For arrays, we'll want to process all events right in the beginning, then never again.
|
930
|
+
|
917
931
|
for (var i=0; i<events.length; i++) {
|
918
932
|
events[i].source = source;
|
919
933
|
normalizeEvent(events[i]);
|
@@ -1227,6 +1241,8 @@ function EventManager(options, _sources) {
|
|
1227
1241
|
|
1228
1242
|
}
|
1229
1243
|
|
1244
|
+
;;
|
1245
|
+
|
1230
1246
|
|
1231
1247
|
fc.addDays = addDays;
|
1232
1248
|
fc.cloneDate = cloneDate;
|
@@ -1581,10 +1597,38 @@ var dateFormatters = {
|
|
1581
1597
|
return 'th';
|
1582
1598
|
}
|
1583
1599
|
return ['st', 'nd', 'rd'][date%10-1] || 'th';
|
1600
|
+
},
|
1601
|
+
w : function(d, o) { // local
|
1602
|
+
return o.weekNumberCalculation(d);
|
1603
|
+
},
|
1604
|
+
W : function(d) { // ISO
|
1605
|
+
return iso8601Week(d);
|
1584
1606
|
}
|
1585
1607
|
};
|
1608
|
+
fc.dateFormatters = dateFormatters;
|
1609
|
+
|
1610
|
+
|
1611
|
+
/* thanks jQuery UI (https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.datepicker.js)
|
1612
|
+
*
|
1613
|
+
* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
|
1614
|
+
* @param date Date - the date to get the week for
|
1615
|
+
* @return number - the number of the week within the year that contains this date
|
1616
|
+
*/
|
1617
|
+
function iso8601Week(date) {
|
1618
|
+
var time;
|
1619
|
+
var checkDate = new Date(date.getTime());
|
1620
|
+
|
1621
|
+
// Find Thursday of this week starting on Monday
|
1622
|
+
checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7));
|
1623
|
+
|
1624
|
+
time = checkDate.getTime();
|
1625
|
+
checkDate.setMonth(0); // Compare with Jan 1
|
1626
|
+
checkDate.setDate(1);
|
1627
|
+
return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1;
|
1628
|
+
}
|
1586
1629
|
|
1587
1630
|
|
1631
|
+
;;
|
1588
1632
|
|
1589
1633
|
fc.applyAll = applyAll;
|
1590
1634
|
|
@@ -1953,6 +1997,8 @@ function firstDefined() {
|
|
1953
1997
|
}
|
1954
1998
|
|
1955
1999
|
|
2000
|
+
;;
|
2001
|
+
|
1956
2002
|
fcViews.month = MonthView;
|
1957
2003
|
|
1958
2004
|
function MonthView(element, calendar) {
|
@@ -1999,12 +2045,14 @@ function MonthView(element, calendar) {
|
|
1999
2045
|
t.end = end;
|
2000
2046
|
t.visStart = visStart;
|
2001
2047
|
t.visEnd = visEnd;
|
2002
|
-
renderBasic(
|
2048
|
+
renderBasic(rowCnt, nwe ? 5 : 7, true);
|
2003
2049
|
}
|
2004
2050
|
|
2005
2051
|
|
2006
2052
|
}
|
2007
2053
|
|
2054
|
+
;;
|
2055
|
+
|
2008
2056
|
fcViews.basicWeek = BasicWeekView;
|
2009
2057
|
|
2010
2058
|
function BasicWeekView(element, calendar) {
|
@@ -2045,12 +2093,14 @@ function BasicWeekView(element, calendar) {
|
|
2045
2093
|
t.end = end;
|
2046
2094
|
t.visStart = visStart;
|
2047
2095
|
t.visEnd = visEnd;
|
2048
|
-
renderBasic(1,
|
2096
|
+
renderBasic(1, weekends ? 7 : 5, false);
|
2049
2097
|
}
|
2050
2098
|
|
2051
2099
|
|
2052
2100
|
}
|
2053
2101
|
|
2102
|
+
;;
|
2103
|
+
|
2054
2104
|
fcViews.basicDay = BasicDayView;
|
2055
2105
|
|
2056
2106
|
//TODO: when calendar's date starts out on a weekend, shouldn't happen
|
@@ -2082,12 +2132,14 @@ function BasicDayView(element, calendar) {
|
|
2082
2132
|
t.title = formatDate(date, opt('titleFormat'));
|
2083
2133
|
t.start = t.visStart = cloneDate(date, true);
|
2084
2134
|
t.end = t.visEnd = addDays(cloneDate(t.start), 1);
|
2085
|
-
renderBasic(1, 1,
|
2135
|
+
renderBasic(1, 1, false);
|
2086
2136
|
}
|
2087
2137
|
|
2088
2138
|
|
2089
2139
|
}
|
2090
2140
|
|
2141
|
+
;;
|
2142
|
+
|
2091
2143
|
setDefaults({
|
2092
2144
|
weekMode: 'fixed'
|
2093
2145
|
});
|
@@ -2140,6 +2192,7 @@ function BasicView(element, calendar, viewName) {
|
|
2140
2192
|
|
2141
2193
|
// locals
|
2142
2194
|
|
2195
|
+
var table;
|
2143
2196
|
var head;
|
2144
2197
|
var headCells;
|
2145
2198
|
var body;
|
@@ -2152,6 +2205,7 @@ function BasicView(element, calendar, viewName) {
|
|
2152
2205
|
var viewWidth;
|
2153
2206
|
var viewHeight;
|
2154
2207
|
var colWidth;
|
2208
|
+
var weekNumberWidth;
|
2155
2209
|
|
2156
2210
|
var rowCnt, colCnt;
|
2157
2211
|
var coordinateGrid;
|
@@ -2160,9 +2214,12 @@ function BasicView(element, calendar, viewName) {
|
|
2160
2214
|
|
2161
2215
|
var rtl, dis, dit;
|
2162
2216
|
var firstDay;
|
2163
|
-
var nwe;
|
2217
|
+
var nwe; // no weekends? a 0 or 1 for easy computations
|
2164
2218
|
var tm;
|
2165
2219
|
var colFormat;
|
2220
|
+
var showWeekNumbers;
|
2221
|
+
var weekNumberTitle;
|
2222
|
+
var weekNumberFormat;
|
2166
2223
|
|
2167
2224
|
|
2168
2225
|
|
@@ -2173,17 +2230,17 @@ function BasicView(element, calendar, viewName) {
|
|
2173
2230
|
disableTextSelection(element.addClass('fc-grid'));
|
2174
2231
|
|
2175
2232
|
|
2176
|
-
function renderBasic(
|
2233
|
+
function renderBasic(r, c, showNumbers) {
|
2177
2234
|
rowCnt = r;
|
2178
2235
|
colCnt = c;
|
2179
2236
|
updateOptions();
|
2180
2237
|
var firstTime = !body;
|
2181
2238
|
if (firstTime) {
|
2182
|
-
|
2239
|
+
buildEventContainer();
|
2183
2240
|
}else{
|
2184
2241
|
clearEvents();
|
2185
2242
|
}
|
2186
|
-
|
2243
|
+
buildTable(showNumbers);
|
2187
2244
|
}
|
2188
2245
|
|
2189
2246
|
|
@@ -2201,124 +2258,142 @@ function BasicView(element, calendar, viewName) {
|
|
2201
2258
|
nwe = opt('weekends') ? 0 : 1;
|
2202
2259
|
tm = opt('theme') ? 'ui' : 'fc';
|
2203
2260
|
colFormat = opt('columnFormat');
|
2261
|
+
|
2262
|
+
// week # options. (TODO: bad, logic also in other views)
|
2263
|
+
showWeekNumbers = opt('weekNumbers');
|
2264
|
+
weekNumberTitle = opt('weekNumberTitle');
|
2265
|
+
if (opt('weekNumberCalculation') != 'iso') {
|
2266
|
+
weekNumberFormat = "w";
|
2267
|
+
}
|
2268
|
+
else {
|
2269
|
+
weekNumberFormat = "W";
|
2270
|
+
}
|
2204
2271
|
}
|
2205
2272
|
|
2206
2273
|
|
2207
2274
|
|
2208
|
-
function
|
2209
|
-
|
2275
|
+
function buildEventContainer() {
|
2276
|
+
daySegmentContainer =
|
2277
|
+
$("<div style='position:absolute;z-index:8;top:0;left:0'/>")
|
2278
|
+
.appendTo(element);
|
2279
|
+
}
|
2280
|
+
|
2281
|
+
|
2282
|
+
|
2283
|
+
function buildTable(showNumbers) {
|
2284
|
+
var html = '';
|
2285
|
+
var i, j;
|
2210
2286
|
var headerClass = tm + "-widget-header";
|
2211
2287
|
var contentClass = tm + "-widget-content";
|
2212
|
-
var
|
2213
|
-
var
|
2214
|
-
|
2215
|
-
|
2216
|
-
|
2217
|
-
|
2218
|
-
|
2288
|
+
var month = t.start.getMonth();
|
2289
|
+
var today = clearTime(new Date());
|
2290
|
+
var cellDate; // not to be confused with local function. TODO: better names
|
2291
|
+
var cellClasses;
|
2292
|
+
var cell;
|
2293
|
+
|
2294
|
+
html += "<table class='fc-border-separate' style='width:100%' cellspacing='0'>" +
|
2295
|
+
"<thead>" +
|
2296
|
+
"<tr>";
|
2297
|
+
|
2298
|
+
if (showWeekNumbers) {
|
2299
|
+
html += "<th class='fc-week-number " + headerClass + "'/>";
|
2300
|
+
}
|
2301
|
+
|
2219
2302
|
for (i=0; i<colCnt; i++) {
|
2220
|
-
|
2221
|
-
|
2303
|
+
cellDate = _cellDate(0, i); // a little confusing. cellDate is local variable. _cellDate is private function
|
2304
|
+
html += "<th class='fc-day-header fc-" + dayIDs[cellDate.getDay()] + " " + headerClass + "'/>";
|
2222
2305
|
}
|
2223
|
-
|
2224
|
-
|
2225
|
-
|
2226
|
-
|
2227
|
-
|
2228
|
-
|
2229
|
-
|
2306
|
+
|
2307
|
+
html += "</tr>" +
|
2308
|
+
"</thead>" +
|
2309
|
+
"<tbody>";
|
2310
|
+
|
2311
|
+
for (i=0; i<rowCnt; i++) {
|
2312
|
+
html += "<tr class='fc-week'>";
|
2313
|
+
|
2314
|
+
if (showWeekNumbers) {
|
2315
|
+
html += "<td class='fc-week-number " + contentClass + "'>" +
|
2316
|
+
"<div/>" +
|
2317
|
+
"</td>";
|
2318
|
+
}
|
2319
|
+
|
2230
2320
|
for (j=0; j<colCnt; j++) {
|
2231
|
-
|
2232
|
-
|
2233
|
-
|
2234
|
-
|
2235
|
-
|
2236
|
-
|
2237
|
-
|
2238
|
-
|
2239
|
-
|
2240
|
-
|
2241
|
-
|
2242
|
-
|
2321
|
+
cellDate = _cellDate(i, j); // a little confusing. cellDate is local variable. _cellDate is private function
|
2322
|
+
|
2323
|
+
cellClasses = [
|
2324
|
+
'fc-day',
|
2325
|
+
'fc-' + dayIDs[cellDate.getDay()],
|
2326
|
+
contentClass
|
2327
|
+
];
|
2328
|
+
if (cellDate.getMonth() != month) {
|
2329
|
+
cellClasses.push('fc-other-month');
|
2330
|
+
}
|
2331
|
+
if (+cellDate == +today) {
|
2332
|
+
cellClasses.push('fc-today');
|
2333
|
+
cellClasses.push(tm + '-state-highlight');
|
2334
|
+
}
|
2335
|
+
|
2336
|
+
html += "<td" +
|
2337
|
+
" class='" + cellClasses.join(' ') + "'" +
|
2338
|
+
" data-date='" + formatDate(cellDate, 'yyyy-MM-dd') + "'" +
|
2339
|
+
">" +
|
2340
|
+
"<div>";
|
2341
|
+
if (showNumbers) {
|
2342
|
+
html += "<div class='fc-day-number'>" + cellDate.getDate() + "</div>";
|
2343
|
+
}
|
2344
|
+
html += "<div class='fc-day-content'>" +
|
2345
|
+
"<div style='position:relative'> </div>" +
|
2346
|
+
"</div>" +
|
2347
|
+
"</div>" +
|
2348
|
+
"</td>";
|
2243
2349
|
}
|
2244
|
-
|
2245
|
-
|
2350
|
+
|
2351
|
+
html += "</tr>";
|
2246
2352
|
}
|
2247
|
-
|
2248
|
-
|
2249
|
-
|
2250
|
-
|
2251
|
-
|
2353
|
+
html += "</tbody>" +
|
2354
|
+
"</table>";
|
2355
|
+
|
2356
|
+
lockHeight(); // the unlock happens later, in setHeight()...
|
2357
|
+
if (table) {
|
2358
|
+
table.remove();
|
2359
|
+
}
|
2360
|
+
table = $(html).appendTo(element);
|
2361
|
+
|
2252
2362
|
head = table.find('thead');
|
2253
|
-
headCells = head.find('
|
2363
|
+
headCells = head.find('.fc-day-header');
|
2254
2364
|
body = table.find('tbody');
|
2255
2365
|
bodyRows = body.find('tr');
|
2256
|
-
bodyCells = body.find('
|
2257
|
-
bodyFirstCells =
|
2258
|
-
bodyCellTopInners = bodyRows.eq(0).find('
|
2366
|
+
bodyCells = body.find('.fc-day');
|
2367
|
+
bodyFirstCells = bodyRows.find('td:first-child');
|
2368
|
+
bodyCellTopInners = bodyRows.eq(0).find('.fc-day-content > div');
|
2259
2369
|
|
2260
2370
|
markFirstLast(head.add(head.find('tr'))); // marks first+last tr/th's
|
2261
2371
|
markFirstLast(bodyRows); // marks first+last td's
|
2262
|
-
bodyRows.eq(0).addClass('fc-first');
|
2263
|
-
|
2264
|
-
dayBind(bodyCells);
|
2265
|
-
|
2266
|
-
daySegmentContainer =
|
2267
|
-
$("<div style='position:absolute;z-index:8;top:0;left:0'/>")
|
2268
|
-
.appendTo(element);
|
2269
|
-
}
|
2270
|
-
|
2372
|
+
bodyRows.eq(0).addClass('fc-first');
|
2373
|
+
bodyRows.filter(':last').addClass('fc-last');
|
2271
2374
|
|
2272
|
-
|
2273
|
-
|
2274
|
-
|
2275
|
-
|
2276
|
-
|
2277
|
-
|
2278
|
-
|
2279
|
-
|
2280
|
-
|
2281
|
-
if (
|
2282
|
-
|
2283
|
-
|
2284
|
-
|
2285
|
-
cell.html(formatDate(date, colFormat));
|
2286
|
-
setDayID(cell, date);
|
2375
|
+
if (showWeekNumbers) {
|
2376
|
+
head.find('.fc-week-number').text(weekNumberTitle);
|
2377
|
+
}
|
2378
|
+
|
2379
|
+
headCells.each(function(i, _cell) {
|
2380
|
+
var date = indexDate(i);
|
2381
|
+
$(_cell).text(formatDate(date, colFormat));
|
2382
|
+
});
|
2383
|
+
|
2384
|
+
if (showWeekNumbers) {
|
2385
|
+
body.find('.fc-week-number > div').each(function(i, _cell) {
|
2386
|
+
var weekStart = _cellDate(i, 0);
|
2387
|
+
$(_cell).text(formatDate(weekStart, weekNumberFormat));
|
2287
2388
|
});
|
2288
2389
|
}
|
2289
2390
|
|
2290
2391
|
bodyCells.each(function(i, _cell) {
|
2291
|
-
|
2292
|
-
date
|
2293
|
-
if (date.getMonth() == month) {
|
2294
|
-
cell.removeClass('fc-other-month');
|
2295
|
-
}else{
|
2296
|
-
cell.addClass('fc-other-month');
|
2297
|
-
}
|
2298
|
-
if (+date == +today) {
|
2299
|
-
cell.addClass(tm + '-state-highlight fc-today');
|
2300
|
-
}else{
|
2301
|
-
cell.removeClass(tm + '-state-highlight fc-today');
|
2302
|
-
}
|
2303
|
-
cell.find('div.fc-day-number').text(date.getDate());
|
2304
|
-
if (dowDirty) {
|
2305
|
-
setDayID(cell, date);
|
2306
|
-
}
|
2307
|
-
});
|
2308
|
-
|
2309
|
-
bodyRows.each(function(i, _row) {
|
2310
|
-
row = $(_row);
|
2311
|
-
if (i < rowCnt) {
|
2312
|
-
row.show();
|
2313
|
-
if (i == rowCnt-1) {
|
2314
|
-
row.addClass('fc-last');
|
2315
|
-
}else{
|
2316
|
-
row.removeClass('fc-last');
|
2317
|
-
}
|
2318
|
-
}else{
|
2319
|
-
row.hide();
|
2320
|
-
}
|
2392
|
+
var date = indexDate(i);
|
2393
|
+
trigger('dayRender', t, date, $(_cell));
|
2321
2394
|
});
|
2395
|
+
|
2396
|
+
dayBind(bodyCells);
|
2322
2397
|
}
|
2323
2398
|
|
2324
2399
|
|
@@ -2348,13 +2423,20 @@ function BasicView(element, calendar, viewName) {
|
|
2348
2423
|
}
|
2349
2424
|
});
|
2350
2425
|
|
2426
|
+
unlockHeight();
|
2351
2427
|
}
|
2352
2428
|
|
2353
2429
|
|
2354
2430
|
function setWidth(width) {
|
2355
2431
|
viewWidth = width;
|
2356
2432
|
colContentPositions.clear();
|
2357
|
-
|
2433
|
+
|
2434
|
+
weekNumberWidth = 0;
|
2435
|
+
if (showWeekNumbers) {
|
2436
|
+
weekNumberWidth = head.find('th.fc-week-number').outerWidth();
|
2437
|
+
}
|
2438
|
+
|
2439
|
+
colWidth = Math.floor((viewWidth - weekNumberWidth) / colCnt);
|
2358
2440
|
setOuterWidth(headCells.slice(0, -1), colWidth);
|
2359
2441
|
}
|
2360
2442
|
|
@@ -2372,8 +2454,7 @@ function BasicView(element, calendar, viewName) {
|
|
2372
2454
|
|
2373
2455
|
function dayClick(ev) {
|
2374
2456
|
if (!opt('selectable')) { // if selectable, SelectionManager will worry about dayClick
|
2375
|
-
var
|
2376
|
-
var date = indexDate(index);
|
2457
|
+
var date = parseISO8601($(this).data('date'));
|
2377
2458
|
trigger('dayClick', this, date, true, ev);
|
2378
2459
|
}
|
2379
2460
|
}
|
@@ -2564,15 +2645,34 @@ function BasicView(element, calendar, viewName) {
|
|
2564
2645
|
|
2565
2646
|
|
2566
2647
|
function allDayBounds(i) {
|
2648
|
+
var left = 0;
|
2649
|
+
if (showWeekNumbers) {
|
2650
|
+
left += weekNumberWidth;
|
2651
|
+
}
|
2567
2652
|
return {
|
2568
|
-
left:
|
2653
|
+
left: left,
|
2569
2654
|
right: viewWidth
|
2570
2655
|
};
|
2571
2656
|
}
|
2572
|
-
|
2657
|
+
|
2658
|
+
|
2659
|
+
|
2660
|
+
// makes sure height doesn't collapse while we destroy/render new cells
|
2661
|
+
// (this causes a bad end-user scrollbar jump)
|
2662
|
+
// TODO: generalize this for all view rendering. (also in Calendar.js)
|
2663
|
+
|
2664
|
+
function lockHeight() {
|
2665
|
+
setMinHeight(element, element.height());
|
2666
|
+
}
|
2667
|
+
|
2668
|
+
function unlockHeight() {
|
2669
|
+
setMinHeight(element, 1);
|
2670
|
+
}
|
2573
2671
|
|
2574
2672
|
}
|
2575
2673
|
|
2674
|
+
;;
|
2675
|
+
|
2576
2676
|
function BasicEventRenderer() {
|
2577
2677
|
var t = this;
|
2578
2678
|
|
@@ -2615,6 +2715,7 @@ function BasicEventRenderer() {
|
|
2615
2715
|
function renderEvents(events, modifiedEventId) {
|
2616
2716
|
reportEvents(events);
|
2617
2717
|
renderDaySegs(compileSegs(events), modifiedEventId);
|
2718
|
+
trigger('eventAfterAllRender');
|
2618
2719
|
}
|
2619
2720
|
|
2620
2721
|
|
@@ -2714,6 +2815,8 @@ function BasicEventRenderer() {
|
|
2714
2815
|
|
2715
2816
|
}
|
2716
2817
|
|
2818
|
+
;;
|
2819
|
+
|
2717
2820
|
fcViews.agendaWeek = AgendaWeekView;
|
2718
2821
|
|
2719
2822
|
function AgendaWeekView(element, calendar) {
|
@@ -2760,6 +2863,8 @@ function AgendaWeekView(element, calendar) {
|
|
2760
2863
|
|
2761
2864
|
}
|
2762
2865
|
|
2866
|
+
;;
|
2867
|
+
|
2763
2868
|
fcViews.agendaDay = AgendaDayView;
|
2764
2869
|
|
2765
2870
|
function AgendaDayView(element, calendar) {
|
@@ -2796,6 +2901,8 @@ function AgendaDayView(element, calendar) {
|
|
2796
2901
|
|
2797
2902
|
}
|
2798
2903
|
|
2904
|
+
;;
|
2905
|
+
|
2799
2906
|
setDefaults({
|
2800
2907
|
allDaySlot: true,
|
2801
2908
|
allDayText: 'all-day',
|
@@ -2847,7 +2954,8 @@ function AgendaView(element, calendar, viewName) {
|
|
2847
2954
|
t.getRowCnt = function() { return 1 };
|
2848
2955
|
t.getColCnt = function() { return colCnt };
|
2849
2956
|
t.getColWidth = function() { return colWidth };
|
2850
|
-
t.
|
2957
|
+
t.getSnapHeight = function() { return snapHeight };
|
2958
|
+
t.getSnapMinutes = function() { return snapMinutes };
|
2851
2959
|
t.defaultSelectionEnd = defaultSelectionEnd;
|
2852
2960
|
t.renderDayOverlay = renderDayOverlay;
|
2853
2961
|
t.renderSelection = renderSelection;
|
@@ -2903,7 +3011,10 @@ function AgendaView(element, calendar, viewName) {
|
|
2903
3011
|
var colWidth;
|
2904
3012
|
var gutterWidth;
|
2905
3013
|
var slotHeight; // TODO: what if slotHeight changes? (see issue 650)
|
2906
|
-
|
3014
|
+
|
3015
|
+
var snapMinutes;
|
3016
|
+
var snapRatio; // ratio of number of "selection" slots to normal slots. (ex: 1, 2, 4)
|
3017
|
+
var snapHeight; // holds the pixel hight of a "selection" slot
|
2907
3018
|
|
2908
3019
|
var colCnt;
|
2909
3020
|
var slotCnt;
|
@@ -2911,6 +3022,7 @@ function AgendaView(element, calendar, viewName) {
|
|
2911
3022
|
var hoverListener;
|
2912
3023
|
var colContentPositions;
|
2913
3024
|
var slotTopCache = {};
|
3025
|
+
var savedScrollTop;
|
2914
3026
|
|
2915
3027
|
var tm;
|
2916
3028
|
var firstDay;
|
@@ -2918,6 +3030,9 @@ function AgendaView(element, calendar, viewName) {
|
|
2918
3030
|
var rtl, dis, dit; // day index sign / translate
|
2919
3031
|
var minMinute, maxMinute;
|
2920
3032
|
var colFormat;
|
3033
|
+
var showWeekNumbers;
|
3034
|
+
var weekNumberTitle;
|
3035
|
+
var weekNumberFormat;
|
2921
3036
|
|
2922
3037
|
|
2923
3038
|
|
@@ -2955,6 +3070,18 @@ function AgendaView(element, calendar, viewName) {
|
|
2955
3070
|
minMinute = parseTime(opt('minTime'));
|
2956
3071
|
maxMinute = parseTime(opt('maxTime'));
|
2957
3072
|
colFormat = opt('columnFormat');
|
3073
|
+
|
3074
|
+
// week # options. (TODO: bad, logic also in other views)
|
3075
|
+
showWeekNumbers = opt('weekNumbers');
|
3076
|
+
weekNumberTitle = opt('weekNumberTitle');
|
3077
|
+
if (opt('weekNumberCalculation') != 'iso') {
|
3078
|
+
weekNumberFormat = "w";
|
3079
|
+
}
|
3080
|
+
else {
|
3081
|
+
weekNumberFormat = "W";
|
3082
|
+
}
|
3083
|
+
|
3084
|
+
snapMinutes = opt('snapMinutes') || opt('slotMinutes');
|
2958
3085
|
}
|
2959
3086
|
|
2960
3087
|
|
@@ -2972,8 +3099,15 @@ function AgendaView(element, calendar, viewName) {
|
|
2972
3099
|
s =
|
2973
3100
|
"<table style='width:100%' class='fc-agenda-days fc-border-separate' cellspacing='0'>" +
|
2974
3101
|
"<thead>" +
|
2975
|
-
"<tr>"
|
2976
|
-
|
3102
|
+
"<tr>";
|
3103
|
+
|
3104
|
+
if (showWeekNumbers) {
|
3105
|
+
s += "<th class='fc-agenda-axis fc-week-number " + headerClass + "'/>";
|
3106
|
+
}
|
3107
|
+
else {
|
3108
|
+
s += "<th class='fc-agenda-axis " + headerClass + "'> </th>";
|
3109
|
+
}
|
3110
|
+
|
2977
3111
|
for (i=0; i<colCnt; i++) {
|
2978
3112
|
s +=
|
2979
3113
|
"<th class='fc- fc-col" + i + ' ' + headerClass + "'/>"; // fc- needed for setDayID
|
@@ -3107,6 +3241,18 @@ function AgendaView(element, calendar, viewName) {
|
|
3107
3241
|
var bodyCell;
|
3108
3242
|
var date;
|
3109
3243
|
var today = clearTime(new Date());
|
3244
|
+
|
3245
|
+
if (showWeekNumbers) {
|
3246
|
+
var weekText = formatDate(colDate(0), weekNumberFormat);
|
3247
|
+
if (rtl) {
|
3248
|
+
weekText = weekText + weekNumberTitle;
|
3249
|
+
}
|
3250
|
+
else {
|
3251
|
+
weekText = weekNumberTitle + weekText;
|
3252
|
+
}
|
3253
|
+
dayHead.find('.fc-week-number').text(weekText);
|
3254
|
+
}
|
3255
|
+
|
3110
3256
|
for (i=0; i<colCnt; i++) {
|
3111
3257
|
date = colDate(i);
|
3112
3258
|
headCell = dayHeadCells.eq(i);
|
@@ -3145,6 +3291,9 @@ function AgendaView(element, calendar, viewName) {
|
|
3145
3291
|
slotScroller.height(bodyHeight - allDayHeight - 1);
|
3146
3292
|
|
3147
3293
|
slotHeight = slotTableFirstInner.height() + 1; // +1 for border
|
3294
|
+
|
3295
|
+
snapRatio = opt('slotMinutes') / snapMinutes;
|
3296
|
+
snapHeight = slotHeight / snapRatio;
|
3148
3297
|
|
3149
3298
|
if (dateChanged) {
|
3150
3299
|
resetScroll();
|
@@ -3333,10 +3482,10 @@ function AgendaView(element, calendar, viewName) {
|
|
3333
3482
|
function constrain(n) {
|
3334
3483
|
return Math.max(slotScrollerTop, Math.min(slotScrollerBottom, n));
|
3335
3484
|
}
|
3336
|
-
for (var i=0; i<slotCnt; i++) {
|
3485
|
+
for (var i=0; i<slotCnt*snapRatio; i++) { // adapt slot count to increased/decreased selection slot count
|
3337
3486
|
rows.push([
|
3338
|
-
constrain(slotTableTop +
|
3339
|
-
constrain(slotTableTop +
|
3487
|
+
constrain(slotTableTop + snapHeight*i),
|
3488
|
+
constrain(slotTableTop + snapHeight*(i+1))
|
3340
3489
|
]);
|
3341
3490
|
}
|
3342
3491
|
});
|
@@ -3377,7 +3526,7 @@ function AgendaView(element, calendar, viewName) {
|
|
3377
3526
|
slotIndex--;
|
3378
3527
|
}
|
3379
3528
|
if (slotIndex >= 0) {
|
3380
|
-
addMinutes(d, minMinute + slotIndex *
|
3529
|
+
addMinutes(d, minMinute + slotIndex * snapMinutes);
|
3381
3530
|
}
|
3382
3531
|
return d;
|
3383
3532
|
}
|
@@ -3540,9 +3689,9 @@ function AgendaView(element, calendar, viewName) {
|
|
3540
3689
|
var d2 = cellDate(cell);
|
3541
3690
|
dates = [
|
3542
3691
|
d1,
|
3543
|
-
addMinutes(cloneDate(d1),
|
3692
|
+
addMinutes(cloneDate(d1), snapMinutes), // calculate minutes depending on selection slot minutes
|
3544
3693
|
d2,
|
3545
|
-
addMinutes(cloneDate(d2),
|
3694
|
+
addMinutes(cloneDate(d2), snapMinutes)
|
3546
3695
|
].sort(cmp);
|
3547
3696
|
renderSlotSelection(dates[0], dates[3]);
|
3548
3697
|
}else{
|
@@ -3599,6 +3748,8 @@ function AgendaView(element, calendar, viewName) {
|
|
3599
3748
|
|
3600
3749
|
}
|
3601
3750
|
|
3751
|
+
;;
|
3752
|
+
|
3602
3753
|
function AgendaEventRenderer() {
|
3603
3754
|
var t = this;
|
3604
3755
|
|
@@ -3635,7 +3786,8 @@ function AgendaEventRenderer() {
|
|
3635
3786
|
var resizableDayEvent = t.resizableDayEvent; // TODO: streamline binding architecture
|
3636
3787
|
var getColCnt = t.getColCnt;
|
3637
3788
|
var getColWidth = t.getColWidth;
|
3638
|
-
var
|
3789
|
+
var getSnapHeight = t.getSnapHeight;
|
3790
|
+
var getSnapMinutes = t.getSnapMinutes;
|
3639
3791
|
var getBodyContent = t.getBodyContent;
|
3640
3792
|
var reportEventElement = t.reportEventElement;
|
3641
3793
|
var showEvents = t.showEvents;
|
@@ -3671,6 +3823,7 @@ function AgendaEventRenderer() {
|
|
3671
3823
|
setHeight(); // no params means set to viewHeight
|
3672
3824
|
}
|
3673
3825
|
renderSlotSegs(compileSlotSegs(slotEvents), modifiedEventId);
|
3826
|
+
trigger('eventAfterAllRender');
|
3674
3827
|
}
|
3675
3828
|
|
3676
3829
|
|
@@ -3756,7 +3909,7 @@ function AgendaEventRenderer() {
|
|
3756
3909
|
vsideCache={},
|
3757
3910
|
hsideCache={},
|
3758
3911
|
key, val,
|
3759
|
-
|
3912
|
+
titleElement,
|
3760
3913
|
height,
|
3761
3914
|
slotSegmentContainer = getSlotSegmentContainer(),
|
3762
3915
|
rtl, dis, dit,
|
@@ -3845,9 +3998,9 @@ function AgendaEventRenderer() {
|
|
3845
3998
|
seg.vsides = val === undefined ? (vsideCache[key] = vsides(eventElement, true)) : val;
|
3846
3999
|
val = hsideCache[key];
|
3847
4000
|
seg.hsides = val === undefined ? (hsideCache[key] = hsides(eventElement, true)) : val;
|
3848
|
-
|
3849
|
-
if (
|
3850
|
-
seg.contentTop =
|
4001
|
+
titleElement = eventElement.find('.fc-event-title');
|
4002
|
+
if (titleElement.length) {
|
4003
|
+
seg.contentTop = titleElement[0].offsetTop;
|
3851
4004
|
}
|
3852
4005
|
}
|
3853
4006
|
}
|
@@ -3861,7 +4014,7 @@ function AgendaEventRenderer() {
|
|
3861
4014
|
eventElement[0].style.height = height + 'px';
|
3862
4015
|
event = seg.event;
|
3863
4016
|
if (seg.contentTop !== undefined && height - seg.contentTop < 10) {
|
3864
|
-
// not enough room for title, put it in the time
|
4017
|
+
// not enough room for title, put it in the time (TODO: maybe make both display:inline instead)
|
3865
4018
|
eventElement.find('div.fc-event-time')
|
3866
4019
|
.text(formatDate(event.start, opt('timeFormat')) + ' - ' + event.title);
|
3867
4020
|
eventElement.find('div.fc-event-title')
|
@@ -3878,16 +4031,15 @@ function AgendaEventRenderer() {
|
|
3878
4031
|
var html = "<";
|
3879
4032
|
var url = event.url;
|
3880
4033
|
var skinCss = getSkinCss(event, opt);
|
3881
|
-
var
|
3882
|
-
var classes = ['fc-event', 'fc-event-skin', 'fc-event-vert'];
|
4034
|
+
var classes = ['fc-event', 'fc-event-vert'];
|
3883
4035
|
if (isEventDraggable(event)) {
|
3884
4036
|
classes.push('fc-event-draggable');
|
3885
4037
|
}
|
3886
4038
|
if (seg.isStart) {
|
3887
|
-
classes.push('fc-
|
4039
|
+
classes.push('fc-event-start');
|
3888
4040
|
}
|
3889
4041
|
if (seg.isEnd) {
|
3890
|
-
classes.push('fc-
|
4042
|
+
classes.push('fc-event-end');
|
3891
4043
|
}
|
3892
4044
|
classes = classes.concat(event.className);
|
3893
4045
|
if (event.source) {
|
@@ -3902,19 +4054,15 @@ function AgendaEventRenderer() {
|
|
3902
4054
|
" class='" + classes.join(' ') + "'" +
|
3903
4055
|
" style='position:absolute;z-index:8;top:" + seg.top + "px;left:" + seg.left + "px;" + skinCss + "'" +
|
3904
4056
|
">" +
|
3905
|
-
"<div class='fc-event-inner
|
3906
|
-
"<div class='fc-event-head fc-event-skin'" + skinCssAttr + ">" +
|
4057
|
+
"<div class='fc-event-inner'>" +
|
3907
4058
|
"<div class='fc-event-time'>" +
|
3908
4059
|
htmlEscape(formatDates(event.start, event.end, opt('timeFormat'))) +
|
3909
4060
|
"</div>" +
|
3910
|
-
"</div>" +
|
3911
|
-
"<div class='fc-event-content'>" +
|
3912
4061
|
"<div class='fc-event-title'>" +
|
3913
4062
|
htmlEscape(event.title) +
|
3914
4063
|
"</div>" +
|
3915
4064
|
"</div>" +
|
3916
|
-
"<div class='fc-event-bg'></div>"
|
3917
|
-
"</div>"; // close inner
|
4065
|
+
"<div class='fc-event-bg'></div>";
|
3918
4066
|
if (seg.isEnd && isEventResizable(event)) {
|
3919
4067
|
html +=
|
3920
4068
|
"<div class='ui-resizable-handle ui-resizable-s'>=</div>";
|
@@ -3964,7 +4112,8 @@ function AgendaEventRenderer() {
|
|
3964
4112
|
var dis = opt('isRTL') ? -1 : 1;
|
3965
4113
|
var hoverListener = getHoverListener();
|
3966
4114
|
var colWidth = getColWidth();
|
3967
|
-
var
|
4115
|
+
var snapHeight = getSnapHeight();
|
4116
|
+
var snapMinutes = getSnapMinutes();
|
3968
4117
|
var minMinute = getMinMinute();
|
3969
4118
|
eventElement.draggable({
|
3970
4119
|
zIndex: 9,
|
@@ -3995,9 +4144,9 @@ function AgendaEventRenderer() {
|
|
3995
4144
|
eventElement.width(colWidth - 10); // don't use entire width
|
3996
4145
|
setOuterHeight(
|
3997
4146
|
eventElement,
|
3998
|
-
|
3999
|
-
(event.end ? ((event.end - event.start) / MINUTE_MS) : opt('defaultEventMinutes'))
|
4000
|
-
|
4147
|
+
snapHeight * Math.round(
|
4148
|
+
(event.end ? ((event.end - event.start) / MINUTE_MS) : opt('defaultEventMinutes')) /
|
4149
|
+
snapMinutes
|
4001
4150
|
)
|
4002
4151
|
);
|
4003
4152
|
eventElement.draggable('option', 'grid', [colWidth, 1]);
|
@@ -4029,8 +4178,8 @@ function AgendaEventRenderer() {
|
|
4029
4178
|
// changed!
|
4030
4179
|
var minuteDelta = 0;
|
4031
4180
|
if (!allDay) {
|
4032
|
-
minuteDelta = Math.round((eventElement.offset().top - getBodyContent().offset().top) /
|
4033
|
-
*
|
4181
|
+
minuteDelta = Math.round((eventElement.offset().top - getBodyContent().offset().top) / snapHeight)
|
4182
|
+
* snapMinutes
|
4034
4183
|
+ minMinute
|
4035
4184
|
- (event.start.getHours() * 60 + event.start.getMinutes());
|
4036
4185
|
}
|
@@ -4063,11 +4212,12 @@ function AgendaEventRenderer() {
|
|
4063
4212
|
var hoverListener = getHoverListener();
|
4064
4213
|
var colCnt = getColCnt();
|
4065
4214
|
var colWidth = getColWidth();
|
4066
|
-
var
|
4215
|
+
var snapHeight = getSnapHeight();
|
4216
|
+
var snapMinutes = getSnapMinutes();
|
4067
4217
|
eventElement.draggable({
|
4068
4218
|
zIndex: 9,
|
4069
4219
|
scroll: false,
|
4070
|
-
grid: [colWidth,
|
4220
|
+
grid: [colWidth, snapHeight],
|
4071
4221
|
axis: colCnt==1 ? 'y' : false,
|
4072
4222
|
opacity: opt('dragOpacity'),
|
4073
4223
|
revertDuration: opt('dragRevertDuration'),
|
@@ -4101,7 +4251,7 @@ function AgendaEventRenderer() {
|
|
4101
4251
|
}, ev, 'drag');
|
4102
4252
|
},
|
4103
4253
|
drag: function(ev, ui) {
|
4104
|
-
minuteDelta = Math.round((ui.position.top - origPosition.top) /
|
4254
|
+
minuteDelta = Math.round((ui.position.top - origPosition.top) / snapHeight) * snapMinutes;
|
4105
4255
|
if (minuteDelta != prevMinuteDelta) {
|
4106
4256
|
if (!allDay) {
|
4107
4257
|
updateTimeText(minuteDelta);
|
@@ -4138,7 +4288,7 @@ function AgendaEventRenderer() {
|
|
4138
4288
|
// convert back to original slot-event
|
4139
4289
|
if (allDay) {
|
4140
4290
|
timeElement.css('display', ''); // show() was causing display=inline
|
4141
|
-
eventElement.draggable('option', 'grid', [colWidth,
|
4291
|
+
eventElement.draggable('option', 'grid', [colWidth, snapHeight]);
|
4142
4292
|
allDay = false;
|
4143
4293
|
}
|
4144
4294
|
}
|
@@ -4151,38 +4301,39 @@ function AgendaEventRenderer() {
|
|
4151
4301
|
|
4152
4302
|
|
4153
4303
|
function resizableSlotEvent(event, eventElement, timeElement) {
|
4154
|
-
var
|
4155
|
-
var
|
4304
|
+
var snapDelta, prevSnapDelta;
|
4305
|
+
var snapHeight = getSnapHeight();
|
4306
|
+
var snapMinutes = getSnapMinutes();
|
4156
4307
|
eventElement.resizable({
|
4157
4308
|
handles: {
|
4158
|
-
s: '
|
4309
|
+
s: '.ui-resizable-handle'
|
4159
4310
|
},
|
4160
|
-
grid:
|
4311
|
+
grid: snapHeight,
|
4161
4312
|
start: function(ev, ui) {
|
4162
|
-
|
4313
|
+
snapDelta = prevSnapDelta = 0;
|
4163
4314
|
hideEvents(event, eventElement);
|
4164
4315
|
eventElement.css('z-index', 9);
|
4165
4316
|
trigger('eventResizeStart', this, event, ev, ui);
|
4166
4317
|
},
|
4167
4318
|
resize: function(ev, ui) {
|
4168
4319
|
// don't rely on ui.size.height, doesn't take grid into account
|
4169
|
-
|
4170
|
-
if (
|
4320
|
+
snapDelta = Math.round((Math.max(snapHeight, eventElement.height()) - ui.originalSize.height) / snapHeight);
|
4321
|
+
if (snapDelta != prevSnapDelta) {
|
4171
4322
|
timeElement.text(
|
4172
4323
|
formatDates(
|
4173
4324
|
event.start,
|
4174
|
-
(!
|
4175
|
-
addMinutes(eventEnd(event),
|
4325
|
+
(!snapDelta && !event.end) ? null : // no change, so don't display time range
|
4326
|
+
addMinutes(eventEnd(event), snapMinutes*snapDelta),
|
4176
4327
|
opt('timeFormat')
|
4177
4328
|
)
|
4178
4329
|
);
|
4179
|
-
|
4330
|
+
prevSnapDelta = snapDelta;
|
4180
4331
|
}
|
4181
4332
|
},
|
4182
4333
|
stop: function(ev, ui) {
|
4183
4334
|
trigger('eventResizeStop', this, event, ev, ui);
|
4184
|
-
if (
|
4185
|
-
eventResize(this, event, 0,
|
4335
|
+
if (snapDelta) {
|
4336
|
+
eventResize(this, event, 0, snapMinutes*snapDelta, ev, ui);
|
4186
4337
|
}else{
|
4187
4338
|
eventElement.css('z-index', 8);
|
4188
4339
|
showEvents(event, eventElement);
|
@@ -4214,6 +4365,8 @@ function countForwardSegs(levels) {
|
|
4214
4365
|
|
4215
4366
|
|
4216
4367
|
|
4368
|
+
;;
|
4369
|
+
|
4217
4370
|
|
4218
4371
|
function View(element, calendar, viewName) {
|
4219
4372
|
var t = this;
|
@@ -4468,6 +4621,8 @@ function View(element, calendar, viewName) {
|
|
4468
4621
|
|
4469
4622
|
}
|
4470
4623
|
|
4624
|
+
;;
|
4625
|
+
|
4471
4626
|
function DayEventRenderer() {
|
4472
4627
|
var t = this;
|
4473
4628
|
|
@@ -4605,28 +4760,22 @@ function DayEventRenderer() {
|
|
4605
4760
|
for (i=0; i<segCnt; i++) {
|
4606
4761
|
seg = segs[i];
|
4607
4762
|
event = seg.event;
|
4608
|
-
classes = ['fc-event', 'fc-event-
|
4763
|
+
classes = ['fc-event', 'fc-event-hori'];
|
4609
4764
|
if (isEventDraggable(event)) {
|
4610
4765
|
classes.push('fc-event-draggable');
|
4611
4766
|
}
|
4767
|
+
if (seg.isStart) {
|
4768
|
+
classes.push('fc-event-start');
|
4769
|
+
}
|
4770
|
+
if (seg.isEnd) {
|
4771
|
+
classes.push('fc-event-end');
|
4772
|
+
}
|
4612
4773
|
if (rtl) {
|
4613
|
-
if (seg.isStart) {
|
4614
|
-
classes.push('fc-corner-right');
|
4615
|
-
}
|
4616
|
-
if (seg.isEnd) {
|
4617
|
-
classes.push('fc-corner-left');
|
4618
|
-
}
|
4619
4774
|
leftCol = dayOfWeekCol(seg.end.getDay()-1);
|
4620
4775
|
rightCol = dayOfWeekCol(seg.start.getDay());
|
4621
4776
|
left = seg.isEnd ? colContentLeft(leftCol) : minLeft;
|
4622
4777
|
right = seg.isStart ? colContentRight(rightCol) : maxLeft;
|
4623
4778
|
}else{
|
4624
|
-
if (seg.isStart) {
|
4625
|
-
classes.push('fc-corner-left');
|
4626
|
-
}
|
4627
|
-
if (seg.isEnd) {
|
4628
|
-
classes.push('fc-corner-right');
|
4629
|
-
}
|
4630
4779
|
leftCol = dayOfWeekCol(seg.start.getDay());
|
4631
4780
|
rightCol = dayOfWeekCol(seg.end.getDay()-1);
|
4632
4781
|
left = seg.isStart ? colContentLeft(leftCol) : minLeft;
|
@@ -4647,10 +4796,7 @@ function DayEventRenderer() {
|
|
4647
4796
|
" class='" + classes.join(' ') + "'" +
|
4648
4797
|
" style='position:absolute;z-index:8;left:"+left+"px;" + skinCss + "'" +
|
4649
4798
|
">" +
|
4650
|
-
"<div"
|
4651
|
-
" class='fc-event-inner fc-event-skin'" +
|
4652
|
-
(skinCss ? " style='" + skinCss + "'" : '') +
|
4653
|
-
">";
|
4799
|
+
"<div class='fc-event-inner'>";
|
4654
4800
|
if (!event.allDay && seg.isStart) {
|
4655
4801
|
html +=
|
4656
4802
|
"<span class='fc-event-time'>" +
|
@@ -4812,7 +4958,7 @@ function DayEventRenderer() {
|
|
4812
4958
|
var rowDivs = [];
|
4813
4959
|
for (i=0; i<rowCnt; i++) {
|
4814
4960
|
rowDivs[i] = allDayRow(i)
|
4815
|
-
.find('
|
4961
|
+
.find('div.fc-day-content > div'); // optimal selector?
|
4816
4962
|
}
|
4817
4963
|
return rowDivs;
|
4818
4964
|
}
|
@@ -4855,7 +5001,7 @@ function DayEventRenderer() {
|
|
4855
5001
|
function resizableDayEvent(event, element, seg) {
|
4856
5002
|
var rtl = opt('isRTL');
|
4857
5003
|
var direction = rtl ? 'w' : 'e';
|
4858
|
-
var handle = element.find('
|
5004
|
+
var handle = element.find('.ui-resizable-' + direction); // TODO: stop using this class because we aren't using jqui for this
|
4859
5005
|
var isResizing = false;
|
4860
5006
|
|
4861
5007
|
// TODO: look into using jquery-ui mouse widget for this stuff
|
@@ -4951,6 +5097,8 @@ function DayEventRenderer() {
|
|
4951
5097
|
|
4952
5098
|
}
|
4953
5099
|
|
5100
|
+
;;
|
5101
|
+
|
4954
5102
|
//BUG: unselect needs to be triggered when events are dragged+dropped
|
4955
5103
|
|
4956
5104
|
function SelectionManager() {
|
@@ -5048,6 +5196,8 @@ function SelectionManager() {
|
|
5048
5196
|
|
5049
5197
|
|
5050
5198
|
}
|
5199
|
+
|
5200
|
+
;;
|
5051
5201
|
|
5052
5202
|
function OverlayManager() {
|
5053
5203
|
var t = this;
|
@@ -5086,6 +5236,8 @@ function OverlayManager() {
|
|
5086
5236
|
|
5087
5237
|
}
|
5088
5238
|
|
5239
|
+
;;
|
5240
|
+
|
5089
5241
|
function CoordinateGrid(buildFunc) {
|
5090
5242
|
|
5091
5243
|
var t = this;
|
@@ -5132,6 +5284,8 @@ function CoordinateGrid(buildFunc) {
|
|
5132
5284
|
|
5133
5285
|
}
|
5134
5286
|
|
5287
|
+
;;
|
5288
|
+
|
5135
5289
|
function HoverListener(coordinateGrid) {
|
5136
5290
|
|
5137
5291
|
|
@@ -5190,6 +5344,8 @@ function _fixUIEvent(event) { // for issue 1168
|
|
5190
5344
|
event.pageY = event.originalEvent.pageY;
|
5191
5345
|
}
|
5192
5346
|
}
|
5347
|
+
;;
|
5348
|
+
|
5193
5349
|
function HorizontalPositionCache(getElement) {
|
5194
5350
|
|
5195
5351
|
var t = this,
|
@@ -5216,5 +5372,7 @@ function HorizontalPositionCache(getElement) {
|
|
5216
5372
|
};
|
5217
5373
|
|
5218
5374
|
}
|
5219
|
-
|
5220
|
-
|
5375
|
+
|
5376
|
+
;;
|
5377
|
+
|
5378
|
+
})(jQuery);
|