bootstrap3-datetimepicker-rails 3.0.0.1 → 3.0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9c129cde925729055f449f84030304590372802e
4
+ data.tar.gz: 786d7fff3c0a5e645a9854aa2980a2b4767e3e1f
5
+ SHA512:
6
+ metadata.gz: 70107744c3fcb2234997a08901a7a1f634d87f9964f0df5eaadef2912e24879628434a19b723abf3c03b4c28c0b39b375f6b97f2df17b07cd93219318363ac58
7
+ data.tar.gz: f87543e9208b668761bdf9dca6c1df0b0d8b7fd357bca5517dc0702ca2d59200b26be37590c3ae5763babc76783573268a8180568a531e6bd449654d20516e6f
@@ -1,5 +1,5 @@
1
1
  module Bootstrap3Datetimepicker
2
2
  module Rails
3
- VERSION = '3.0.0.1'
3
+ VERSION = '3.0.0.2'
4
4
  end
5
5
  end
@@ -44,7 +44,7 @@ THE SOFTWARE.
44
44
 
45
45
  (function ($, moment) {
46
46
  if (typeof moment === 'undefined') {
47
- alert("momentjs is requried");
47
+ alert("momentjs is required");
48
48
  throw new Error('momentjs is required');
49
49
  };
50
50
 
@@ -54,34 +54,14 @@ THE SOFTWARE.
54
54
 
55
55
  // ReSharper disable once InconsistentNaming
56
56
  DateTimePicker = function (element, options) {
57
- var defaults = {
58
- pickDate: true,
59
- pickTime: true,
60
- useMinutes: true,
61
- useSeconds: false,
62
- useCurrent: true,
63
- minuteStepping: 1,
64
- minDate: new pMoment({ y: 1900 }),
65
- maxDate: new pMoment().add(100, "y"),
66
- showToday: true,
67
- collapse: true,
68
- language: "en",
69
- defaultDate: "",
70
- disabledDates: false,
71
- enabledDates: false,
72
- icons: {},
73
- useStrict: false,
74
- direction: "auto",
75
- sideBySide: false,
76
- daysOfWeekDisabled: false
77
- },
57
+ var defaults = $.fn.datetimepicker.defaults,
78
58
 
79
- icons = {
80
- time: 'glyphicon glyphicon-time',
81
- date: 'glyphicon glyphicon-calendar',
82
- up: 'glyphicon glyphicon-chevron-up',
83
- down: 'glyphicon glyphicon-chevron-down'
84
- },
59
+ icons = {
60
+ time: 'glyphicon glyphicon-time',
61
+ date: 'glyphicon glyphicon-calendar',
62
+ up: 'glyphicon glyphicon-chevron-up',
63
+ down: 'glyphicon glyphicon-chevron-down'
64
+ },
85
65
 
86
66
  picker = this,
87
67
 
@@ -201,10 +181,19 @@ THE SOFTWARE.
201
181
  },
202
182
 
203
183
  getPickerInput = function () {
184
+ var input;
185
+
204
186
  if (picker.isInput) {
205
187
  return picker.element;
206
188
  } else {
207
- return dateStr = picker.element.find('input');
189
+ input = picker.element.find('.datepickerinput');
190
+ if (input.size() === 0) {
191
+ input = picker.element.find('input');
192
+ }
193
+ else if (!input.is('input')) {
194
+ throw new Error('CSS class "datepickerinput" cannot be applied to non input element');
195
+ }
196
+ return input;
208
197
  }
209
198
  },
210
199
 
@@ -318,7 +307,7 @@ THE SOFTWARE.
318
307
  pMoment.lang(picker.options.language);
319
308
  var dateStr = newDate;
320
309
  if (!dateStr) {
321
- dateStr = getPickerInput().val()
310
+ dateStr = getPickerInput().val();
322
311
  if (dateStr) picker.date = pMoment(dateStr, picker.format, picker.options.useStrict);
323
312
  if (!picker.date) picker.date = pMoment();
324
313
  }
@@ -356,6 +345,7 @@ THE SOFTWARE.
356
345
  },
357
346
 
358
347
  fillDate = function () {
348
+ if(!picker.options.pickDate) return;
359
349
  pMoment.lang(picker.options.language);
360
350
  var year = picker.viewDate.year(),
361
351
  month = picker.viewDate.month(),
@@ -398,7 +388,7 @@ THE SOFTWARE.
398
388
  if (prevMonth.isSame(pMoment({ y: picker.date.year(), M: picker.date.month(), d: picker.date.date() }))) {
399
389
  clsName += ' active';
400
390
  }
401
- if (isInDisableDates(prevMonth) || !isInEnableDates(prevMonth)) {
391
+ if (isInDisableDates(prevMonth, 'day') || !isInEnableDates(prevMonth)) {
402
392
  clsName += ' disabled';
403
393
  }
404
394
  if (picker.options.showToday === true) {
@@ -712,6 +702,11 @@ THE SOFTWARE.
712
702
  e.preventDefault();
713
703
  },
714
704
 
705
+ keydown = function (e) {
706
+ if (e.keyCode === 27) // allow escape to hide picker
707
+ picker.hide();
708
+ },
709
+
715
710
  change = function (e) {
716
711
  pMoment.lang(picker.options.language);
717
712
  var input = $(e.target), oldDate = pMoment(picker.date), newDate = pMoment(input.val(), picker.format, picker.options.useStrict);
@@ -742,6 +737,7 @@ THE SOFTWARE.
742
737
  picker.widget.on('click', '.datepicker *', $.proxy(click, this)); // this handles date picker clicks
743
738
  picker.widget.on('click', '[data-action]', $.proxy(doAction, this)); // this handles time picker clicks
744
739
  picker.widget.on('mousedown', $.proxy(stopEvent, this));
740
+ picker.element.on('keydown', $.proxy(keydown, this));
745
741
  if (picker.options.pickDate && picker.options.pickTime) {
746
742
  picker.widget.on('click.togglePicker', '.accordion-toggle', function (e) {
747
743
  e.stopPropagation();
@@ -752,7 +748,7 @@ THE SOFTWARE.
752
748
 
753
749
  if (expanded && expanded.length) {
754
750
  collapseData = expanded.data('collapse');
755
- if (collapseData && collapseData.date - transitioning) return;
751
+ if (collapseData && collapseData.transitioning) return;
756
752
  expanded.collapse('hide');
757
753
  closed.collapse('show');
758
754
  $this.find('span').toggleClass(picker.options.icons.time + ' ' + picker.options.icons.date);
@@ -868,9 +864,17 @@ THE SOFTWARE.
868
864
  picker.unset = false;
869
865
  },
870
866
 
871
- isInDisableDates = function (date) {
867
+ isInDisableDates = function (date, timeUnit) {
872
868
  pMoment.lang(picker.options.language);
873
- if (date.isAfter(picker.options.maxDate) || date.isBefore(picker.options.minDate)) return true;
869
+ var maxDate = picker.options.maxDate;
870
+ var minDate = picker.options.minDate;
871
+
872
+ if(timeUnit) {
873
+ maxDate = pMoment(maxDate).endOf(timeUnit);
874
+ minDate = pMoment(minDate).startOf(timeUnit);
875
+ }
876
+
877
+ if (date.isAfter(maxDate) || date.isBefore(minDate)) return true;
874
878
  if (picker.options.disabledDates === false) {
875
879
  return false;
876
880
  }
@@ -1098,10 +1102,11 @@ THE SOFTWARE.
1098
1102
  var collapse = picker.widget.find('.collapse'), i, collapseData;
1099
1103
  for (i = 0; i < collapse.length; i++) {
1100
1104
  collapseData = collapse.eq(i).data('collapse');
1101
- if (collapseData && collapseData.date - transitioning)
1105
+ if (collapseData && collapseData.transitioning)
1102
1106
  return;
1103
1107
  }
1104
1108
  picker.widget.hide();
1109
+ picker.widget.removeClass("picker-open");
1105
1110
  picker.viewMode = picker.startViewMode;
1106
1111
  showMode();
1107
1112
  picker.element.trigger({
@@ -1119,7 +1124,7 @@ THE SOFTWARE.
1119
1124
  } else {
1120
1125
  picker.unset = false;
1121
1126
  }
1122
- if (!pMoment.isMoment(newDate)) newDate = pMoment(newDate, picker.format);
1127
+ if (!pMoment.isMoment(newDate)) newDate = (newDate instanceof Date) ? pMoment(newDate) : pMoment(newDate, picker.format);
1123
1128
  if (newDate.isValid()) {
1124
1129
  picker.date = newDate;
1125
1130
  set();
@@ -1177,4 +1182,27 @@ THE SOFTWARE.
1177
1182
  if (!data) $this.data('DateTimePicker', new DateTimePicker(this, options));
1178
1183
  });
1179
1184
  };
1185
+
1186
+ $.fn.datetimepicker.defaults = {
1187
+ pickDate: true,
1188
+ pickTime: true,
1189
+ useMinutes: true,
1190
+ useSeconds: false,
1191
+ useCurrent: true,
1192
+ minuteStepping: 1,
1193
+ minDate: new pMoment({ y: 1900 }),
1194
+ maxDate: new pMoment().add(100, "y"),
1195
+ showToday: true,
1196
+ collapse: true,
1197
+ language: "en",
1198
+ defaultDate: "",
1199
+ disabledDates: false,
1200
+ enabledDates: false,
1201
+ icons: {},
1202
+ useStrict: false,
1203
+ direction: "auto",
1204
+ sideBySide: false,
1205
+ daysOfWeekDisabled: false
1206
+ };
1207
+
1180
1208
  }));
metadata CHANGED
@@ -1,62 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootstrap3-datetimepicker-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.1
5
- prerelease:
4
+ version: 3.0.0.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Trevor Strieber
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-06-04 00:00:00.000000000 Z
11
+ date: 2014-07-07 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
19
  version: '1.3'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
26
  version: '1.3'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: momentjs-rails
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ~>
45
+ - - "~>"
52
46
  - !ruby/object:Gem::Version
53
47
  version: 2.5.0
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ~>
52
+ - - "~>"
60
53
  - !ruby/object:Gem::Version
61
54
  version: 2.5.0
62
55
  description: This gem packages the Bootstrap3 bootstrap-datetimepicker (JS & CSS)
@@ -67,99 +60,97 @@ executables: []
67
60
  extensions: []
68
61
  extra_rdoc_files: []
69
62
  files:
63
+ - LICENSE.txt
64
+ - README.md
70
65
  - lib/bootstrap3-datetimepicker-rails.rb
71
66
  - lib/bootstrap3-datetimepicker-rails/version.rb
72
- - vendor/assets/stylesheets/bootstrap-datetimepicker.min.css
73
- - vendor/assets/stylesheets/bootstrap-datetimepicker.css
74
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.ro.js
75
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.by.js
76
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.sv.js
77
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.sk.js
78
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.mr.js
79
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.et.js
80
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.eo.js
81
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.id.js
82
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.ms-my.js
83
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.lv.js
67
+ - vendor/assets/javascripts/bootstrap-datetimepicker.js
68
+ - vendor/assets/javascripts/bootstrap-datetimepicker.min.js
69
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.ar-ma.js
84
70
  - vendor/assets/javascripts/locales/bootstrap-datetimepicker.ar.js
85
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.vn.js
86
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.it.js
87
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.en-gb.js
88
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.hi.js
89
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.tzm.js
71
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.bg.js
72
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.br.js
73
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.bs.js
74
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.by.js
75
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.ca.js
76
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.cs.js
77
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.cv.js
78
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.da.js
79
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.de.js
80
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.el.js
81
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.en-au.js
90
82
  - vendor/assets/javascripts/locales/bootstrap-datetimepicker.en-ca.js
91
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.pt-BR.js
92
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.fi.js
93
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.pl.js
83
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.en-gb.js
84
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.eo.js
94
85
  - vendor/assets/javascripts/locales/bootstrap-datetimepicker.es.js
95
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.tzm-la.js
96
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.ar-ma.js
97
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.is.js
98
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.nn.js
99
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.de.js
86
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.et.js
87
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.eu.js
88
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.fa.js
89
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.fi.js
90
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.fr-ca.js
100
91
  - vendor/assets/javascripts/locales/bootstrap-datetimepicker.fr.js
92
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.gl.js
93
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.he.js
94
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.hi.js
101
95
  - vendor/assets/javascripts/locales/bootstrap-datetimepicker.hr.js
96
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.hu.js
97
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.id.js
98
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.is.js
99
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.it.js
100
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.ja.js
101
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.ka.js
102
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.ko.js
103
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.lt.js
104
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.lv.js
105
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.ml.js
106
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.mr.js
107
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.ms-my.js
108
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.nb.js
102
109
  - vendor/assets/javascripts/locales/bootstrap-datetimepicker.ne.js
110
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.nl.js
111
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.nn.js
112
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.pl.js
113
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.pt-BR.js
114
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.pt.js
115
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.ro.js
103
116
  - vendor/assets/javascripts/locales/bootstrap-datetimepicker.ru.js
104
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.bs.js
105
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.uk.js
106
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.tr.js
107
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.ka.js
108
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.sq.js
109
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.en-au.js
117
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.sk.js
110
118
  - vendor/assets/javascripts/locales/bootstrap-datetimepicker.sl.js
111
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.ml.js
119
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.sq.js
120
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.sv.js
112
121
  - vendor/assets/javascripts/locales/bootstrap-datetimepicker.th.js
122
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.tr.js
123
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.tzm-la.js
124
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.tzm.js
125
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.uk.js
113
126
  - vendor/assets/javascripts/locales/bootstrap-datetimepicker.uz.js
114
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.pt.js
115
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.el.js
116
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.br.js
117
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.fr-ca.js
118
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.bg.js
119
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.eu.js
127
+ - vendor/assets/javascripts/locales/bootstrap-datetimepicker.vn.js
120
128
  - vendor/assets/javascripts/locales/bootstrap-datetimepicker.zh-CN.js
121
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.ja.js
122
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.fa.js
123
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.he.js
124
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.nl.js
125
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.da.js
126
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.ko.js
127
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.cs.js
128
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.gl.js
129
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.nb.js
130
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.ca.js
131
129
  - vendor/assets/javascripts/locales/bootstrap-datetimepicker.zh-TW.js
132
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.hu.js
133
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.cv.js
134
- - vendor/assets/javascripts/locales/bootstrap-datetimepicker.lt.js
135
- - vendor/assets/javascripts/bootstrap-datetimepicker.min.js
136
- - vendor/assets/javascripts/bootstrap-datetimepicker.js
137
- - LICENSE.txt
138
- - README.md
130
+ - vendor/assets/stylesheets/bootstrap-datetimepicker.css
131
+ - vendor/assets/stylesheets/bootstrap-datetimepicker.min.css
139
132
  homepage: http://github.com/TrevorS/bootstrap3-datetimepicker-rails
140
133
  licenses:
141
134
  - MIT
135
+ metadata: {}
142
136
  post_install_message:
143
137
  rdoc_options: []
144
138
  require_paths:
145
139
  - lib
146
140
  required_ruby_version: !ruby/object:Gem::Requirement
147
- none: false
148
141
  requirements:
149
- - - ! '>='
142
+ - - ">="
150
143
  - !ruby/object:Gem::Version
151
144
  version: '0'
152
145
  required_rubygems_version: !ruby/object:Gem::Requirement
153
- none: false
154
146
  requirements:
155
- - - ! '>='
147
+ - - ">="
156
148
  - !ruby/object:Gem::Version
157
149
  version: '0'
158
150
  requirements: []
159
151
  rubyforge_project:
160
- rubygems_version: 1.8.23
152
+ rubygems_version: 2.2.2
161
153
  signing_key:
162
- specification_version: 3
154
+ specification_version: 4
163
155
  summary: Bootstrap3 bootstrap-datetimepicker's JS & CSS for Rails 3.1+ asset pipeline.
164
156
  test_files: []
165
- has_rdoc: