pickadate-rails 1.0.2 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b8263d2bf4b7a6916904ed084bd1027456ca3b7c
4
- data.tar.gz: 91f32767b809be5bcb1b32192d0f29fd2359e396
3
+ metadata.gz: 6681454a9e93fb467820519da50f338841327bac
4
+ data.tar.gz: 73c6cb5fd8abfe827df3b8c60e433c83cbeff827
5
5
  SHA512:
6
- metadata.gz: d4dd092bbc5664a33fac5d58d9fed682c8ecefb6f6a0bf2e4be13e45ead525bbe3f59ccab839e88cb8d85b4a1c0da6d5eac791a4b0cf3d196edc5c413082ebdf
7
- data.tar.gz: 95002448e6d96a4a5b7ca9610fd68ab1914a113bbb526ea322ab0f689d7fabc827036eaddbb45d7457fb61cd89351ad3f13224780a2e459f9207f3cbbeb821c0
6
+ metadata.gz: cba7769ba55dd3a9d6e31aaf464ebf17c549242e1ba1e9a868e47fc3ab7c45bbd598b5bc3a928676440d67eca09368318c3d83ec22e291bf8d0c7ea10b32ae40
7
+ data.tar.gz: 50d11b3ece87f142d66c3aecb20dff8dcdaa6ea41f4d54b9e62acaf52ed294101b89f59752badadc98d89d31846da4044ab19b9dfa4d37f00ff5f3103f826d85
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Pickadate-Rails [![Gem Version](https://badge.fury.io/rb/pickadate-rails.png)](http://badge.fury.io/rb/pickadate-rails)
2
2
 
3
- ## Pickadate Version: 3.0.5
3
+ ## Pickadate Version: 3.1.0
4
4
 
5
5
  Easily add [pickadate.js](https://github.com/amsul/pickadate.js) to your Rails 3.1+ application using the asset pipeline.
6
6
 
@@ -1,3 +1,3 @@
1
1
  module PickadateRails
2
- VERSION = "1.0.2"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -0,0 +1,140 @@
1
+
2
+ /*jshint
3
+ asi: true,
4
+ unused: true,
5
+ boss: true,
6
+ loopfunc: true,
7
+ eqnull: true
8
+ */
9
+
10
+
11
+ /*!
12
+ * Legacy browser support
13
+ */
14
+
15
+ // isArray support
16
+ if ( !Array.isArray ) {
17
+ Array.isArray = function( value ) {
18
+ return {}.toString.call( value ) == '[object Array]'
19
+ }
20
+ }
21
+
22
+
23
+ // Map array support
24
+ if ( ![].map ) {
25
+ Array.prototype.map = function ( callback, self ) {
26
+ var array = this, len = array.length, newArray = new Array( len )
27
+ for ( var i = 0; i < len; i++ ) {
28
+ if ( i in array ) {
29
+ newArray[ i ] = callback.call( self, array[ i ], i, array )
30
+ }
31
+ }
32
+ return newArray
33
+ }
34
+ }
35
+
36
+
37
+ // Filter array support
38
+ if ( ![].filter ) {
39
+ Array.prototype.filter = function( callback ) {
40
+ if ( this == null ) throw new TypeError()
41
+ var t = Object( this ), len = t.length >>> 0
42
+ if ( typeof callback != 'function' ) throw new TypeError()
43
+ var newArray = [], thisp = arguments[ 1 ]
44
+ for ( var i = 0; i < len; i++ ) {
45
+ if ( i in t ) {
46
+ var val = t[ i ]
47
+ if ( callback.call( thisp, val, i, t ) ) newArray.push( val )
48
+ }
49
+ }
50
+ return newArray
51
+ }
52
+ }
53
+
54
+
55
+ // Index of array support
56
+ if ( ![].indexOf ) {
57
+ Array.prototype.indexOf = function( searchElement ) {
58
+ if ( this == null ) throw new TypeError()
59
+ var t = Object( this ), len = t.length >>> 0
60
+ if ( len === 0 ) return -1
61
+ var n = 0
62
+ if ( arguments.length > 1 ) {
63
+ n = Number( arguments[ 1 ] )
64
+ if ( n != n ) {
65
+ n = 0
66
+ }
67
+ else if ( n !== 0 && n != Infinity && n != -Infinity ) {
68
+ n = ( n > 0 || -1 ) * Math.floor( Math.abs( n ) )
69
+ }
70
+ }
71
+ if ( n >= len ) return -1
72
+ var k = n >= 0 ? n : Math.max( len - Math.abs( n ), 0 )
73
+ for ( ; k < len; k++ ) {
74
+ if ( k in t && t[ k ] === searchElement ) return k
75
+ }
76
+ return -1
77
+ }
78
+ }
79
+
80
+
81
+ /*!
82
+ * Cross-Browser Split 1.1.1
83
+ * Copyright 2007-2012 Steven Levithan <stevenlevithan.com>
84
+ * Available under the MIT License
85
+ * http://blog.stevenlevithan.com/archives/cross-browser-split
86
+ */
87
+ var nativeSplit = String.prototype.split, compliantExecNpcg = /()??/.exec('')[1] === undefined
88
+ String.prototype.split = function(separator, limit) {
89
+ var str = this
90
+ if (Object.prototype.toString.call(separator) !== '[object RegExp]') {
91
+ return nativeSplit.call(str, separator, limit)
92
+ }
93
+ var output = [],
94
+ flags = (separator.ignoreCase ? 'i' : '') +
95
+ (separator.multiline ? 'm' : '') +
96
+ (separator.extended ? 'x' : '') +
97
+ (separator.sticky ? 'y' : ''),
98
+ lastLastIndex = 0,
99
+ separator2, match, lastIndex, lastLength
100
+ separator = new RegExp(separator.source, flags + 'g')
101
+ str += ''
102
+ if (!compliantExecNpcg) {
103
+ separator2 = new RegExp('^' + separator.source + '$(?!\\s)', flags)
104
+ }
105
+ limit = limit === undefined ? -1 >>> 0 : limit >>> 0
106
+ while (match = separator.exec(str)) {
107
+ lastIndex = match.index + match[0].length
108
+ if (lastIndex > lastLastIndex) {
109
+ output.push(str.slice(lastLastIndex, match.index))
110
+ if (!compliantExecNpcg && match.length > 1) {
111
+ match[0].replace(separator2, function () {
112
+ for (var i = 1; i < arguments.length - 2; i++) {
113
+ if (arguments[i] === undefined) {
114
+ match[i] = undefined
115
+ }
116
+ }
117
+ })
118
+ }
119
+ if (match.length > 1 && match.index < str.length) {
120
+ Array.prototype.push.apply(output, match.slice(1))
121
+ }
122
+ lastLength = match[0].length
123
+ lastLastIndex = lastIndex
124
+ if (output.length >= limit) {
125
+ break
126
+ }
127
+ }
128
+ if (separator.lastIndex === match.index) {
129
+ separator.lastIndex++
130
+ }
131
+ }
132
+ if (lastLastIndex === str.length) {
133
+ if (lastLength || !separator.test('')) {
134
+ output.push('')
135
+ }
136
+ } else {
137
+ output.push(str.slice(lastLastIndex))
138
+ }
139
+ return output.length > limit ? output.slice(0, limit) : output
140
+ }
@@ -1,6 +1,6 @@
1
1
 
2
2
  /*!
3
- * Date picker for pickadate.js v3.0.5
3
+ * Date picker for pickadate.js v3.1.0
4
4
  * http://amsul.github.io/pickadate.js/date.htm
5
5
  */
6
6
 
@@ -32,7 +32,10 @@ var DAYS_IN_WEEK = 7,
32
32
  function DatePicker( picker, settings ) {
33
33
 
34
34
  var calendar = this,
35
- elementDataValue = picker.$node.data( 'value' )
35
+ elementValue = picker.$node[ 0 ].value,
36
+ elementDataValue = picker.$node.data( 'value' ),
37
+ valueString = elementDataValue || elementValue,
38
+ formatString = elementDataValue ? settings.formatSubmit : settings.format
36
39
 
37
40
  calendar.settings = settings
38
41
 
@@ -64,12 +67,18 @@ function DatePicker( picker, settings ) {
64
67
  // Setting the `select` also sets the `highlight` and `view`.
65
68
  set( 'select',
66
69
 
67
- // If there's a `value` or `data-value`, use that with formatting.
68
- // Otherwise default to selecting “today”.
69
- elementDataValue || picker.$node[ 0 ].value || calendar.item.now,
70
-
71
- // Use the relevant format and data property.
72
- { format: elementDataValue ? settings.formatSubmit : settings.format, data: !!elementDataValue }
70
+ // Use the value provided or default to selecting “today”.
71
+ valueString || calendar.item.now,
72
+ {
73
+ // Use the appropriate format.
74
+ format: formatString,
75
+
76
+ // Set user-provided month data as true when there is a
77
+ // “mm” or “m” used in the relative format string.
78
+ data: (function( formatArray ) {
79
+ return valueString && ( formatArray.indexOf( 'mm' ) > -1 || formatArray.indexOf( 'm' ) > -1 )
80
+ })( calendar.formats.toArray( formatString ) )
81
+ }
73
82
  )
74
83
 
75
84
 
@@ -170,9 +179,11 @@ DatePicker.prototype.create = function( type, value, options ) {
170
179
  value = value.obj
171
180
  }
172
181
 
173
- // If it’s an array, convert it into a date.
182
+ // If it’s an array, convert it into a date and make sure
183
+ // that it’s a valid date – otherwise default to today.
174
184
  else if ( Array.isArray( value ) ) {
175
185
  value = new Date( value[ 0 ], value[ 1 ], value[ 2 ] )
186
+ value = Picker._.isDate( value ) ? value : calendar.create().obj
176
187
  }
177
188
 
178
189
  // If it’s a number or date object, make a normalized date.
@@ -221,9 +232,9 @@ DatePicker.prototype.navigate = function( type, value, options ) {
221
232
  month = targetDateObject.getMonth(),
222
233
  date = value.date
223
234
 
224
- // If the month we’re going to doesn’t have enough days,
225
- // keep decreasing the date until we reach the month’s last date.
226
- while ( new Date( year, month, date ).getMonth() !== month ) {
235
+ // Make sure the date is valid and if the month we’re going to doesn’t have enough
236
+ // days, keep decreasing the date until we reach the month’s last date.
237
+ while ( Picker._.isDate( targetDateObject ) && new Date( year, month, date ).getMonth() !== month ) {
227
238
  date -= 1
228
239
  }
229
240
 
@@ -447,7 +458,7 @@ DatePicker.prototype.parse = function( type, value, options ) {
447
458
  value = value.substr( formatLength )
448
459
  })
449
460
 
450
- // If it’s parsing a `data-value`, compensate for month 0index.
461
+ // If it’s parsing a user provided month value, compensate for month 0index.
451
462
  return [ parsingObject.yyyy || parsingObject.yy, +( parsingObject.mm || parsingObject.m ) - ( options.data ? 1 : 0 ), parsingObject.dd || parsingObject.d ]
452
463
  } //DatePicker.prototype.parse
453
464
 
@@ -1,6 +1,6 @@
1
1
 
2
2
  /*!
3
- * pickadate.js v3.0.5, 2013/06/14
3
+ * pickadate.js v3.1.0, 2013/06/22
4
4
  * By Amsul, http://amsul.ca
5
5
  * Hosted on http://amsul.github.io/pickadate.js
6
6
  * Licensed under MIT
@@ -721,7 +721,7 @@ PickerConstructor._ = {
721
721
  * Tell if something is a date object.
722
722
  */
723
723
  isDate: function( value ) {
724
- return {}.toString.call( value ).indexOf( 'Date' ) > -1
724
+ return {}.toString.call( value ).indexOf( 'Date' ) > -1 && this.isInteger( value.getDate() )
725
725
  },
726
726
 
727
727
 
@@ -1,6 +1,6 @@
1
1
 
2
2
  /*!
3
- * Time picker for pickadate.js v3.0.5
3
+ * Time picker for pickadate.js v3.1.0
4
4
  * http://amsul.github.io/pickadate.js/time.htm
5
5
  */
6
6
 
@@ -0,0 +1,19 @@
1
+ ### The following convention is used for naming the translation files:
2
+
3
+ ```
4
+ LANGUAGE_COUNTRY.js
5
+ ```
6
+
7
+ #### Where:
8
+
9
+ ```
10
+ LANGUAGE = The lowercase ISO 639-1 language code.
11
+ ```
12
+
13
+ > See http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
14
+
15
+ ```
16
+ COUNTRY = The uppercase ISO 3166-1 country code.
17
+ ```
18
+
19
+ > See http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pickadate-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Fraser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-17 00:00:00.000000000 Z
11
+ date: 2013-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -67,9 +67,11 @@ files:
67
67
  - lib/pickadate-rails.rb
68
68
  - lib/pickadate-rails/version.rb
69
69
  - pickadate-rails.gemspec
70
+ - vendor/assets/javascripts/pickadate/legacy.js
70
71
  - vendor/assets/javascripts/pickadate/picker.date.js
71
72
  - vendor/assets/javascripts/pickadate/picker.js
72
73
  - vendor/assets/javascripts/pickadate/picker.time.js
74
+ - vendor/assets/javascripts/pickadate/translations/NAMING.md
73
75
  - vendor/assets/javascripts/pickadate/translations/bg_BG.js
74
76
  - vendor/assets/javascripts/pickadate/translations/bs_BA.js
75
77
  - vendor/assets/javascripts/pickadate/translations/ca_ES.js