bootstrap-datepicker-rails 0.6.34 → 0.6.35

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  module BootstrapDatepickerRails
2
2
  module Rails
3
- VERSION = "0.6.34"
3
+ VERSION = "0.6.35"
4
4
  end
5
5
  end
@@ -38,7 +38,7 @@
38
38
  this.language = this.language in dates ? this.language : "en";
39
39
  this.isRTL = dates[this.language].rtl||false;
40
40
  this.format = DPGlobal.parseFormat(options.format||this.element.data('date-format')||'mm/dd/yyyy');
41
- this.isInline = false;
41
+ this.isInline = false;
42
42
  this.isInput = this.element.is('input');
43
43
  this.component = this.element.is('.date') ? this.element.find('.add-on') : false;
44
44
  this.hasInput = this.component && this.element.find('input').length;
@@ -55,18 +55,18 @@
55
55
  }
56
56
 
57
57
 
58
- this.picker = $(DPGlobal.template)
59
- .appendTo(this.isInline ? this.element : 'body')
60
- .on({
61
- click: $.proxy(this.click, this),
62
- mousedown: $.proxy(this.mousedown, this)
63
- });
58
+ this.picker = $(DPGlobal.template)
59
+ .appendTo(this.isInline ? this.element : 'body')
60
+ .on({
61
+ click: $.proxy(this.click, this),
62
+ mousedown: $.proxy(this.mousedown, this)
63
+ });
64
64
 
65
- if(this.isInline) {
66
- this.picker.addClass('datepicker-inline');
67
- } else {
68
- this.picker.addClass('datepicker-dropdown dropdown-menu');
69
- }
65
+ if(this.isInline) {
66
+ this.picker.addClass('datepicker-inline');
67
+ } else {
68
+ this.picker.addClass('datepicker-dropdown dropdown-menu');
69
+ }
70
70
  if (this.isRTL){
71
71
  this.picker.addClass('datepicker-rtl');
72
72
  this.picker.find('.prev i, .next i')
@@ -121,9 +121,9 @@
121
121
  this.update();
122
122
  this.showMode();
123
123
 
124
- if(this.isInline) {
125
- this.show();
126
- }
124
+ if(this.isInline) {
125
+ this.show();
126
+ }
127
127
  };
128
128
 
129
129
  Datepicker.prototype = {
@@ -154,9 +154,9 @@
154
154
  }]
155
155
  ];
156
156
  }
