bootstrap-datepicker-rails 1.1.1.1 → 1.1.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e01a157d4a970048109c8bb48e603a74b9ade1ef
4
- data.tar.gz: 5ba977ade0ac771fc26d5b3c302043fa9addbdc5
3
+ metadata.gz: b67a9a4c167106a71d123da7fdb4d9af7a6981ab
4
+ data.tar.gz: 0aef8cc2bb241b679be539b9c7fd901b984ec837
5
5
  SHA512:
6
- metadata.gz: 684874023e8fa3cbfe45c84d740d3bd3a93bcd719664172cdb31c86a7a902c01763934d28509695d6cc6c290c27231e5fc73a918802d33970aafb2003149afba
7
- data.tar.gz: 2d8f616cf4934b1640d881cff70bbe7618dba549ccf48c904abf8d1f159286af9a63fd85fc2bd610abca333313f11464815e7d9dbddc5439e0ee3c4978eca944
6
+ metadata.gz: ac1397143b71e79d2b9a1417fa4b601cab910fa7f8a88bd064826f6d950ee28befc9180394db4cc2d9579bc330c0d3d811a1df6b825e8be943b2a9a34ab1bf52
7
+ data.tar.gz: 334ea55637203e1f56b5f3467e0a35b23d3b647eb3a3809d8f36eb55c4774a882e5a6d3cc152372dd9e82c5d281a2194cd545074ce6f475095174d607c094843
data/Rakefile CHANGED
@@ -15,7 +15,7 @@ task :update do
15
15
  system("git status")
16
16
 
17
17
  puts "\n"
18
- puts "bootstrap-datepicker version: #{JSON.parse(File.read('./bootstrap-datepicker-src/component.json'))['version']}"
18
+ puts "bootstrap-datepicker version: #{JSON.parse(File.read('./bootstrap-datepicker-src/bower.json'))['version']}"
19
19
  puts "bootstrap-datepicker-rails version: #{BootstrapDatepickerRails::Rails::VERSION}"
20
20
  end
21
21
 
@@ -31,4 +31,7 @@ task :publish => :build do
31
31
  system("git tag #{BootstrapDatepickerRails::Rails::VERSION}") unless tags =~ /#{BootstrapDatepickerRails::Rails::VERSION}/
32
32
  system("gem push bootstrap-datepicker-rails-#{BootstrapDatepickerRails::Rails::VERSION}.gem")
33
33
  system("git push --tags")
34
+ end
35
+
36
+ task :release => :publish do
34
37
  end
@@ -1,5 +1,5 @@
1
1
  module BootstrapDatepickerRails
2
2
  module Rails
3
- VERSION = "1.1.1.1"
3
+ VERSION = "1.1.1.2"
4
4
  end
5
5
  end
@@ -20,6 +20,8 @@
20
20
 
