bootstrap-daterangepicker-rails 0.0.3 → 0.0.5
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.
@@ -142,4 +142,4 @@ return g._start.call({},s);};$D._parse=$D.parse;$D.parse=function(s){var r=null;
|
|
142
142
|
if(s instanceof Date){return s;}
|
143
143
|
try{r=$D.Grammar.start.call({},s.replace(/^\s*(\S*(\s+\S+)*)\s*$/,"$1"));}catch(e){return null;}
|
144
144
|
return((r[1].length===0)?r[0]:null);};$D.getParseFunction=function(fx){var fn=$D.Grammar.formats(fx);return function(s){var r=null;try{r=fn.call({},s);}catch(e){return null;}
|
145
|
-
return((r[1].length===0)?r[0]:null);};};$D.parseExact=function(s,fx){return $D.getParseFunction(fx)(s);};}());
|
145
|
+
return((r[1].length===0)?r[0]:null);};};$D.parseExact=function(s,fx){return $D.getParseFunction(fx)(s);};}());
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/**
|
2
|
-
* @version: 1.
|
2
|
+
* @version: 1.1
|
3
3
|
* @author: Dan Grossman http://www.dangrossman.info/
|
4
|
-
* @date:
|
4
|
+
* @date: 2013-03-04
|
5
5
|
* @copyright: Copyright (c) 2012 Dan Grossman. All rights reserved.
|
6
6
|
* @license: Licensed under Apache License v2.0. See http://www.apache.org/licenses/LICENSE-2.0
|
7
7
|
* @website: http://www.improvely.com/
|
@@ -9,7 +9,7 @@
|
|
9
9
|
!function ($) {
|
10
10
|
|
11
11
|
var DateRangePicker = function (element, options, cb) {
|
12
|
-
var hasOptions = typeof options == 'object'
|
12
|
+
var hasOptions = typeof options == 'object';
|
13
13
|
var localeObject;
|
14
14
|
|
15
15
|
//state
|
@@ -18,18 +18,28 @@
|
|
18
18
|
this.minDate = false;
|
19
19
|
this.maxDate = false;
|
20
20
|
this.changed = false;
|
21
|
+
this.cleared = false;
|
22
|
+
this.showDropdowns = false;
|
21
23
|
this.ranges = {};
|
24
|
+
this.dateLimit = false;
|
22
25
|
this.opens = 'right';
|
23
26
|
this.cb = function () { };
|
24
27
|
this.format = 'MM/dd/yyyy';
|
28
|
+
this.separator = ' - ';
|
29
|
+
this.showWeekNumbers = false;
|
30
|
+
this.buttonClasses = ['btn-success'];
|
31
|
+
this.applyClass = 'btn btn-small btn-success';
|
32
|
+
this.clearClass = 'btn btn-small';
|
25
33
|
this.locale = {
|
26
|
-
applyLabel:
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
34
|
+
applyLabel: 'Apply',
|
35
|
+
clearLabel:"Clear",
|
36
|
+
fromLabel: 'From',
|
37
|
+
toLabel: 'To',
|
38
|
+
weekLabel: 'W',
|
39
|
+
customRangeLabel: 'Custom Range',
|
40
|
+
daysOfWeek: Date.CultureInfo.shortestDayNames,
|
41
|
+
monthNames: Date.CultureInfo.monthNames,
|
42
|
+
firstDay: 0
|
33
43
|
};
|
34
44
|
|
35
45
|
localeObject = this.locale;
|
@@ -47,14 +57,26 @@
|
|
47
57
|
//element that triggered the date range picker
|
48
58
|
this.element = $(element);
|
49
59
|
|
60
|
+
//try parse date if in text input
|
61
|
+
if (!hasOptions || (typeof options.startDate == 'undefined' && typeof options.endDate == 'undefined')) {
|
62
|
+
if ($(this.element).is('input[type=text]')) {
|
63
|
+
var val = $(this.element).val();
|
64
|
+
var split = val.split(this.separator);
|
65
|
+
|
66
|
+
if(split.length == 2) {
|
67
|
+
this.startDate = Date.parseExact(split[0], this.format);
|
68
|
+
this.endDate = Date.parseExact(split[1], this.format);
|
69
|
+
}
|
70
|
+
}
|
71
|
+
}
|
72
|
+
|
50
73
|
if (this.element.hasClass('pull-right'))
|
51
74
|
this.opens = 'left';
|
52
75
|
|
53
76
|
if (this.element.is('input')) {
|
54
77
|
this.element.on({
|
55
78
|
click: $.proxy(this.show, this),
|
56
|
-
focus: $.proxy(this.show, this)
|
57
|
-
blur: $.proxy(this.hide, this)
|
79
|
+
focus: $.proxy(this.show, this)
|
58
80
|
});
|
59
81
|
} else {
|
60
82
|
this.element.on('click', $.proxy(this.show, this));
|
@@ -66,6 +88,14 @@
|
|
66
88
|
localeObject[property] = options.locale[property] || value;
|
67
89
|
});
|
68
90
|
}
|
91
|
+
|
92
|
+
if (options.applyClass) {
|
93
|
+
this.applyClass = options.applyClass;
|
94
|
+
}
|
95
|
+
|
96
|
+
if (options.clearClass) {
|
97
|
+
this.clearClass = options.clearClass;
|
98
|
+
}
|
69
99
|
}
|
70
100
|
|
71
101
|
var DRPTemplate = '<div class="daterangepicker dropdown-menu">' +
|
@@ -73,20 +103,20 @@
|
|
73
103
|
'<div class="calendar right"></div>' +
|
74
104
|
'<div class="ranges">' +
|
75
105
|
'<div class="range_inputs">' +
|
76
|
-
'<div style="float: left">' +
|
106
|
+
'<div class="daterangepicker_start_input" style="float: left">' +
|
77
107
|
'<label for="daterangepicker_start">' + this.locale.fromLabel + '</label>' +
|
78
108
|
'<input class="input-mini" type="text" name="daterangepicker_start" value="" disabled="disabled" />' +
|
79
109
|
'</div>' +
|
80
|
-
'<div style="float: left; padding-left: 11px">' +
|
110
|
+
'<div class="daterangepicker_end_input" style="float: left; padding-left: 11px">' +
|
81
111
|
'<label for="daterangepicker_end">' + this.locale.toLabel + '</label>' +
|
82
112
|
'<input class="input-mini" type="text" name="daterangepicker_end" value="" disabled="disabled" />' +
|
83
113
|
'</div>' +
|
84
|
-
'<button class="
|
114
|
+
'<button class="' + this.applyClass + ' applyBtn" disabled="disabled">' + this.locale.applyLabel + '</button> ' +
|
115
|
+
'<button class="' + this.clearClass + ' clearBtn">' + this.locale.clearLabel + '</button>' +
|
85
116
|
'</div>' +
|
86
117
|
'</div>' +
|
87
118
|
'</div>';
|
88
119
|
|
89
|
-
//the date range picker
|
90
120
|
this.container = $(DRPTemplate).appendTo('body');
|
91
121
|
|
92
122
|
if (hasOptions) {
|
@@ -94,18 +124,20 @@
|
|
94
124
|
if (typeof options.format == 'string')
|
95
125
|
this.format = options.format;
|
96
126
|
|
127
|
+
if (typeof options.separator == 'string')
|
128
|
+
this.separator = options.separator;
|
129
|
+
|
97
130
|
if (typeof options.startDate == 'string')
|
98
|
-
this.startDate = Date.
|
131
|
+
this.startDate = Date.parseExact(options.startDate, this.format);
|
99
132
|
|
100
133
|
if (typeof options.endDate == 'string')
|
101
|
-
this.endDate = Date.
|
134
|
+
this.endDate = Date.parseExact(options.endDate, this.format);
|
102
135
|
|
103
136
|
if (typeof options.minDate == 'string')
|
104
|
-
this.minDate = Date.
|
137
|
+
this.minDate = Date.parseExact(options.minDate, this.format);
|
105
138
|
|
106
139
|
if (typeof options.maxDate == 'string')
|
107
|
-
this.maxDate = Date.
|
108
|
-
|
140
|
+
this.maxDate = Date.parseExact(options.maxDate, this.format);
|
109
141
|
|
110
142
|
if (typeof options.startDate == 'object')
|
111
143
|
this.startDate = options.startDate;
|
@@ -159,6 +191,9 @@
|
|
159
191
|
list += '</ul>';
|
160
192
|
this.container.find('.ranges').prepend(list);
|
161
193
|
}
|
194
|
+
|
195
|
+
if (typeof options.dateLimit == 'object')
|
196
|
+
this.dateLimit = options.dateLimit;
|
162
197
|
|
163
198
|
// update day names order to firstDay
|
164
199
|
if (typeof options.locale == 'object') {
|
@@ -174,8 +209,31 @@
|
|
174
209
|
|
175
210
|
if (typeof options.opens == 'string')
|
176
211
|
this.opens = options.opens;
|
212
|
+
|
213
|
+
if (typeof options.showWeekNumbers == 'boolean') {
|
214
|
+
this.showWeekNumbers = options.showWeekNumbers;
|
215
|
+
}
|
216
|
+
|
217
|
+
if (typeof options.buttonClasses == 'string') {
|
218
|
+
this.buttonClasses = [options.buttonClasses];
|
219
|
+
}
|
220
|
+
|
221
|
+
if (typeof options.buttonClasses == 'object') {
|
222
|
+
this.buttonClasses = options.buttonClasses;
|
223
|
+
}
|
224
|
+
|
225
|
+
if (typeof options.showDropdowns == 'boolean') {
|
226
|
+
this.showDropdowns = options.showDropdowns;
|
227
|
+
}
|
228
|
+
|
177
229
|
}
|
178
230
|
|
231
|
+
//apply CSS classes to buttons
|
232
|
+
var c = this.container;
|
233
|
+
$.each(this.buttonClasses, function (idx, val) {
|
234
|
+
c.find('button').addClass(val);
|
235
|
+
});
|
236
|
+
|
179
237
|
if (this.opens == 'right') {
|
180
238
|
//swap calendar positions
|
181
239
|
var left = this.container.find('.calendar.left');
|
@@ -196,7 +254,8 @@
|
|
196
254
|
this.container.on('mousedown', $.proxy(this.mousedown, this));
|
197
255
|
this.container.find('.calendar').on('click', '.prev', $.proxy(this.clickPrev, this));
|
198
256
|
this.container.find('.calendar').on('click', '.next', $.proxy(this.clickNext, this));
|
199
|
-
this.container.find('.ranges').on('click', 'button', $.proxy(this.clickApply, this));
|
257
|
+
this.container.find('.ranges').on('click', 'button.applyBtn', $.proxy(this.clickApply, this));
|
258
|
+
this.container.find('.ranges').on('click', 'button.clearBtn', $.proxy(this.clickClear, this));
|
200
259
|
|
201
260
|
this.container.find('.calendar').on('click', 'td.available', $.proxy(this.clickDate, this));
|
202
261
|
this.container.find('.calendar').on('mouseenter', 'td.available', $.proxy(this.enterDate, this));
|
@@ -205,6 +264,9 @@
|
|
205
264
|
this.container.find('.ranges').on('click', 'li', $.proxy(this.clickRange, this));
|
206
265
|
this.container.find('.ranges').on('mouseenter', 'li', $.proxy(this.enterRange, this));
|
207
266
|
this.container.find('.ranges').on('mouseleave', 'li', $.proxy(this.updateView, this));
|
267
|
+
|
268
|
+
this.container.find('.calendar').on('change', 'select.yearselect', $.proxy(this.updateYear, this));
|
269
|
+
this.container.find('.calendar').on('change', 'select.monthselect', $.proxy(this.updateMonth, this));
|
208
270
|
|
209
271
|
this.element.on('keyup', $.proxy(this.updateFromControl, this));
|
210
272
|
|
@@ -217,9 +279,12 @@
|
|
217
279
|
|
218
280
|
constructor: DateRangePicker,
|
219
281
|
|
220
|
-
mousedown: function (e) {
|
282
|
+
mousedown: function (e) {
|
221
283
|
e.stopPropagation();
|
222
|
-
|
284
|
+
|
285
|
+
//allow select list to function normally
|
286
|
+
if(!this.showDropdowns || $(e.target).not('select').length)
|
287
|
+
e.preventDefault();
|
223
288
|
},
|
224
289
|
|
225
290
|
updateView: function () {
|
@@ -230,16 +295,16 @@
|
|
230
295
|
this.container.find('input[name=daterangepicker_end]').val(this.endDate.toString(this.format));
|
231
296
|
|
232
297
|
if (this.startDate.equals(this.endDate) || this.startDate.isBefore(this.endDate)) {
|
233
|
-
this.container.find('button').removeAttr('disabled');
|
298
|
+
this.container.find('button.applyBtn').removeAttr('disabled');
|
234
299
|
} else {
|
235
|
-
this.container.find('button').attr('disabled', 'disabled');
|
300
|
+
this.container.find('button.applyBtn').attr('disabled', 'disabled');
|
236
301
|
}
|
237
302
|
},
|
238
303
|
|
239
304
|
updateFromControl: function () {
|
240
305
|
if (!this.element.is('input')) return;
|
241
306
|
|
242
|
-
var dateString = this.element.val().split(
|
307
|
+
var dateString = this.element.val().split(this.separator);
|
243
308
|
var start = Date.parseExact(dateString[0], this.format);
|
244
309
|
var end = Date.parseExact(dateString[1], this.format);
|
245
310
|
|
@@ -255,12 +320,17 @@
|
|
255
320
|
},
|
256
321
|
|
257
322
|
notify: function () {
|
258
|
-
this.
|
323
|
+
if (!this.cleared) {
|
324
|
+
this.updateView();
|
325
|
+
}
|
259
326
|
|
260
327
|
if (this.element.is('input')) {
|
261
|
-
this.element.val(this.startDate.toString(this.format) +
|
328
|
+
this.element.val(this.cleared ? '' : this.startDate.toString(this.format) + this.separator + this.endDate.toString(this.format));
|
262
329
|
}
|
263
|
-
|
330
|
+
var arg1 = (this.cleared ? null : this.startDate),
|
331
|
+
arg2 = (this.cleared ? null : this.endDate);
|
332
|
+
this.cleared = false;
|
333
|
+
this.cb(arg1,arg2);
|
264
334
|
},
|
265
335
|
|
266
336
|
move: function () {
|
@@ -289,6 +359,8 @@
|
|
289
359
|
}
|
290
360
|
|
291
361
|
this.changed = false;
|
362
|
+
|
363
|
+
this.element.trigger('shown',{target:e.target,picker:this});
|
292
364
|
|
293
365
|
$(document).on('mousedown', $.proxy(this.hide, this));
|
294
366
|
},
|
@@ -379,9 +451,34 @@
|
|
379
451
|
if (cal.hasClass('left')) {
|
380
452
|
startDate = this.leftCalendar.calendar[row][col];
|
381
453
|
endDate = this.endDate;
|
454
|
+
if (typeof this.dateLimit == 'object') {
|
455
|
+
var maxDate = new Date(startDate).add(this.dateLimit);
|
456
|
+
if (endDate.isAfter(maxDate)) {
|
457
|
+
endDate = maxDate;
|
458
|
+
}
|
459
|
+
}
|
460
|
+
this.element.trigger('clicked', {
|
461
|
+
dir: 'left',
|
462
|
+
picker: this
|
463
|
+
});
|
382
464
|
} else {
|
383
465
|
startDate = this.startDate;
|
384
466
|
endDate = this.rightCalendar.calendar[row][col];
|
467
|
+
if (typeof this.dateLimit == 'object') {
|
468
|
+
var negConfig = {
|
469
|
+
days: 0 - this.dateLimit.days,
|
470
|
+
months: 0 - this.dateLimit.months,
|
471
|
+
years: 0 - this.dateLimit.years
|
472
|
+
};
|
473
|
+
var minDate = new Date(endDate).add(negConfig);
|
474
|
+
if (startDate.isBefore(minDate)) {
|
475
|
+
startDate = minDate;
|
476
|
+
}
|
477
|
+
}
|
478
|
+
this.element.trigger('clicked', {
|
479
|
+
dir: 'right',
|
480
|
+
picker: this
|
481
|
+
});
|
385
482
|
}
|
386
483
|
|
387
484
|
cal.find('td').removeClass('active');
|
@@ -392,6 +489,11 @@
|
|
392
489
|
this.changed = true;
|
393
490
|
this.startDate = startDate;
|
394
491
|
this.endDate = endDate;
|
492
|
+
} else if (startDate.isAfter(endDate)) {
|
493
|
+
$(e.target).addClass('active');
|
494
|
+
this.changed = true;
|
495
|
+
this.startDate = startDate;
|
496
|
+
this.endDate = startDate.clone().add(1).days();
|
395
497
|
}
|
396
498
|
|
397
499
|
this.leftCalendar.month.set({ month: this.startDate.getMonth(), year: this.startDate.getFullYear() });
|
@@ -403,11 +505,58 @@
|
|
403
505
|
this.hide();
|
404
506
|
},
|
405
507
|
|
508
|
+
clickClear: function (e) {
|
509
|
+
this.changed = true;
|
510
|
+
this.cleared = true;
|
511
|
+
this.hide();
|
512
|
+
},
|
513
|
+
|
514
|
+
updateYear: function(e) {
|
515
|
+
var year = parseInt($(e.target).val());
|
516
|
+
var isLeft = $(e.target).closest('.calendar').hasClass('left');
|
517
|
+
|
518
|
+
if(isLeft) {
|
519
|
+
this.leftCalendar.month.set({ month: this.startDate.getMonth(), year: year });
|
520
|
+
} else {
|
521
|
+
this.rightCalendar.month.set({ month: this.endDate.getMonth(), year: year });
|
522
|
+
}
|
523
|
+
|
524
|
+
this.updateCalendars();
|
525
|
+
},
|
526
|
+
|
527
|
+
updateMonth: function(e) {
|
528
|
+
var month = parseInt($(e.target).val());
|
529
|
+
var isLeft = $(e.target).closest('.calendar').hasClass('left');
|
530
|
+
|
531
|
+
if(isLeft) {
|
532
|
+
this.leftCalendar.month.set({ month: month, year: this.startDate.getFullYear() });
|
533
|
+
} else {
|
534
|
+
this.rightCalendar.month.set({ month: month, year: this.endDate.getFullYear() });
|
535
|
+
}
|
536
|
+
|
537
|
+
this.updateCalendars();
|
538
|
+
},
|
539
|
+
|
406
540
|
updateCalendars: function () {
|
407
541
|
this.leftCalendar.calendar = this.buildCalendar(this.leftCalendar.month.getMonth(), this.leftCalendar.month.getFullYear());
|
408
542
|
this.rightCalendar.calendar = this.buildCalendar(this.rightCalendar.month.getMonth(), this.rightCalendar.month.getFullYear());
|
409
|
-
this.container.find('.calendar.left').html(this.renderCalendar(this.leftCalendar.calendar, this.startDate, this.minDate, this.
|
543
|
+
this.container.find('.calendar.left').html(this.renderCalendar(this.leftCalendar.calendar, this.startDate, this.minDate, this.maxDate));
|
410
544
|
this.container.find('.calendar.right').html(this.renderCalendar(this.rightCalendar.calendar, this.endDate, this.startDate, this.maxDate));
|
545
|
+
|
546
|
+
this.container.find('.ranges li').removeClass('active');
|
547
|
+
var customRange = true;
|
548
|
+
var i = 0;
|
549
|
+
for (var range in this.ranges) {
|
550
|
+
if (this.startDate.equals(this.ranges[range][0]) && this.endDate.equals(this.ranges[range][1])) {
|
551
|
+
customRange = false;
|
552
|
+
this.container.find('.ranges li:eq(' + i + ')').addClass('active');
|
553
|
+
}
|
554
|
+
i++;
|
555
|
+
}
|
556
|
+
if (customRange)
|
557
|
+
this.container.find('.ranges li:last').addClass('active');
|
558
|
+
|
559
|
+
this.element.trigger('updated', this);
|
411
560
|
},
|
412
561
|
|
413
562
|
buildCalendar: function (month, year) {
|
@@ -447,11 +596,47 @@
|
|
447
596
|
return calendar;
|
448
597
|
|
449
598
|
},
|
599
|
+
|
600
|
+
renderDropdowns: function (selected, minDate, maxDate) {
|
601
|
+
var currentMonth = selected.getMonth();
|
602
|
+
var monthHtml = '<select class="monthselect">';
|
603
|
+
var inMinYear = false;
|
604
|
+
var inMaxYear = false;
|
605
|
+
|
606
|
+
for (var m = 0; m < 12; m++) {
|
607
|
+
if ((!inMinYear || m >= minDate.getMonth()) && (!inMaxYear || m <= maxDate.getMonth())) {
|
608
|
+
monthHtml += "<option value='" + m + "'" +
|
609
|
+
(m === currentMonth ? " selected='selected'" : "") +
|
610
|
+
">" + this.locale.monthNames[m] + "</option>";
|
611
|
+
}
|
612
|
+
}
|
613
|
+
monthHtml += "</select>";
|
614
|
+
|
615
|
+
var currentYear = selected.getFullYear();
|
616
|
+
var maxYear = (maxDate && maxDate.getFullYear()) || (currentYear + 5);
|
617
|
+
var minYear = (minDate && minDate.getFullYear()) || (currentYear - 50);
|
618
|
+
var yearHtml = '<select class="yearselect">'
|
619
|
+
|
620
|
+
for(var y = minYear; y <= maxYear; y++) {
|
621
|
+
yearHtml += '<option value="' + y + '"' +
|
622
|
+
(y === currentYear ? ' selected="selected"' : '') +
|
623
|
+
'>' + y + '</option>';
|
624
|
+
}
|
625
|
+
|
626
|
+
yearHtml += '</select>';
|
627
|
+
|
628
|
+
return monthHtml + yearHtml;
|
629
|
+
},
|
450
630
|
|
451
631
|
renderCalendar: function (calendar, selected, minDate, maxDate) {
|
452
632
|
var html = '<table class="table-condensed">';
|
453
633
|
html += '<thead>';
|
454
634
|
html += '<tr>';
|
635
|
+
|
636
|
+
// add empty cell for week number
|
637
|
+
if (this.showWeekNumbers)
|
638
|
+
html += '<th></th>';
|
639
|
+
|
455
640
|
if (!minDate || minDate < calendar[1][1])
|
456
641
|
{
|
457
642
|
html += '<th class="prev available"><i class="icon-arrow-left"></i></th>';
|
@@ -460,7 +645,14 @@
|
|
460
645
|
{
|
461
646
|
html += '<th></th>';
|
462
647
|
}
|
463
|
-
|
648
|
+
|
649
|
+
var dateHtml = this.locale.monthNames[calendar[1][1].getMonth()] + calendar[1][1].toString(" yyyy");
|
650
|
+
|
651
|
+
if(this.showDropdowns) {
|
652
|
+
dateHtml = this.renderDropdowns(calendar[1][1], minDate, maxDate);
|
653
|
+
}
|
654
|
+
|
655
|
+
html += '<th colspan="5" style="width: auto">' + dateHtml + '</th>';
|
464
656
|
if (!maxDate || maxDate > calendar[1][1])
|
465
657
|
{
|
466
658
|
html += '<th class="next available"><i class="icon-arrow-right"></i></th>';
|
@@ -472,6 +664,10 @@
|
|
472
664
|
|
473
665
|
html += '</tr>';
|
474
666
|
html += '<tr>';
|
667
|
+
|
668
|
+
// add week number label
|
669
|
+
if (this.showWeekNumbers)
|
670
|
+
html += '<th class="week">' + this.locale.weekLabel + '</th>';
|
475
671
|
|
476
672
|
$.each(this.locale.daysOfWeek, function (index, dayOfWeek) {
|
477
673
|
html += '<th>' + dayOfWeek + '</th>';
|
@@ -483,6 +679,11 @@
|
|
483
679
|
|
484
680
|
for (var row = 0; row < 6; row++) {
|
485
681
|
html += '<tr>';
|
682
|
+
|
683
|
+
// add week number
|
684
|
+
if (this.showWeekNumbers)
|
685
|
+
html += '<td class="week">' + calendar[row][0].getWeek() + '</td>';
|
686
|
+
|
486
687
|
for (var col = 0; col < 7; col++) {
|
487
688
|
var cname = 'available ';
|
488
689
|
cname += (calendar[row][col].getMonth() == calendar[1][1].getMonth()) ? '' : 'off';
|
@@ -492,15 +693,23 @@
|
|
492
693
|
|
493
694
|
if ( (minDate && calendar[row][col] < minDate) || (maxDate && calendar[row][col] > maxDate))
|
494
695
|
{
|
495
|
-
cname = 'off disabled';
|
696
|
+
cname = ' off disabled ';
|
496
697
|
}
|
497
698
|
else if (calendar[row][col].equals(selected))
|
498
699
|
{
|
499
|
-
cname += 'active';
|
700
|
+
cname += ' active ';
|
701
|
+
if (calendar[row][col].equals(this.startDate)) { cname += ' start-date '; }
|
702
|
+
if (calendar[row][col].equals(this.endDate)) { cname += ' end-date '; }
|
703
|
+
}
|
704
|
+
else if (calendar[row][col] >= this.startDate && calendar[row][col] <= this.endDate)
|
705
|
+
{
|
706
|
+
cname += ' in-range ';
|
707
|
+
if (calendar[row][col].equals(this.startDate)) { cname += ' start-date '; }
|
708
|
+
if (calendar[row][col].equals(this.endDate)) { cname += ' end-date '; }
|
500
709
|
}
|
501
710
|
|
502
711
|
var title = 'r' + row + 'c' + col;
|
503
|
-
html += '<td class="' + cname + '" title="' + title + '">' + calendar[row][col].getDate() + '</td>';
|
712
|
+
html += '<td class="' + cname.replace(/\s+/g,' ').replace(/^\s?(.*?)\s?$/,'$1') + '" title="' + title + '">' + calendar[row][col].getDate() + '</td>';
|
504
713
|
}
|
505
714
|
html += '</tr>';
|
506
715
|
}
|
@@ -17,13 +17,23 @@
|
|
17
17
|
text-align: left;
|
18
18
|
}
|
19
19
|
|
20
|
+
.daterangepicker .ranges .range_inputs>div {
|
21
|
+
float: left;
|
22
|
+
}
|
23
|
+
|
24
|
+
.daterangepicker .ranges .range_inputs>div:nth-child(2) {
|
25
|
+
padding-left: 11px;
|
26
|
+
}
|
27
|
+
|
20
28
|
.daterangepicker .calendar {
|
21
29
|
display: none;
|
22
30
|
max-width: 230px;
|
23
31
|
}
|
24
32
|
|
25
33
|
.daterangepicker .calendar th, .daterangepicker .calendar td {
|
26
|
-
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
34
|
+
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
35
|
+
white-space: nowrap;
|
36
|
+
text-align: center;
|
27
37
|
}
|
28
38
|
|
29
39
|
.daterangepicker .ranges label {
|
@@ -147,6 +157,7 @@
|
|
147
157
|
.daterangepicker td.off {
|
148
158
|
color: #999;
|
149
159
|
}
|
160
|
+
|
150
161
|
.daterangepicker td.disabled {
|
151
162
|
color: #999;
|
152
163
|
}
|
@@ -155,6 +166,13 @@
|
|
155
166
|
background: #eee;
|
156
167
|
}
|
157
168
|
|
169
|
+
.daterangepicker td.in-range {
|
170
|
+
background: #ebf4f8;
|
171
|
+
-webkit-border-radius: 0;
|
172
|
+
-moz-border-radius: 0;
|
173
|
+
border-radius: 0;
|
174
|
+
}
|
175
|
+
|
158
176
|
.daterangepicker td.active, .daterangepicker td.active:hover {
|
159
177
|
background-color: #006dcc;
|
160
178
|
background-image: -moz-linear-gradient(top, #0088cc, #0044cc);
|
@@ -171,3 +189,25 @@
|
|
171
189
|
color: #fff;
|
172
190
|
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
|
173
191
|
}
|
192
|
+
|
193
|
+
.daterangepicker td.week, .daterangepicker th.week {
|
194
|
+
font-size: 80%;
|
195
|
+
color: #ccc;
|
196
|
+
}
|
197
|
+
|
198
|
+
.daterangepicker select.monthselect, .daterangepicker select.yearselect {
|
199
|
+
font-size: 12px;
|
200
|
+
padding: 1px;
|
201
|
+
height: auto;
|
202
|
+
margin: 0;
|
203
|
+
cursor: default;
|
204
|
+
}
|
205
|
+
|
206
|
+
.daterangepicker select.monthselect {
|
207
|
+
margin-right: 2%;
|
208
|
+
width: 56%;
|
209
|
+
}
|
210
|
+
|
211
|
+
.daterangepicker select.yearselect {
|
212
|
+
width: 40%;
|
213
|
+
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bootstrap-daterangepicker-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2013-03-14 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: railties
|
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
80
|
version: '0'
|
81
81
|
requirements: []
|
82
82
|
rubyforge_project:
|
83
|
-
rubygems_version: 1.8.
|
83
|
+
rubygems_version: 1.8.24
|
84
84
|
signing_key:
|
85
85
|
specification_version: 3
|
86
86
|
summary: Rails 3.2.x plugin to allow for the easy use of Dan Grossman's Bootstrap
|