157
- else if (this.element.is('div')) { // inline datepicker
158
- this.isInline = true;
159
- }
157
+ else if (this.element.is('div')) { // inline datepicker
158
+ this.isInline = true;
159
+ }
160
160
  else {
161
161
  this._events = [
162
162
  [this.element, {
@@ -196,7 +196,7 @@
196
196
  },
197
197
 
198
198
  hide: function(e){
199
- if(this.isInline) return;
199
+ if(this.isInline) return;
200
200
  this.picker.hide();
201
201
  $(window).off('resize', this.place);
202
202
  this.viewMode = this.startViewMode;
@@ -247,18 +247,19 @@
247
247
  var formatted = this.getFormattedDate();
248
248
  if (!this.isInput) {
249
249
  if (this.component){
250
- this.element.find('input').prop('value', formatted);
250
+ this.element.find('input').val(formatted);
251
251
  }
252
252
  this.element.data('date', formatted);
253
253
  } else {
254
- this.element.prop('value', formatted);
254
+ this.element.val(formatted);
255
255
  }
256
256
  },
257
257
 
258
- getFormattedDate: function(format) {
259
- if(format == undefined) format = this.format;
260
- return DPGlobal.formatDate(this.date, format, this.language);
261
- },
258
+ getFormattedDate: function(format) {
259
+ if (format === undefined)
260
+ format = this.format;
261
+ return DPGlobal.formatDate(this.date, format, this.language);
262
+ },
262
263
 
263
264
  setStartDate: function(startDate){
264
265
  this.startDate = startDate||-Infinity;
@@ -291,31 +292,33 @@
291
292
  },
292
293
 
293
294
  place: function(){
294
- if(this.isInline) return;
295
+ if(this.isInline) return;
295
296
  var zIndex = parseInt(this.element.parents().filter(function() {
296
297
  return $(this).css('z-index') != 'auto';
297
298
  }).first().css('z-index'))+10;
298
299
  var offset = this.component ? this.component.offset() : this.element.offset();
300
+ var height = this.component ? this.component.outerHeight(true) : this.element.outerHeight(true);
299
301
  this.picker.css({
300
- top: offset.top + this.height,
302
+ top: offset.top + height,
301
303
  left: offset.left,
302
304
  zIndex: zIndex
303
305
  });
304
306
  },
305
307
 
306
308
  update: function(){
307
- var date, fromArgs = false;
308
- if(arguments && arguments.length && (typeof arguments[0] === 'string' || arguments[0] instanceof Date)) {
309
- date = arguments[0];
310
- fromArgs = true;
311
- } else {
312
- date = this.isInput ? this.element.prop('value') : this.element.data('date') || this.element.find('input').prop('value');
313
- }
309
+ var date, fromArgs = false;
310
+ if(arguments && arguments.length && (typeof arguments[0] === 'string' || arguments[0] instanceof Date)) {
311
+ date = arguments[0];
312
+ fromArgs = true;
313
+ } else {
314
+ date = this.isInput ? this.element.val() : this.element.data('date') || this.element.find('input').val();
315
+ }
314
316
 
315
317
  this.date = DPGlobal.parseDate(date, this.format, this.language);
316
318
 
317
- if(fromArgs) this.setValue();
319
+ if(fromArgs) this.setValue();
318
320
 
321
+ var oldViewDate = this.viewDate;
319
322
  if (this.date < this.startDate) {
320
323
  this.viewDate = new Date(this.startDate);
321
324
  } else if (this.date > this.endDate) {
@@ -323,6 +326,13 @@
323
326
  } else {
324
327
  this.viewDate = new Date(this.date);
325
328
  }
329
+
330
+ if (oldViewDate && oldViewDate.getTime() != this.viewDate.getTime()){
331
+ this.element.trigger({
332
+ type: 'changeDate',
333
+ date: this.viewDate
334
+ });
335
+ }
326
336
  this.fill();
327
337
  },
328
338
 
@@ -353,7 +363,7 @@
353
363
  startMonth = this.startDate !== -Infinity ? this.startDate.getUTCMonth() : -Infinity,
354
364
  endYear = this.endDate !== Infinity ? this.endDate.getUTCFullYear() : Infinity,
355
365
  endMonth = this.endDate !== Infinity ? this.endDate.getUTCMonth() : Infinity,
356
- currentDate = this.date.valueOf(),
366
+ currentDate = this.date && this.date.valueOf(),
357
367
  today = new Date();
358
368
  this.picker.find('.datepicker-days thead th:eq(1)')
359
369
  .text(dates[this.language].months[month]+' '+year);
@@ -388,7 +398,7 @@
388
398
  prevMonth.getUTCDate() == today.getDate()) {
389
399
  clsName += ' today';
390
400
  }
391
- if (prevMonth.valueOf() == currentDate) {
401
+ if (currentDate && prevMonth.valueOf() == currentDate) {
392
402
  clsName += ' active';
393
403
  }
394
404
  if (prevMonth.valueOf() < this.startDate || prevMonth.valueOf() > this.endDate ||
@@ -402,14 +412,14 @@
402
412
  prevMonth.setUTCDate(prevMonth.getUTCDate()+1);
403
413
  }
404
414
  this.picker.find('.datepicker-days tbody').empty().append(html.join(''));
405
- var currentYear = this.date.getUTCFullYear();
415
+ var currentYear = this.date && this.date.getUTCFullYear();
406
416
 
407
417
  var months = this.picker.find('.datepicker-months')
408
418
  .find('th:eq(1)')
409
419
  .text(year)
410
420
  .end()
411
421
  .find('span').removeClass('active');
412
- if (currentYear == year) {
422
+ if (currentYear && currentYear == year) {
413
423
  months.eq(this.date.getUTCMonth()).addClass('active');
414
424
  }
415
425
  if (year < startYear || year > endYear) {
@@ -720,16 +730,16 @@
720
730
  if (dir) {
721
731
  this.viewMode = Math.max(0, Math.min(2, this.viewMode + dir));
722
732
  }
723
- /*
724
- vitalets: fixing bug of very special conditions:
725
- jquery 1.7.1 + webkit + show inline datepicker in bootstrap popover.
726
- Method show() does not set display css correctly and datepicker is not shown.
727
- Changed to .css('display', 'block') solve the problem.
728
- See https://github.com/vitalets/x-editable/issues/37
733
+ /*
734
+ vitalets: fixing bug of very special conditions:
735
+ jquery 1.7.1 + webkit + show inline datepicker in bootstrap popover.
736
+ Method show() does not set display css correctly and datepicker is not shown.
737
+ Changed to .css('display', 'block') solve the problem.
738
+ See https://github.com/vitalets/x-editable/issues/37
729
739
 
730
- In jquery 1.7.2+ everything works fine.
731
- */
732
- //this.picker.find('>div').hide().filter('.datepicker-'+DPGlobal.modes[this.viewMode].clsName).show();
740
+ In jquery 1.7.2+ everything works fine.
741
+ */
742
+ //this.picker.find('>div').hide().filter('.datepicker-'+DPGlobal.modes[this.viewMode].clsName).show();
733
743
  this.picker.find('>div').hide().filter('.datepicker-'+DPGlobal.modes[this.viewMode].clsName).css('display', 'block');
734
744
  this.updateNavArrows();
735
745
  }
@@ -783,10 +793,10 @@
783
793
  navStep: 10
784
794
  }],
785
795
  isLeapYear: function (year) {
786
- return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0))
796
+ return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0));
787
797
  },