21
21
  (function( $ ) {
22
22
 
23
+ var $window = $(window);
24
+
23
25
  function UTCDate(){
24
26
  return new Date(Date.UTC.apply(Date, arguments));
25
27
  }
@@ -28,6 +30,7 @@
28
30
  return UTCDate(today.getUTCFullYear(), today.getUTCMonth(), today.getUTCDate());
29
31
  }
30
32
 
33
+
31
34
  // Picker object
32
35
 
33
36
  var Datepicker = function(element, options) {
@@ -137,12 +140,20 @@
137
140
  o.weekStart %= 7;
138
141
  o.weekEnd = ((o.weekStart + 6) % 7);
139
142
 
140
- var format = DPGlobal.parseFormat(o.format)
143
+ var format = DPGlobal.parseFormat(o.format);
141
144
  if (o.startDate !== -Infinity) {
142
- o.startDate = DPGlobal.parseDate(o.startDate, format, o.language);
145
+ if (!!o.startDate) {
146
+ o.startDate = DPGlobal.parseDate(o.startDate, format, o.language);
147
+ } else {
148
+ o.startDate = -Infinity;
149
+ }
143
150
  }
144
151
  if (o.endDate !== Infinity) {
145
- o.endDate = DPGlobal.parseDate(o.endDate, format, o.language);
152
+ if (!!o.endDate) {
153
+ o.endDate = DPGlobal.parseDate(o.endDate, format, o.language);
154
+ } else {
155
+ o.endDate = Infinity;
156
+ }
146
157
  }
147
158
 
148
159
  o.daysOfWeekDisabled = o.daysOfWeekDisabled||[];
@@ -151,6 +162,38 @@
151
162
  o.daysOfWeekDisabled = $.map(o.daysOfWeekDisabled, function (d) {
152
163
  return parseInt(d, 10);
153
164
  });
165
+
166
+ var plc = String(o.orientation).toLowerCase().split(/\s+/g),
167
+ _plc = o.orientation.toLowerCase();
168
+ plc = $.grep(plc, function(word){
169
+ return (/^auto|left|right|top|bottom$/).test(word);
170
+ });
171
+ o.orientation = {x: 'auto', y: 'auto'};
172
+ if (!_plc || _plc === 'auto')
173
+ ; // no action
174
+ else if (plc.length === 1){
175
+ switch(plc[0]){
176
+ case 'top':
177
+ case 'bottom':
178
+ o.orientation.y = plc[0];
179
+ break;
180
+ case 'left':
181
+ case 'right':
182
+ o.orientation.x = plc[0];
183
+ break;
184
+ }
185
+ }
186
+ else {
187
+ _plc = $.grep(plc, function(word){
188
+ return (/^left|right$/).test(word);
189
+ });
190
+ o.orientation.x = _plc[0] || 'auto';
191
+
192
+ _plc = $.grep(plc, function(word){
193
+ return (/^top|bottom$/).test(word);
194
+ });
195
+ o.orientation.y = _plc[0] || 'auto';
196
+ }
154
197
  },
155
198
  _events: [],
156
199
  _secondaryEvents: [],
@@ -350,14 +393,63 @@
350
393
 
351
394
  place: function(){
352
395
  if(this.isInline) return;
396
+ var calendarWidth = this.picker.outerWidth(),
397
+ calendarHeight = this.picker.outerHeight(),
398
+ visualPadding = 10,
399
+ windowWidth = $window.width(),
400
+ windowHeight = $window.height();
401
+
353
402
  var zIndex = parseInt(this.element.parents().filter(function() {
354
403
  return $(this).css('z-index') != 'auto';
355
404
  }).first().css('z-index'))+10;
356
405
  var offset = this.component ? this.component.parent().offset() : this.element.offset();
357
406
  var height = this.component ? this.component.outerHeight(true) : this.element.outerHeight(true);
407
+ var width = this.component ? this.component.outerWidth(true) : this.element.outerWidth(true);
408
+ var left = offset.left,
409
+ top = offset.top;
410
+
411
+ this.picker.removeClass(
412
+ 'datepicker-orient-top datepicker-orient-bottom '+
413
+ 'datepicker-orient-right datepicker-orient-left'
414
+ );
415
+
416
+ if (this.o.orientation.x !== 'auto') {
417
+ this.picker.addClass('datepicker-orient-' + this.o.orientation.x);
418
+ if (this.o.orientation.x === 'right')
419
+ left -= calendarWidth - width;
420
+ }
421
+ // auto x orientation is best-placement: if it crosses a window
422
+ // edge, fudge it sideways
423
+ else {
424
+ // Default to left
425
+ this.picker.addClass('datepicker-orient-left');
426
+ if (offset.left < 0)
427
+ left -= offset.left - visualPadding;
428
+ else if (offset.left + calendarWidth > windowWidth)
429
+ left = windowWidth - calendarWidth - visualPadding;
430
+ }
431
+
432
+ // auto y orientation is best-situation: top or bottom, no fudging,
433
+ // decision based on which shows more of the calendar
434
+ var yorient = this.o.orientation.y,
435
+ top_overflow, bottom_overflow;
436
+ if (yorient === 'auto') {
437
+ top_overflow = 0 + offset.top - calendarHeight;
438
+ bottom_overflow = windowHeight - (offset.top + height + calendarHeight);
439
+ if (Math.max(top_overflow, bottom_overflow) === bottom_overflow)
440
+ yorient = 'top';
441
+ else
442
+ yorient = 'bottom';
443
+ }
444
+ this.picker.addClass('datepicker-orient-' + yorient);
445
+ if (yorient === 'top')
446
+ top += height;
447
+ else
448
+ top -= calendarHeight + parseInt(this.picker.css('padding'));
449
+
358
450
  this.picker.css({
359
- top: offset.top + height,
360
- left: offset.left,
451
+ top: top,
452
+ left: left,
361
453
  zIndex: zIndex
362
454
  });
363
455
  },
@@ -616,10 +708,13 @@
616
708
  switch(this.viewMode){
617
709
  case 0:
618
710
  this.viewDate = this.moveMonth(this.viewDate, dir);
711
+ this._trigger('changeMonth', this.viewDate);
619
712
  break;
620
713
  case 1:
621
714
  case 2:
622
715
  this.viewDate = this.moveYear(this.viewDate, dir);
716
+ if (this.viewMode === 1)
717
+ this._trigger('changeYear', this.viewDate);
623
718
  break;
624
719
  }
625
720
  this.fill();
@@ -716,9 +811,9 @@
716
811
  }
