pickadate-rails 1.4.0 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/pickadate-rails/version.rb +1 -1
- data/vendor/assets/javascripts/pickadate/picker.date.js +110 -67
- data/vendor/assets/javascripts/pickadate/picker.js +121 -26
- data/vendor/assets/javascripts/pickadate/picker.time.js +16 -11
- data/vendor/assets/javascripts/pickadate/translations/hu_HU.js +6 -6
- data/vendor/assets/javascripts/pickadate/translations/ne_NP.js +13 -0
- data/vendor/assets/stylesheets/pickadate/classic.css +6 -6
- data/vendor/assets/stylesheets/pickadate/classic.date.css +2 -4
- data/vendor/assets/stylesheets/pickadate/default.date.css +2 -4
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6606da54f9baaaa812e41c549b788ecf64c26cd5
|
4
|
+
data.tar.gz: 80293e9775fe12311d370e50b8239c6a3bbb607e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12bb87a7dbf92495f1bdee7c6a4219f55d4c48a9133321f67c7fbee01b9f16d9439372076ea5cec094ae2a7499b0d49fd5ddd69743e084a038b5f9464781398f
|
7
|
+
data.tar.gz: ad2ee99730e0e8c8ce9fd493e6612e888d1344c4185c4a81f2da92056d48c60c5963aa30a08f425aec9cdeb0936af39523476c54db038c56d1275cbfdd2b4da7
|
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.
|
3
|
+
## Pickadate Version: 3.5.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,6 +1,6 @@
|
|
1
1
|
|
2
2
|
/*!
|
3
|
-
* Date picker for pickadate.js v3.
|
3
|
+
* Date picker for pickadate.js v3.5.0
|
4
4
|
* http://amsul.github.io/pickadate.js/date.htm
|
5
5
|
*/
|
6
6
|
|
@@ -57,6 +57,7 @@ function DatePicker( picker, settings ) {
|
|
57
57
|
// The component's item object.
|
58
58
|
calendar.item = {}
|
59
59
|
|
60
|
+
calendar.item.clear = null
|
60
61
|
calendar.item.disable = ( settings.disable || [] ).slice( 0 )
|
61
62
|
calendar.item.enable = -(function( collectionDisabled ) {
|
62
63
|
return collectionDisabled[ 0 ] === true ? collectionDisabled.shift() : -1
|
@@ -70,10 +71,7 @@ function DatePicker( picker, settings ) {
|
|
70
71
|
// When there’s a value, set the `select`, which in turn
|
71
72
|
// also sets the `highlight` and `view`.
|
72
73
|
if ( valueString ) {
|
73
|
-
calendar.set( 'select', valueString, {
|
74
|
-
format: formatString,
|
75
|
-
fromValue: !!elementValue
|
76
|
-
})
|
74
|
+
calendar.set( 'select', valueString, { format: formatString })
|
77
75
|
}
|
78
76
|
|
79
77
|
// If there’s no value, default to highlighting “today”.
|
@@ -141,6 +139,7 @@ DatePicker.prototype.set = function( type, value, options ) {
|
|
141
139
|
|
142
140
|
// If the value is `null` just set it immediately.
|
143
141
|
if ( value === null ) {
|
142
|
+
if ( type == 'clear' ) type = 'select'
|
144
143
|
calendarItem[ type ] = value
|
145
144
|
return calendar
|
146
145
|
}
|
@@ -290,7 +289,7 @@ DatePicker.prototype.overlapRanges = function( one, two ) {
|
|
290
289
|
one = calendar.createRange( one.from, one.to )
|
291
290
|
two = calendar.createRange( two.from, two.to )
|
292
291
|
|
293
|
-
return calendar.withinRange( one, two.from ) ||
|
292
|
+
return calendar.withinRange( one, two.from ) || calendar.withinRange( one, two.to ) ||
|
294
293
|
calendar.withinRange( two, one.from ) || calendar.withinRange( two, one.to )
|
295
294
|
}
|
296
295
|
|
@@ -490,12 +489,20 @@ DatePicker.prototype.validate = function( type, dateObject, options ) {
|
|
490
489
|
if ( dateObject.pick <= minLimitObject.pick ) {
|
491
490
|
reachedMin = true
|
492
491
|
interval = 1
|
493
|
-
dateObject = calendar.create([
|
492
|
+
dateObject = calendar.create([
|
493
|
+
minLimitObject.year,
|
494
|
+
minLimitObject.month,
|
495
|
+
minLimitObject.date + (dateObject.pick === minLimitObject.pick ? 0 : -1)
|
496
|
+
])
|
494
497
|
}
|
495
498
|
else if ( dateObject.pick >= maxLimitObject.pick ) {
|
496
499
|
reachedMax = true
|
497
500
|
interval = -1
|
498
|
-
dateObject = calendar.create([
|
501
|
+
dateObject = calendar.create([
|
502
|
+
maxLimitObject.year,
|
503
|
+
maxLimitObject.month,
|
504
|
+
maxLimitObject.date + (dateObject.pick === maxLimitObject.pick ? 0 : 1)
|
505
|
+
])
|
499
506
|
}
|
500
507
|
|
501
508
|
|
@@ -565,10 +572,10 @@ DatePicker.prototype.disabled = function( dateToVerify ) {
|
|
565
572
|
DatePicker.prototype.parse = function( type, value, options ) {
|
566
573
|
|
567
574
|
var calendar = this,
|
568
|
-
parsingObject = {}
|
569
|
-
monthIndex
|
575
|
+
parsingObject = {}
|
570
576
|
|
571
|
-
|
577
|
+
// If it’s already parsed, we’re good.
|
578
|
+
if ( !value || typeof value != 'string' ) {
|
572
579
|
return value
|
573
580
|
}
|
574
581
|
|
@@ -578,9 +585,6 @@ DatePicker.prototype.parse = function( type, value, options ) {
|
|
578
585
|
options.format = calendar.settings.format
|
579
586
|
}
|
580
587
|
|
581
|
-
// Calculate the month index to adjust with.
|
582
|
-
monthIndex = typeof value == 'string' && !options.fromValue ? 1 : 0
|
583
|
-
|
584
588
|
// Convert the format into an array and then map through it.
|
585
589
|
calendar.formats.toArray( options.format ).map( function( label ) {
|
586
590
|
|
@@ -602,10 +606,10 @@ DatePicker.prototype.parse = function( type, value, options ) {
|
|
602
606
|
value = value.substr( formatLength )
|
603
607
|
})
|
604
608
|
|
605
|
-
//
|
609
|
+
// Compensate for month 0index.
|
606
610
|
return [
|
607
611
|
parsingObject.yyyy || parsingObject.yy,
|
608
|
-
+( parsingObject.mm || parsingObject.m ) -
|
612
|
+
+( parsingObject.mm || parsingObject.m ) - 1,
|
609
613
|
parsingObject.dd || parsingObject.d
|
610
614
|
]
|
611
615
|
} //DatePicker.prototype.parse
|
@@ -624,7 +628,7 @@ DatePicker.prototype.formats = (function() {
|
|
624
628
|
|
625
629
|
// If there's no month index, add it to the date object
|
626
630
|
if ( !dateObject.mm && !dateObject.m ) {
|
627
|
-
dateObject.m = collection.indexOf( word )
|
631
|
+
dateObject.m = collection.indexOf( word ) + 1
|
628
632
|
}
|
629
633
|
|
630
634
|
// Return the length of the word.
|
@@ -955,11 +959,12 @@ DatePicker.prototype.nodes = function( isOpen ) {
|
|
955
959
|
|
956
960
|
// Create the calendar table head using a copy of weekday labels collection.
|
957
961
|
// * We do a copy so we don't mutate the original array.
|
958
|
-
tableHead = (function( collection ) {
|
962
|
+
tableHead = (function( collection, fullCollection ) {
|
959
963
|
|
960
964
|
// If the first day should be Monday, move Sunday to the end.
|
961
965
|
if ( settings.firstDay ) {
|
962
966
|
collection.push( collection.shift() )
|
967
|
+
fullCollection.push( fullCollection.shift() )
|
963
968
|
}
|
964
969
|
|
965
970
|
// Create and return the table head group.
|
@@ -975,13 +980,14 @@ DatePicker.prototype.nodes = function( isOpen ) {
|
|
975
980
|
item: function( counter ) {
|
976
981
|
return [
|
977
982
|
collection[ counter ],
|
978
|
-
settings.klass.weekdays
|
983
|
+
settings.klass.weekdays,
|
984
|
+
'scope=col title="' + fullCollection[ counter ] + '"'
|
979
985
|
]
|
980
986
|
}
|
981
987
|
})
|
982
988
|
)
|
983
989
|
) //endreturn
|
984
|
-
})( ( settings.showWeekdaysFull ? settings.weekdaysFull : settings.weekdaysShort ).slice( 0 ) ), //tableHead
|
990
|
+
})( ( settings.showWeekdaysFull ? settings.weekdaysFull : settings.weekdaysShort ).slice( 0 ), settings.weekdaysFull.slice( 0 ) ), //tableHead
|
985
991
|
|
986
992
|
|
987
993
|
// Create the nav for next/prev month.
|
@@ -998,42 +1004,55 @@ DatePicker.prototype.nodes = function( isOpen ) {
|
|
998
1004
|
( !next && viewsetObject.year <= minLimitObject.year && viewsetObject.month <= minLimitObject.month ) ?
|
999
1005
|
' ' + settings.klass.navDisabled : ''
|
1000
1006
|
),
|
1001
|
-
'data-nav=' + ( next || -1 )
|
1007
|
+
'data-nav=' + ( next || -1 ) + ' ' +
|
1008
|
+
_.ariaAttr({
|
1009
|
+
role: 'button',
|
1010
|
+
controls: calendar.$node[0].id + '_table'
|
1011
|
+
}) + ' ' +
|
1012
|
+
'title="' + (next ? settings.labelMonthNext : settings.labelMonthPrev ) + '"'
|
1002
1013
|
) //endreturn
|
1003
1014
|
}, //createMonthNav
|
1004
1015
|
|
1005
1016
|
|
1006
1017
|
// Create the month label.
|
1007
|
-
createMonthLabel = function(
|
1018
|
+
createMonthLabel = function() {
|
1019
|
+
|
1020
|
+
var monthsCollection = settings.showMonthsShort ? settings.monthsShort : settings.monthsFull
|
1008
1021
|
|
1009
1022
|
// If there are months to select, add a dropdown menu.
|
1010
1023
|
if ( settings.selectMonths ) {
|
1011
1024
|
|
1012
|
-
return _.node( 'select',
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1025
|
+
return _.node( 'select',
|
1026
|
+
_.group({
|
1027
|
+
min: 0,
|
1028
|
+
max: 11,
|
1029
|
+
i: 1,
|
1030
|
+
node: 'option',
|
1031
|
+
item: function( loopedMonth ) {
|
1018
1032
|
|
1019
|
-
|
1033
|
+
return [
|
1020
1034
|
|
1021
|
-
|
1022
|
-
|
1035
|
+
// The looped month and no classes.
|
1036
|
+
monthsCollection[ loopedMonth ], 0,
|
1023
1037
|
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1027
|
-
(
|
1038
|
+
// Set the value and selected index.
|
1039
|
+
'value=' + loopedMonth +
|
1040
|
+
( viewsetObject.month == loopedMonth ? ' selected' : '' ) +
|
1028
1041
|
(
|
1029
|
-
(
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1042
|
+
(
|
1043
|
+
( viewsetObject.year == minLimitObject.year && loopedMonth < minLimitObject.month ) ||
|
1044
|
+
( viewsetObject.year == maxLimitObject.year && loopedMonth > maxLimitObject.month )
|
1045
|
+
) ?
|
1046
|
+
' disabled' : ''
|
1047
|
+
)
|
1048
|
+
]
|
1049
|
+
}
|
1050
|
+
}),
|
1051
|
+
settings.klass.selectMonth,
|
1052
|
+
( isOpen ? '' : 'disabled' ) + ' ' +
|
1053
|
+
_.ariaAttr({ controls: calendar.$node[0].id + '_table' }) + ' ' +
|
1054
|
+
'title="' + settings.labelMonthSelect + '"'
|
1055
|
+
)
|
1037
1056
|
}
|
1038
1057
|
|
1039
1058
|
// If there's a need for a month selector
|
@@ -1078,22 +1097,27 @@ DatePicker.prototype.nodes = function( isOpen ) {
|
|
1078
1097
|
highestYear = maxYear
|
1079
1098
|
}
|
1080
1099
|
|
1081
|
-
return _.node( 'select',
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
1100
|
+
return _.node( 'select',
|
1101
|
+
_.group({
|
1102
|
+
min: lowestYear,
|
1103
|
+
max: highestYear,
|
1104
|
+
i: 1,
|
1105
|
+
node: 'option',
|
1106
|
+
item: function( loopedYear ) {
|
1107
|
+
return [
|
1088
1108
|
|
1089
|
-
|
1090
|
-
|
1109
|
+
// The looped year and no classes.
|
1110
|
+
loopedYear, 0,
|
1091
1111
|
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
1112
|
+
// Set the value and selected index.
|
1113
|
+
'value=' + loopedYear + ( focusedYear == loopedYear ? ' selected' : '' )
|
1114
|
+
]
|
1115
|
+
}
|
1116
|
+
}),
|
1117
|
+
settings.klass.selectYear,
|
1118
|
+
( isOpen ? '' : 'disabled' ) + ' ' + _.ariaAttr({ controls: calendar.$node[0].id + '_table' }) + ' ' +
|
1119
|
+
'title="' + settings.labelYearSelect + '"'
|
1120
|
+
)
|
1097
1121
|
}
|
1098
1122
|
|
1099
1123
|
// Otherwise just return the year focused
|
@@ -1104,9 +1128,8 @@ DatePicker.prototype.nodes = function( isOpen ) {
|
|
1104
1128
|
// Create and return the entire calendar.
|
1105
1129
|
return _.node(
|
1106
1130
|
'div',
|
1107
|
-
|
1108
|
-
|
1109
|
-
createYearLabel(),
|
1131
|
+
( settings.selectYears ? createYearLabel() + createMonthLabel() : createMonthLabel() + createYearLabel() ) +
|
1132
|
+
createMonthNav() + createMonthNav( 1 ),
|
1110
1133
|
settings.klass.header
|
1111
1134
|
) + _.node(
|
1112
1135
|
'table',
|
@@ -1172,9 +1195,8 @@ DatePicker.prototype.nodes = function( isOpen ) {
|
|
1172
1195
|
return klasses.join( ' ' )
|
1173
1196
|
})([ settings.klass.day ]),
|
1174
1197
|
'data-pick=' + targetDate.pick + ' ' + _.ariaAttr({
|
1175
|
-
role: '
|
1176
|
-
|
1177
|
-
checked: isSelected && calendar.$node.val() === _.trigger(
|
1198
|
+
role: 'gridcell',
|
1199
|
+
selected: isSelected && calendar.$node.val() === _.trigger(
|
1178
1200
|
calendar.formats.toString,
|
1179
1201
|
calendar,
|
1180
1202
|
[ settings.format, targetDate ]
|
@@ -1182,7 +1204,9 @@ DatePicker.prototype.nodes = function( isOpen ) {
|
|
1182
1204
|
activedescendant: isHighlighted ? true : null,
|
1183
1205
|
disabled: isDisabled ? true : null
|
1184
1206
|
})
|
1185
|
-
)
|
1207
|
+
),
|
1208
|
+
'',
|
1209
|
+
_.ariaAttr({ role: 'presentation' })
|
1186
1210
|
] //endreturn
|
1187
1211
|
}
|
1188
1212
|
})
|
@@ -1190,14 +1214,25 @@ DatePicker.prototype.nodes = function( isOpen ) {
|
|
1190
1214
|
}
|
1191
1215
|
})
|
1192
1216
|
),
|
1193
|
-
settings.klass.table
|
1217
|
+
settings.klass.table,
|
1218
|
+
'id="' + calendar.$node[0].id + '_table' + '" ' + _.ariaAttr({
|
1219
|
+
role: 'grid',
|
1220
|
+
controls: calendar.$node[0].id,
|
1221
|
+
readonly: true
|
1222
|
+
})
|
1194
1223
|
) +
|
1195
1224
|
|
1196
1225
|
// * For Firefox forms to submit, make sure to set the buttons’ `type` attributes as “button”.
|
1197
1226
|
_.node(
|
1198
1227
|
'div',
|
1199
|
-
_.node( 'button', settings.today, settings.klass.buttonToday,
|
1200
|
-
|
1228
|
+
_.node( 'button', settings.today, settings.klass.buttonToday,
|
1229
|
+
'type=button data-pick=' + nowObject.pick +
|
1230
|
+
( isOpen ? '' : ' disabled' ) + ' ' +
|
1231
|
+
_.ariaAttr({ controls: calendar.$node[0].id }) ) +
|
1232
|
+
_.node( 'button', settings.clear, settings.klass.buttonClear,
|
1233
|
+
'type=button data-clear=1' +
|
1234
|
+
( isOpen ? '' : ' disabled' ) + ' ' +
|
1235
|
+
_.ariaAttr({ controls: calendar.$node[0].id }) ),
|
1201
1236
|
settings.klass.footer
|
1202
1237
|
) //endreturn
|
1203
1238
|
} //DatePicker.prototype.nodes
|
@@ -1212,6 +1247,14 @@ DatePicker.defaults = (function( prefix ) {
|
|
1212
1247
|
|
1213
1248
|
return {
|
1214
1249
|
|
1250
|
+
// The title label to use for the month nav buttons
|
1251
|
+
labelMonthNext: 'Next month',
|
1252
|
+
labelMonthPrev: 'Previous month',
|
1253
|
+
|
1254
|
+
// The title label to use for the dropdown selectors
|
1255
|
+
labelMonthSelect: 'Select a month',
|
1256
|
+
labelYearSelect: 'Select a year',
|
1257
|
+
|
1215
1258
|
// Months and weekdays
|
1216
1259
|
monthsFull: [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ],
|
1217
1260
|
monthsShort: [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ],
|
@@ -1,6 +1,5 @@
|
|
1
|
-
|
2
1
|
/*!
|
3
|
-
* pickadate.js v3.
|
2
|
+
* pickadate.js v3.5.0, 2014/04/13
|
4
3
|
* By Amsul, http://amsul.ca
|
5
4
|
* Hosted on http://amsul.github.io/pickadate.js
|
6
5
|
* Licensed under MIT
|
@@ -30,6 +29,9 @@ function PickerConstructor( ELEMENT, NAME, COMPONENT, OPTIONS ) {
|
|
30
29
|
|
31
30
|
|
32
31
|
var
|
32
|
+
IS_DEFAULT_THEME = false,
|
33
|
+
|
34
|
+
|
33
35
|
// The state of the picker.
|
34
36
|
STATE = {
|
35
37
|
id: ELEMENT.id || 'P' + Math.abs( ~~(Math.random() * new Date()) )
|
@@ -128,6 +130,10 @@ function PickerConstructor( ELEMENT, NAME, COMPONENT, OPTIONS ) {
|
|
128
130
|
})
|
129
131
|
|
130
132
|
|
133
|
+
// Once we’re all set, check the theme in use.
|
134
|
+
IS_DEFAULT_THEME = isUsingDefaultTheme( P.$root.children()[ 0 ] )
|
135
|
+
|
136
|
+
|
131
137
|
// If the element has autofocus, open the picker.
|
132
138
|
if ( ELEMENT.autofocus ) {
|
133
139
|
P.open()
|
@@ -206,9 +212,16 @@ function PickerConstructor( ELEMENT, NAME, COMPONENT, OPTIONS ) {
|
|
206
212
|
$ELEMENT.addClass( CLASSES.active )
|
207
213
|
aria( ELEMENT, 'expanded', true )
|
208
214
|
|
209
|
-
//
|
210
|
-
|
211
|
-
|
215
|
+
// * A Firefox bug, when `html` has `overflow:hidden`, results in
|
216
|
+
// killing transitions :(. So add the “opened” state on the next tick.
|
217
|
+
// Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=625289
|
218
|
+
setTimeout( function() {
|
219
|
+
|
220
|
+
// Add the “opened” class to the picker root.
|
221
|
+
P.$root.addClass( CLASSES.opened )
|
222
|
+
aria( P.$root[0], 'hidden', false )
|
223
|
+
|
224
|
+
}, 0 )
|
212
225
|
|
213
226
|
// If we have to give focus, bind the element and doc events.
|
214
227
|
if ( dontGiveFocus !== false ) {
|
@@ -216,6 +229,13 @@ function PickerConstructor( ELEMENT, NAME, COMPONENT, OPTIONS ) {
|
|
216
229
|
// Set it as open.
|
217
230
|
STATE.open = true
|
218
231
|
|
232
|
+
// Prevent the page from scrolling.
|
233
|
+
if ( IS_DEFAULT_THEME ) {
|
234
|
+
$( 'html' ).
|
235
|
+
css( 'overflow', 'hidden' ).
|
236
|
+
css( 'padding-right', '+=' + getScrollbarWidth() )
|
237
|
+
}
|
238
|
+
|
219
239
|
// Pass focus to the element’s jQuery object.
|
220
240
|
$ELEMENT.trigger( 'focus' )
|
221
241
|
|
@@ -309,10 +329,16 @@ function PickerConstructor( ELEMENT, NAME, COMPONENT, OPTIONS ) {
|
|
309
329
|
$ELEMENT.removeClass( CLASSES.active )
|
310
330
|
aria( ELEMENT, 'expanded', false )
|
311
331
|
|
312
|
-
//
|
313
|
-
|
314
|
-
|
315
|
-
|
332
|
+
// * A Firefox bug, when `html` has `overflow:hidden`, results in
|
333
|
+
// killing transitions :(. So remove the “opened” state on the next tick.
|
334
|
+
// Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=625289
|
335
|
+
setTimeout( function() {
|
336
|
+
|
337
|
+
// Remove the “opened” and “focused” class from the picker root.
|
338
|
+
P.$root.removeClass( CLASSES.opened + ' ' + CLASSES.focused )
|
339
|
+
aria( P.$root[0], 'hidden', true )
|
340
|
+
|
341
|
+
}, 0 )
|
316
342
|
|
317
343
|
// If it’s already closed, do nothing more.
|
318
344
|
if ( !STATE.open ) return P
|
@@ -320,6 +346,13 @@ function PickerConstructor( ELEMENT, NAME, COMPONENT, OPTIONS ) {
|
|
320
346
|
// Set it as closed.
|
321
347
|
STATE.open = false
|
322
348
|
|
349
|
+
// Allow the page to scroll.
|
350
|
+
if ( IS_DEFAULT_THEME ) {
|
351
|
+
$( 'html' ).
|
352
|
+
css( 'overflow', '' ).
|
353
|
+
css( 'padding-right', '-=' + getScrollbarWidth() )
|
354
|
+
}
|
355
|
+
|
323
356
|
// Unbind the document events.
|
324
357
|
$document.off( '.' + STATE.id )
|
325
358
|
|
@@ -346,7 +379,7 @@ function PickerConstructor( ELEMENT, NAME, COMPONENT, OPTIONS ) {
|
|
346
379
|
thingObject = thingIsObject ? thing : {}
|
347
380
|
|
348
381
|
// Make sure we have usable options.
|
349
|
-
options = thingIsObject && $.isPlainObject( value ) ?
|
382
|
+
options = thingIsObject && $.isPlainObject( value ) ? value : options || {}
|
350
383
|
|
351
384
|
if ( thing ) {
|
352
385
|
|
@@ -363,14 +396,15 @@ function PickerConstructor( ELEMENT, NAME, COMPONENT, OPTIONS ) {
|
|
363
396
|
|
364
397
|
// First, if the item exists and there’s a value, set it.
|
365
398
|
if ( thingItem in P.component.item ) {
|
399
|
+
if ( thingValue === undefined ) thingValue = null
|
366
400
|
P.component.set( thingItem, thingValue, options )
|
367
401
|
}
|
368
402
|
|
369
403
|
// Then, check to update the element value and broadcast a change.
|
370
404
|
if ( thingItem == 'select' || thingItem == 'clear' ) {
|
371
|
-
$ELEMENT.
|
372
|
-
'' : P.get( thingItem, SETTINGS.format )
|
373
|
-
|
405
|
+
$ELEMENT.
|
406
|
+
val( thingItem == 'clear' ? '' : P.get( thingItem, SETTINGS.format ) ).
|
407
|
+
trigger( 'change' )
|
374
408
|
}
|
375
409
|
}
|
376
410
|
|
@@ -600,7 +634,6 @@ function PickerConstructor( ELEMENT, NAME, COMPONENT, OPTIONS ) {
|
|
600
634
|
// to the doc and remove the “focused” state from the root.
|
601
635
|
focusin: function( event ) {
|
602
636
|
P.$root.removeClass( CLASSES.focused )
|
603
|
-
aria( P.$root[0], 'selected', false )
|
604
637
|
event.stopPropagation()
|
605
638
|
},
|
606
639
|
|
@@ -673,10 +706,21 @@ function PickerConstructor( ELEMENT, NAME, COMPONENT, OPTIONS ) {
|
|
673
706
|
*/
|
674
707
|
function prepareElementHidden() {
|
675
708
|
|
676
|
-
var id
|
677
|
-
|
678
|
-
|
679
|
-
|
709
|
+
var id,
|
710
|
+
name
|
711
|
+
|
712
|
+
if ( SETTINGS.hiddenName === true ) {
|
713
|
+
id = ELEMENT.name + '_hidden'
|
714
|
+
name = ELEMENT.name
|
715
|
+
ELEMENT.name = ''
|
716
|
+
}
|
717
|
+
else {
|
718
|
+
name = [
|
719
|
+
typeof SETTINGS.hiddenPrefix == 'string' ? SETTINGS.hiddenPrefix : '',
|
720
|
+
typeof SETTINGS.hiddenSuffix == 'string' ? SETTINGS.hiddenSuffix : '_submit'
|
721
|
+
]
|
722
|
+
name = id = name[0] + ELEMENT.name + name[1]
|
723
|
+
}
|
680
724
|
|
681
725
|
P._hidden = $(
|
682
726
|
'<input ' +
|
@@ -684,8 +728,8 @@ function PickerConstructor( ELEMENT, NAME, COMPONENT, OPTIONS ) {
|
|
684
728
|
|
685
729
|
// Create the name and ID by using the original
|
686
730
|
// input’s with a prefix and suffix.
|
687
|
-
'name="' +
|
688
|
-
'id="' + id
|
731
|
+
'name="' + name + '"' +
|
732
|
+
'id="' + id + '"' +
|
689
733
|
|
690
734
|
// If the element has a value, set the hidden value as well.
|
691
735
|
(
|
@@ -719,7 +763,6 @@ function PickerConstructor( ELEMENT, NAME, COMPONENT, OPTIONS ) {
|
|
719
763
|
// If it’s a focus event, add the “focused” class to the root.
|
720
764
|
if ( event.type == 'focus' ) {
|
721
765
|
P.$root.addClass( CLASSES.focused )
|
722
|
-
aria( P.$root[0], 'selected', true )
|
723
766
|
}
|
724
767
|
|
725
768
|
// And then finally open the picker.
|
@@ -758,6 +801,59 @@ PickerConstructor.klasses = function( prefix ) {
|
|
758
801
|
|
759
802
|
|
760
803
|
|
804
|
+
/**
|
805
|
+
* Check if the default theme is being used.
|
806
|
+
*/
|
807
|
+
function isUsingDefaultTheme( element ) {
|
808
|
+
|
809
|
+
var theme,
|
810
|
+
prop = 'position'
|
811
|
+
|
812
|
+
// For IE.
|
813
|
+
if ( element.currentStyle ) {
|
814
|
+
theme = element.currentStyle[prop]
|
815
|
+
}
|
816
|
+
|
817
|
+
// For normal browsers.
|
818
|
+
else if ( window.getComputedStyle ) {
|
819
|
+
theme = getComputedStyle( element )[prop]
|
820
|
+
}
|
821
|
+
|
822
|
+
return theme == 'fixed'
|
823
|
+
}
|
824
|
+
|
825
|
+
|
826
|
+
|
827
|
+
/**
|
828
|
+
* Get the width of the browser’s scrollbar.
|
829
|
+
* Taken from: https://github.com/VodkaBears/Remodal/blob/master/src/jquery.remodal.js
|
830
|
+
*/
|
831
|
+
function getScrollbarWidth() {
|
832
|
+
|
833
|
+
var $outer = $( '<div style="visibility:hidden;width:100px" />' ).
|
834
|
+
appendTo( 'body' )
|
835
|
+
|
836
|
+
// Get the width without scrollbars.
|
837
|
+
var widthWithoutScroll = $outer[0].offsetWidth
|
838
|
+
|
839
|
+
// Force adding scrollbars.
|
840
|
+
$outer.css( 'overflow', 'scroll' )
|
841
|
+
|
842
|
+
// Add the inner div.
|
843
|
+
var $inner = $( '<div style="width:100%" />' ).appendTo( $outer )
|
844
|
+
|
845
|
+
// Get the width with scrollbars.
|
846
|
+
var widthWithScroll = $inner[0].offsetWidth
|
847
|
+
|
848
|
+
// Remove the divs.
|
849
|
+
$outer.remove()
|
850
|
+
|
851
|
+
// Return the difference between the widths.
|
852
|
+
return widthWithoutScroll - widthWithScroll
|
853
|
+
}
|
854
|
+
|
855
|
+
|
856
|
+
|
761
857
|
/**
|
762
858
|
* PickerConstructor helper methods.
|
763
859
|
*/
|
@@ -896,8 +992,7 @@ PickerConstructor.extend = function( name, Component ) {
|
|
896
992
|
|
897
993
|
// If the component data exists and `options` is a string, carry out the action.
|
898
994
|
if ( componentData && typeof options == 'string' ) {
|
899
|
-
PickerConstructor._.trigger( componentData[ options ], componentData, [ action ] )
|
900
|
-
return this
|
995
|
+
return PickerConstructor._.trigger( componentData[ options ], componentData, [ action ] )
|
901
996
|
}
|
902
997
|
|
903
998
|
// Otherwise go through each matched element and if the component
|
@@ -929,17 +1024,17 @@ function aria(element, attribute, value) {
|
|
929
1024
|
}
|
930
1025
|
function ariaSet(element, attribute, value) {
|
931
1026
|
element.setAttribute(
|
932
|
-
(attribute == 'role' ? '' : 'aria-') +
|
1027
|
+
(attribute == 'role' ? '' : 'aria-') + attribute,
|
933
1028
|
value
|
934
1029
|
)
|
935
1030
|
}
|
936
1031
|
function ariaAttr(attribute, data) {
|
937
1032
|
if ( !$.isPlainObject(attribute) ) {
|
938
|
-
attribute = {
|
1033
|
+
attribute = { attribute: data }
|
939
1034
|
}
|
940
1035
|
data = ''
|
941
1036
|
for ( var key in attribute ) {
|
942
|
-
var attr = (key == 'role' ? '' : 'aria-') +
|
1037
|
+
var attr = (key == 'role' ? '' : 'aria-') + key,
|
943
1038
|
attrVal = attribute[key]
|
944
1039
|
data += attrVal == null ? '' : attr + '="' + attribute[key] + '"'
|
945
1040
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
|
2
2
|
/*!
|
3
|
-
* Time picker for pickadate.js v3.
|
3
|
+
* Time picker for pickadate.js v3.5.0
|
4
4
|
* http://amsul.github.io/pickadate.js/time.htm
|
5
5
|
*/
|
6
6
|
|
@@ -57,6 +57,7 @@ function TimePicker( picker, settings ) {
|
|
57
57
|
// The component's item object.
|
58
58
|
clock.item = {}
|
59
59
|
|
60
|
+
clock.item.clear = null
|
60
61
|
clock.item.interval = settings.interval || 30
|
61
62
|
clock.item.disable = ( settings.disable || [] ).slice( 0 )
|
62
63
|
clock.item.enable = -(function( collectionDisabled ) {
|
@@ -111,10 +112,10 @@ function TimePicker( picker, settings ) {
|
|
111
112
|
}
|
112
113
|
}).
|
113
114
|
on( 'open', function() {
|
114
|
-
picker.$root.find( 'button' ).attr( '
|
115
|
+
picker.$root.find( 'button' ).attr( 'disabled', false )
|
115
116
|
}).
|
116
117
|
on( 'close', function() {
|
117
|
-
picker.$root.find( 'button' ).attr( '
|
118
|
+
picker.$root.find( 'button' ).attr( 'disabled', true )
|
118
119
|
})
|
119
120
|
|
120
121
|
} //TimePicker
|
@@ -130,6 +131,7 @@ TimePicker.prototype.set = function( type, value, options ) {
|
|
130
131
|
|
131
132
|
// If the value is `null` just set it immediately.
|
132
133
|
if ( value === null ) {
|
134
|
+
if ( type == 'clear' ) type = 'select'
|
133
135
|
clockItem[ type ] = value
|
134
136
|
return clock
|
135
137
|
}
|
@@ -298,7 +300,7 @@ TimePicker.prototype.overlapRanges = function( one, two ) {
|
|
298
300
|
one = clock.createRange( one.from, one.to )
|
299
301
|
two = clock.createRange( two.from, two.to )
|
300
302
|
|
301
|
-
return clock.withinRange( one, two.from ) ||
|
303
|
+
return clock.withinRange( one, two.from ) || clock.withinRange( one, two.to ) ||
|
302
304
|
clock.withinRange( two, one.from ) || clock.withinRange( two, one.to )
|
303
305
|
}
|
304
306
|
|
@@ -502,7 +504,8 @@ TimePicker.prototype.parse = function( type, value, options ) {
|
|
502
504
|
clock = this,
|
503
505
|
parsingObject = {}
|
504
506
|
|
505
|
-
|
507
|
+
// If it’s already parsed, we’re good.
|
508
|
+
if ( !value || typeof value != 'string' ) {
|
506
509
|
return value
|
507
510
|
}
|
508
511
|
|
@@ -898,9 +901,8 @@ TimePicker.prototype.nodes = function( isOpen ) {
|
|
898
901
|
return klasses.join( ' ' )
|
899
902
|
})( [ settings.klass.listItem ] ),
|
900
903
|
'data-pick=' + loopedTime.pick + ' ' + _.ariaAttr({
|
901
|
-
role: '
|
902
|
-
|
903
|
-
checked: isSelected && clock.$node.val() === _.trigger(
|
904
|
+
role: 'option',
|
905
|
+
selected: isSelected && clock.$node.val() === _.trigger(
|
904
906
|
clock.formats.toString,
|
905
907
|
clock,
|
906
908
|
[ settings.format, loopedTime ]
|
@@ -919,10 +921,13 @@ TimePicker.prototype.nodes = function( isOpen ) {
|
|
919
921
|
'button',
|
920
922
|
settings.clear,
|
921
923
|
settings.klass.buttonClear,
|
922
|
-
'type=button data-clear=1' + ( isOpen ? '' : '
|
923
|
-
|
924
|
+
'type=button data-clear=1' + ( isOpen ? '' : ' disabled' ) + ' ' +
|
925
|
+
_.ariaAttr({ controls: clock.$node[0].id })
|
926
|
+
),
|
927
|
+
'', _.ariaAttr({ role: 'presentation' })
|
924
928
|
),
|
925
|
-
settings.klass.list
|
929
|
+
settings.klass.list,
|
930
|
+
_.ariaAttr({ role: 'listbox', controls: clock.$node[0].id })
|
926
931
|
)
|
927
932
|
} //TimePicker.prototype.nodes
|
928
933
|
|
@@ -1,12 +1,12 @@
|
|
1
1
|
// Hungarian
|
2
2
|
|
3
3
|
jQuery.extend( jQuery.fn.pickadate.defaults, {
|
4
|
-
monthsFull: [ 'január', 'február', 'március', '
|
5
|
-
monthsShort: [ 'jan', 'febr', 'márc', '
|
6
|
-
weekdaysFull: [ '
|
7
|
-
weekdaysShort: [ 'V', 'H', 'K', '
|
8
|
-
today: '
|
9
|
-
clear: '
|
4
|
+
monthsFull: [ 'január', 'február', 'március', 'április', 'május', 'június', 'július', 'augusztus', 'szeptember', 'október', 'november', 'december' ],
|
5
|
+
monthsShort: [ 'jan', 'febr', 'márc', 'ápr', 'máj', 'jún', 'júl', 'aug', 'szept', 'okt', 'nov', 'dec' ],
|
6
|
+
weekdaysFull: [ 'vasárnap', 'hétfő', 'kedd', 'szerda', 'csütörtök', 'péntek', 'szombat' ],
|
7
|
+
weekdaysShort: [ 'V', 'H', 'K', 'SZe', 'CS', 'P', 'SZo' ],
|
8
|
+
today: 'Ma',
|
9
|
+
clear: 'Törlés',
|
10
10
|
firstDay: 1,
|
11
11
|
format: 'yyyy. mmmm dd.',
|
12
12
|
formatSubmit: 'yyyy/mm/dd'
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// Nepali
|
2
|
+
|
3
|
+
jQuery.extend( jQuery.fn.pickadate.defaults, {
|
4
|
+
monthsFull: [ 'जनअरी', 'र्े ब्रीवरी', 'मार', 'वसप्रब', 'म', 'जीन', 'जीबाई', 'वगस्त', 'म्े् ेारर', 'वक् ोरर', 'नोभेारर', 'सडम्ेारर' ],
|
5
|
+
monthsShort: [ 'जन', 'र्े ब्री', 'मार', 'वसप', 'मे', 'जीन', 'जीब', 'वग', 'म्े्', 'वक् ो', 'नोभ', 'सडम्े' ],
|
6
|
+
weekdaysFull: [ 'म्ोमअार', 'मकगबअार', 'रीधअार', 'सरहीअार', 'लीक्रअार', 'लसनअार', 'आइतअार' ],
|
7
|
+
weekdaysShort: [ 'म्ोम', 'मकगब', 'रीध', 'सरही', 'लीक्र', 'लसन', 'आइत' ],
|
8
|
+
numbers: [ '०', '१', '२', '३', '४', '५', '६', '७', '८', '९' ],
|
9
|
+
today: 'आज',
|
10
|
+
clear: 'मेटाउनुहोस्',
|
11
|
+
format: 'dddd, dd mmmm, yyyy',
|
12
|
+
formatSubmit: 'yyyy/mm/dd'
|
13
|
+
});
|
@@ -72,9 +72,9 @@
|
|
72
72
|
-webkit-transform: translateY(-1em) perspective(600px) rotateX(10deg);
|
73
73
|
-moz-transform: translateY(-1em) perspective(600px) rotateX(10deg);
|
74
74
|
transform: translateY(-1em) perspective(600px) rotateX(10deg);
|
75
|
-
-webkit-transition:
|
76
|
-
-moz-transition:
|
77
|
-
transition:
|
75
|
+
-webkit-transition: -webkit-transform 0.15s ease-out, opacity 0.15s ease-out, max-height 0s 0.15s, border-width 0s 0.15s;
|
76
|
+
-moz-transition: -moz-transform 0.15s ease-out, opacity 0.15s ease-out, max-height 0s 0.15s, border-width 0s 0.15s;
|
77
|
+
transition: transform 0.15s ease-out, opacity 0.15s ease-out, max-height 0s 0.15s, border-width 0s 0.15s;
|
78
78
|
}
|
79
79
|
/**
|
80
80
|
* The frame and wrap work together to ensure that
|
@@ -100,9 +100,9 @@
|
|
100
100
|
-webkit-transform: translateY(0) perspective(600px) rotateX(0);
|
101
101
|
-moz-transform: translateY(0) perspective(600px) rotateX(0);
|
102
102
|
transform: translateY(0) perspective(600px) rotateX(0);
|
103
|
-
-webkit-transition:
|
104
|
-
-moz-transition:
|
105
|
-
transition:
|
103
|
+
-webkit-transition: -webkit-transform 0.15s ease-out, opacity 0.15s ease-out, max-height 0s, border-width 0s;
|
104
|
+
-moz-transition: -moz-transform 0.15s ease-out, opacity 0.15s ease-out, max-height 0s, border-width 0s;
|
105
|
+
transition: transform 0.15s ease-out, opacity 0.15s ease-out, max-height 0s, border-width 0s;
|
106
106
|
-webkit-box-shadow: 0 6px 18px 1px rgba(0, 0, 0, 0.12);
|
107
107
|
-moz-box-shadow: 0 6px 18px 1px rgba(0, 0, 0, 0.12);
|
108
108
|
box-shadow: 0 6px 18px 1px rgba(0, 0, 0, 0.12);
|
@@ -36,16 +36,14 @@
|
|
36
36
|
.picker__select--month,
|
37
37
|
.picker__select--year {
|
38
38
|
border: 1px solid #b7b7b7;
|
39
|
-
height:
|
40
|
-
padding: .5em
|
39
|
+
height: 2em;
|
40
|
+
padding: .5em;
|
41
41
|
margin-left: .25em;
|
42
42
|
margin-right: .25em;
|
43
|
-
font-size: .6em;
|
44
43
|
}
|
45
44
|
@media (min-width: 24.5em) {
|
46
45
|
.picker__select--month,
|
47
46
|
.picker__select--year {
|
48
|
-
font-size: .8em;
|
49
47
|
margin-top: -0.5em;
|
50
48
|
}
|
51
49
|
}
|
@@ -36,16 +36,14 @@
|
|
36
36
|
.picker__select--month,
|
37
37
|
.picker__select--year {
|
38
38
|
border: 1px solid #b7b7b7;
|
39
|
-
height:
|
40
|
-
padding: .5em
|
39
|
+
height: 2em;
|
40
|
+
padding: .5em;
|
41
41
|
margin-left: .25em;
|
42
42
|
margin-right: .25em;
|
43
|
-
font-size: .6em;
|
44
43
|
}
|
45
44
|
@media (min-width: 24.5em) {
|
46
45
|
.picker__select--month,
|
47
46
|
.picker__select--year {
|
48
|
-
font-size: .8em;
|
49
47
|
margin-top: -0.5em;
|
50
48
|
}
|
51
49
|
}
|
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.
|
4
|
+
version: 1.5.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: 2014-
|
11
|
+
date: 2014-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -94,6 +94,7 @@ files:
|
|
94
94
|
- vendor/assets/javascripts/pickadate/translations/it_IT.js
|
95
95
|
- vendor/assets/javascripts/pickadate/translations/ja_JP.js
|
96
96
|
- vendor/assets/javascripts/pickadate/translations/ko_KR.js
|
97
|
+
- vendor/assets/javascripts/pickadate/translations/ne_NP.js
|
97
98
|
- vendor/assets/javascripts/pickadate/translations/nl_NL.js
|
98
99
|
- vendor/assets/javascripts/pickadate/translations/no_NO.js
|
99
100
|
- vendor/assets/javascripts/pickadate/translations/pl_PL.js
|