788
798
  getDaysInMonth: function (year, month) {
789
- return [31, (DPGlobal.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]
799
+ return [31, (DPGlobal.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
790
800
  },
791
801
  validParts: /dd?|DD?|mm?|MM?|yy(?:yy)?/g,
792
802
  nonpunctuation: /[^ -\/:-@\[\u3400-\u9fff-`{-~\t\n\r]+/g,
@@ -795,16 +805,16 @@
795
805
  // so it's a bad format delimiter, anyway
796
806
  var separators = format.replace(this.validParts, '\0').split('\0'),
797
807
  parts = format.match(this.validParts);
798
- if (!separators || !separators.length || !parts || parts.length == 0){
808
+ if (!separators || !separators.length || !parts || parts.length === 0){
799
809
  throw new Error("Invalid date format.");
800
810
  }
801
811
  return {separators: separators, parts: parts};
802
812
  },
803
813
  parseDate: function(date, format, language) {
804
814
  if (date instanceof Date) return date;
805
- if (/^[-+]\d+[dmwy]([\s,]+[-+]\d+[dmwy])*$/.test(date)) {
806
- var part_re = /([-+]\d+)([dmwy])/,
807
- parts = date.match(/([-+]\d+)([dmwy])/g),
815
+ if (/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(date)) {
816
+ var part_re = /([\-+]\d+)([dmwy])/,
817
+ parts = date.match(/([\-+]\d+)([dmwy])/g),
808
818
  part, dir;
809
819
  date = new Date();
810
820
  for (var i=0; i<parts.length; i++) {
@@ -886,7 +896,7 @@
886
896
  for (var i=0, s; i<setters_order.length; i++){
887
897
  s = setters_order[i];
888
898
  if (s in parsed && !isNaN(parsed[s]))
889
- setters_map[s](date, parsed[s])
899
+ setters_map[s](date, parsed[s]);
890
900
  }
891
901
  }
892
902
  return date;
@@ -908,7 +918,7 @@
908
918
  seps = $.extend([], format.separators);
909
919
  for (var i=0, cnt = format.parts.length; i < cnt; i++) {
910
920
  if (seps.length)
911
- date.push(seps.shift())
921
+ date.push(seps.shift());
912
922
  date.push(val[format.parts[i]]);
913
923
  }
914
924
  return date.join('');
@@ -947,6 +957,6 @@
947
957
  '</div>'+
948
958
  '</div>';
949
959
 
950
- $.fn.datepicker.DPGlobal = DPGlobal;
960
+ $.fn.datepicker.DPGlobal = DPGlobal;
951
961
 
952
962
  }( window.jQuery );
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Catalan translation for bootstrap-datepicker
3
+ * J. Garcia <jogaco.en@gmail.com>
4
+ */
5
+ ;(function($){
6
+ $.fn.datepicker.dates['ca'] = {
7
+ days: ["Diumenge", "Dilluns", "Dimarts", "Dimecres", "Dijous", "Divendres", "Dissabte", "Diumenge"],
8
+ daysShort: ["Diu", "Dil", "Dmt", "Dmc", "Dij", "Div", "Dis", "Diu"],
9
+ daysMin: ["dg", "dl", "dt", "dc", "dj", "dv", "ds", "dg"],
10
+ months: ["Gener", "Febrer", "Març", "Abril", "Maig", "Juny", "Juliol", "Agost", "Setembre", "Octubre", "Novembre", "Desembre"],
11
+ monthsShort: ["Gen", "Feb", "Mar", "Abr", "Mai", "Jun", "Jul", "Ago", "Set", "Oct", "Nov", "Des"],
12
+ today: "Avui"
13
+ };
14
+ }(jQuery));
@@ -1,12 +1,13 @@
1
1
  /**
2
2
  * Czech translation for bootstrap-datepicker
3
3
  * Matěj Koubík <matej@koubik.name>
4
+ * Fixes by Michal Remiš <michal.remis@gmail.com>
4
5
  */
5
6
  ;(function($){
6
7
  $.fn.datepicker.dates['cs'] = {
7
8
  days: ["Neděle", "Pondělí", "Úterý", "Středa", "Čtvrtek", "Pátek", "Sobota", "Neděle"],
8
- daysShort: ["Ne", "Po", "Út", "St", "Čt", "", "So", "Ne"],
9
- daysMin: ["N", "P", "Ú", "St", "Č", "P", "So", "N"],
9
+ daysShort: ["Ned", "Pon", "Úte", "Stř", "Čtv", "Pát", "Sob", "Ned"],
10
+ daysMin: ["Ne", "Po", "Út", "St", "Čt", "", "So", "Ne"],
10
11
  months: ["Leden", "Únor", "Březen", "Duben", "Květen", "Červen", "Červenec", "Srpen", "Září", "Říjen", "Listopad", "Prosinec"],
11
12
  monthsShort: ["Led", "Úno", "Bře", "Dub", "Kvě", "Čer", "Čnc", "Srp", "Zář", "Říj", "Lis", "Pro"],
12
13
  today: "Dnes"
@@ -9,6 +9,7 @@
9
9
  daysMin: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa", "So"],
10
10
  months: ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"],
11
11
  monthsShort: ["Jan", "Feb", "Mär", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"],
12
- today: "Heute"
12
+ today: "Heute",
13
+ weekStart: 1
13
14
  };
14
15
  }(jQuery));
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Greek translation for bootstrap-datepicker
3
+ */
4
+ ;(function($){
5
+ $.fn.datepicker.dates['el'] = {
6
+ days: ["Κυριακή", "Δευτέρα", "Τρίτη", "Τετάρτη", "Πέμπτη", "Παρασκευή", "Σάββατο", "Κυριακή"],
7
+ daysShort: ["Κυρ", "Δευ", "Τρι", "Τετ", "Πεμ", "Παρ", "Σαβ", "Κυρ"],
8
+ daysMin: ["Κυ", "Δε", "Τρ", "Τε", "Πε", "Πα", "Σα", "Κυ"],
9
+ months: ["Ιανουάριος", "Φεβρουάριος", "Μάρτιος", "Απρίλιος", "Μάιος", "Ιούνιος", "Ιούλιος", "Αύγουστος", "Σεπτέμβριος", "Οκτώβριος", "Νοέμβριος", "Δεκέμβριος"],
10
+ monthsShort: ["Ιαν", "Φεβ", "Μαρ", "Απρ", "Μάι", "Ιουν", "Ιουλ", "Αυγ", "Σεπ", "Οκτ", "Νοε", "Δεκ"],
11
+ today: "Σήμερα"
12
+ };
13
+ }(jQuery));
@@ -9,6 +9,7 @@
9
9
  daysMin: ["D", "L", "Ma", "Me", "J", "V", "S", "D"],
10
10
  months: ["Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"],
11
11
  monthsShort: ["Jan", "Fev", "Mar", "Avr", "Mai", "Jui", "Jul", "Aou", "Sep", "Oct", "Nov", "Dec"],
12
- today: "Aujourd'hui"
12
+ today: "Aujourd'hui",
13
+ weekStart: 1
13
14
  };
14
15
  }(jQuery));
@@ -1,12 +1,13 @@
1
1
  /**
2
2
  * Slovak translation for bootstrap-datepicker
3
3
  * Marek Lichtner <marek@licht.sk>
4
+ * Fixes by Michal Remiš <michal.remis@gmail.com>
4
5
  */
5
6
  ;(function($){
6
7
  $.fn.datepicker.dates["sk"] = {
7
8
  days: ["Nedeľa", "Pondelok", "Utorok", "Streda", "Štvrtok", "Piatok", "Sobota", "Nedeľa"],
8
- daysShort: ["Ne", "Po", "Ut", "St", "Št", "Pi", "So", "Ne"],
9
- daysMin: ["Ne", "Po", "Ut", "St", "Št", "Pi", "So", "Ne"],
9
+ daysShort: ["Ned", "Pon", "Uto", "Str", "Štv", "Pia", "Sob", "Ned"],
10
+ daysMin: ["Ne", "Po", "Ut", "St", "Št", "Pia", "So", "Ne"],
10
11
  months: ["Január", "Február", "Marec", "Apríl", "Máj", "Jún", "Júl", "August", "September", "Október", "November", "December"],
11
12
  monthsShort: ["Jan", "Feb", "Mar", "Apr", "Máj", "Jún", "Júl", "Aug", "Sep", "Okt", "Nov", "Dec"],
12
13
  today: "Dnes"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootstrap-datepicker-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.34
4
+ version: 0.6.35
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-27 00:00:00.000000000 Z
12
+ date: 2013-01-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
@@ -134,9 +134,11 @@ files:
134
134
  - vendor/assets/javascripts/bootstrap-datepicker/index.js
135
135
  - vendor/assets/javascripts/bootstrap-datepicker/locales/bootstrap-datepicker.bg.js
136
136
  - vendor/assets/javascripts/bootstrap-datepicker/locales/bootstrap-datepicker.br.js
137
+ - vendor/assets/javascripts/bootstrap-datepicker/locales/bootstrap-datepicker.ca.js
137
138
  - vendor/assets/javascripts/bootstrap-datepicker/locales/bootstrap-datepicker.cs.js
138
139
  - vendor/assets/javascripts/bootstrap-datepicker/locales/bootstrap-datepicker.da.js
139
140
  - vendor/assets/javascripts/bootstrap-datepicker/locales/bootstrap-datepicker.de.js
141
+ - vendor/assets/javascripts/bootstrap-datepicker/locales/bootstrap-datepicker.el.js
140
142
  - vendor/assets/javascripts/bootstrap-datepicker/locales/bootstrap-datepicker.es.js
141
143
  - vendor/assets/javascripts/bootstrap-datepicker/locales/bootstrap-datepicker.fi.js
142
144
  - vendor/assets/javascripts/bootstrap-datepicker/locales/bootstrap-datepicker.fr.js
@@ -183,7 +185,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
183
185
  version: '0'
184
186
  segments:
185
187
  - 0
186
- hash: 2868963677168346268
188
+ hash: 2691647704383687083
187
189
  required_rubygems_version: !ruby/object:Gem::Requirement
188
190
  none: false
189
191
  requirements:
@@ -192,7 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
192
194
  version: '0'
193
195
  segments:
194
196
  - 0
195
- hash: 2868963677168346268
197
+ hash: 2691647704383687083
196
198
  requirements: []
197
199
  rubyforge_project:
198
200
  rubygems_version: 1.8.24