717
812
  if (element) {
718
813
  element.change();
719
- if (this.o.autoclose && (!which || which == 'date')) {
720
- this.hide();
721
- }
814
+ }
815
+ if (this.o.autoclose && (!which || which == 'date')) {
816
+ this.hide();
722
817
  }
723
818
  },
724
819
 
@@ -791,9 +886,11 @@
791
886
  if (e.ctrlKey){
792
887
  newDate = this.moveYear(this.date, dir);
793
888
  newViewDate = this.moveYear(this.viewDate, dir);
889
+ this._trigger('changeYear', this.viewDate);
794
890
  } else if (e.shiftKey){
795
891
  newDate = this.moveMonth(this.date, dir);
796
892
  newViewDate = this.moveMonth(this.viewDate, dir);
893
+ this._trigger('changeMonth', this.viewDate);
797
894
  } else {
798
895
  newDate = new Date(this.date);
799
896
  newDate.setUTCDate(this.date.getUTCDate() + dir);
@@ -816,9 +913,11 @@
816
913
  if (e.ctrlKey){
817
914
  newDate = this.moveYear(this.date, dir);
818
915
  newViewDate = this.moveYear(this.viewDate, dir);
916
+ this._trigger('changeYear', this.viewDate);
819
917
  } else if (e.shiftKey){
820
918
  newDate = this.moveMonth(this.date, dir);
821
919
  newViewDate = this.moveMonth(this.viewDate, dir);
920
+ this._trigger('changeMonth', this.viewDate);
822
921
  } else {
823
922
  newDate = new Date(this.date);
824
923
  newDate.setUTCDate(this.date.getUTCDate() + dir * 7);
@@ -1008,6 +1107,7 @@
1008
1107
  keyboardNavigation: true,
1009
1108
  language: 'en',
1010
1109
  minViewMode: 0,
1110
+ orientation: "auto",
1011
1111
  rtl: false,
1012
1112
  startDate: -Infinity,
1013
1113
  startView: 0,
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Georgian translation for bootstrap-datepicker
3
+ * Levan Melikishvili <levani0101@yahoo.com>
4
+ */
5
+ ;(function($){
6
+ $.fn.datepicker.dates['ka'] = {
7
+ days: ["კვირა", "ორშაბათი", "სამშაბათი", "ოთხშაბათი", "ხუთშაბათი", "პარასკევი", "შაბათი", "კვირა"],
8
+ daysShort: ["კვი", "ორშ", "სამ", "ოთხ", "ხუთ", "პარ", "შაბ", "კვი"],
9
+ daysMin: ["კვ", "ორ", "სა", "ოთ", "ხუ", "პა", "შა", "კვ"],
10
+ months: ["იანვარი", "თებერვალი", "მარტი", "აპრილი", "მაისი", "ივნისი", "ივლისი", "აგვისტო", "სექტემბერი", "ოქტომები", "ნოემბერი", "დეკემბერი"],
11
+ monthsShort: ["იან", "თებ", "მარ", "აპრ", "მაი", "ივნ", "ივლ", "აგვ", "სექ", "ოქტ", "ნოე", "დეკ"],
12
+ today: "დღეს",
13
+ clear: "გასუფთავება"
14
+ };
15
+ }(jQuery));
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Norwegian translation for bootstrap-datepicker
3
+ **/
4
+ ;(function($){
5
+ $.fn.datepicker.dates['no'] = {
6
+ days: ['Søndag','Mandag','Tirsdag','Onsdag','Torsdag','Fredag','Lørdag'],
7
+ daysShort: ['Søn','Man','Tir','Ons','Tor','Fre','Lør'],
8
+ daysMin: ['Sø','Ma','Ti','On','To','Fr','Lø'],
9
+ months: ['Januar','Februar','Mars','April','Mai','Juni','Juli','August','September','Oktober','November','Desember'],
10
+ monthsShort: ['Jan','Feb','Mar','Apr','Mai','Jun','Jul','Aug','Sep','Okt','Nov','Des'],
11
+ today: 'I dag',
12
+ clear: 'Nullstill',
13
+ weekStart: 0
14
+ };
15
+ }(jQuery));
@@ -37,10 +37,9 @@
37
37
  border-left: 7px solid transparent;
38
38
  border-right: 7px solid transparent;
39
39
  border-bottom: 7px solid #ccc;
40
+ border-top: 0;
40
41
  border-bottom-color: rgba(0, 0, 0, 0.2);
41
42
  position: absolute;
42
- top: -7px;
43
- left: 6px;
44
43
  }
45
44
  .datepicker-dropdown:after {
46
45
  content: '';
@@ -48,10 +47,37 @@
48
47
  border-left: 6px solid transparent;
49
48
  border-right: 6px solid transparent;
50
49
  border-bottom: 6px solid #ffffff;
50
+ border-top: 0;
51
51
  position: absolute;
52
- top: -6px;
52
+ }
53
+ .datepicker-dropdown.datepicker-orient-left:before {
54
+ left: 6px;
55
+ }
56
+ .datepicker-dropdown.datepicker-orient-left:after {
53
57
  left: 7px;
54
58
  }
59
+ .datepicker-dropdown.datepicker-orient-right:before {
60
+ right: 6px;
61
+ }
62
+ .datepicker-dropdown.datepicker-orient-right:after {
63
+ right: 7px;
64
+ }
65
+ .datepicker-dropdown.datepicker-orient-top:before {
66
+ top: -7px;
67
+ }
68
+ .datepicker-dropdown.datepicker-orient-top:after {
69
+ top: -6px;
70
+ }
71
+ .datepicker-dropdown.datepicker-orient-bottom:before {
72
+ bottom: -7px;
73
+ border-bottom: 0;
74
+ border-top: 7px solid #999;
75
+ }
76
+ .datepicker-dropdown.datepicker-orient-bottom:after {
77
+ bottom: -6px;
78
+ border-bottom: 0;
79
+ border-top: 6px solid #ffffff;
80
+ }
55
81
  .datepicker > div {
56
82
  display: none;
57
83
  }
@@ -66,6 +92,12 @@
66
92
  }
67
93
  .datepicker table {
68
94
  margin: 0;
95
+ -webkit-touch-callout: none;
96
+ -webkit-user-select: none;
97
+ -khtml-user-select: none;
98
+ -moz-user-select: none;
99
+ -ms-user-select: none;
100
+ user-select: none;
69
101
  }
70
102
  .datepicker td,
71
103
  .datepicker th {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootstrap-datepicker-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1.1
4
+ version: 1.1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gonzalo Rodríguez-Baltanás Díaz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-20 00:00:00.000000000 Z
11
+ date: 2013-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -173,6 +173,7 @@ files:
173
173
  - vendor/assets/javascripts/bootstrap-datepicker/locales/bootstrap-datepicker.is.js
174
174
  - vendor/assets/javascripts/bootstrap-datepicker/locales/bootstrap-datepicker.it.js
175
175
  - vendor/assets/javascripts/bootstrap-datepicker/locales/bootstrap-datepicker.ja.js
176
+ - vendor/assets/javascripts/bootstrap-datepicker/locales/bootstrap-datepicker.ka.js
176
177
  - vendor/assets/javascripts/bootstrap-datepicker/locales/bootstrap-datepicker.kr.js
177
178
  - vendor/assets/javascripts/bootstrap-datepicker/locales/bootstrap-datepicker.lt.js
178
179
  - vendor/assets/javascripts/bootstrap-datepicker/locales/bootstrap-datepicker.lv.js
@@ -180,6 +181,7 @@ files:
180
181
  - vendor/assets/javascripts/bootstrap-datepicker/locales/bootstrap-datepicker.ms.js
181
182
  - vendor/assets/javascripts/bootstrap-datepicker/locales/bootstrap-datepicker.nb.js
182
183
  - vendor/assets/javascripts/bootstrap-datepicker/locales/bootstrap-datepicker.nl.js
184
+ - vendor/assets/javascripts/bootstrap-datepicker/locales/bootstrap-datepicker.no.js
183
185
  - vendor/assets/javascripts/bootstrap-datepicker/locales/bootstrap-datepicker.pl.js
184
186
  - vendor/assets/javascripts/bootstrap-datepicker/locales/bootstrap-datepicker.pt-BR.js
185
187
  - vendor/assets/javascripts/bootstrap-datepicker/locales/bootstrap-datepicker.pt.js