less-rails-semantic_ui 2.0.2.0 → 2.0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -2
- data/Appraisals +3 -3
- data/README.md +1 -1
- data/assets/javascripts/semantic_ui/definitions/behaviors/api.js +14 -1
- data/assets/javascripts/semantic_ui/definitions/behaviors/form.js +135 -91
- data/assets/javascripts/semantic_ui/definitions/behaviors/visibility.js +9 -6
- data/assets/javascripts/semantic_ui/definitions/modules/checkbox.js +16 -3
- data/assets/javascripts/semantic_ui/definitions/modules/dropdown.js +67 -20
- data/assets/javascripts/semantic_ui/definitions/modules/modal.js +12 -10
- data/assets/javascripts/semantic_ui/definitions/modules/popup.js +92 -59
- data/assets/javascripts/semantic_ui/definitions/modules/sidebar.js +0 -1
- data/assets/javascripts/semantic_ui/definitions/modules/sticky.js +14 -11
- data/assets/javascripts/semantic_ui/definitions/modules/transition.js +6 -3
- data/assets/stylesheets/semantic_ui/definitions/collections/form.less +6 -1
- data/assets/stylesheets/semantic_ui/definitions/collections/menu.less +35 -15
- data/assets/stylesheets/semantic_ui/definitions/collections/message.less +1 -2
- data/assets/stylesheets/semantic_ui/definitions/collections/table.less +22 -11
- data/assets/stylesheets/semantic_ui/definitions/elements/button.less +17 -20
- data/assets/stylesheets/semantic_ui/definitions/elements/container.less +1 -6
- data/assets/stylesheets/semantic_ui/definitions/elements/divider.less +1 -0
- data/assets/stylesheets/semantic_ui/definitions/elements/icon.less +13 -0
- data/assets/stylesheets/semantic_ui/definitions/elements/input.less +2 -2
- data/assets/stylesheets/semantic_ui/definitions/elements/segment.less +20 -16
- data/assets/stylesheets/semantic_ui/definitions/elements/step.less +35 -25
- data/assets/stylesheets/semantic_ui/definitions/modules/accordion.less +2 -1
- data/assets/stylesheets/semantic_ui/definitions/modules/checkbox.less +99 -62
- data/assets/stylesheets/semantic_ui/definitions/modules/modal.less +1 -1
- data/assets/stylesheets/semantic_ui/definitions/modules/popup.less +7 -0
- data/assets/stylesheets/semantic_ui/themes/basic/elements/step.overrides +3 -0
- data/assets/stylesheets/semantic_ui/themes/basic/elements/step.variables +12 -4
- data/assets/stylesheets/semantic_ui/themes/colored/modules/checkbox.variables +15 -3
- data/assets/stylesheets/semantic_ui/themes/default/collections/form.variables +1 -1
- data/assets/stylesheets/semantic_ui/themes/default/collections/menu.variables +12 -11
- data/assets/stylesheets/semantic_ui/themes/default/collections/table.variables +11 -2
- data/assets/stylesheets/semantic_ui/themes/default/elements/icon.overrides +2 -0
- data/assets/stylesheets/semantic_ui/themes/default/elements/segment.variables +6 -5
- data/assets/stylesheets/semantic_ui/themes/default/elements/step.variables +6 -3
- data/assets/stylesheets/semantic_ui/themes/default/globals/site.variables +10 -9
- data/assets/stylesheets/semantic_ui/themes/default/modules/checkbox.variables +32 -11
- data/assets/stylesheets/semantic_ui/themes/github/elements/segment.variables +0 -1
- data/assets/stylesheets/semantic_ui/themes/github/elements/step.variables +7 -1
- data/less-rails-semantic_ui.gemspec +1 -1
- data/lib/less/rails/semantic_ui/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6043f6d657f70a569013de645d25f633eb94818
|
4
|
+
data.tar.gz: 928a195ad0e62cffba28b1bf6f4f8a8b0fba77e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 097b718c2457ac4e48ee128dd94153cfc6042d0d316422026f38fd8545207ea68988d4e0ff7ef7abcfdff38e5a3a55e7c104b9a6e1953988505198efde538cbe
|
7
|
+
data.tar.gz: 84c0c7b9217e47e22764b109678f9a550fe107b7132f3e1623ce7fd1bb39f45e31574c72c9cefdb5c38b518ca6b4dd5c071c98e16b7ad708f7343e5b1c4811b7
|
data/.travis.yml
CHANGED
data/Appraisals
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
appraise 'rails40' do
|
2
|
-
gem 'rails', '~> 4.0.
|
2
|
+
gem 'rails', '~> 4.0.13'
|
3
3
|
gem 'sprockets', '~> 2'
|
4
4
|
end
|
5
5
|
|
6
6
|
appraise 'rails41' do
|
7
|
-
gem 'rails', '~> 4.1.
|
7
|
+
gem 'rails', '~> 4.1.12'
|
8
8
|
gem 'sprockets', '~> 2'
|
9
9
|
end
|
10
10
|
|
11
11
|
appraise 'rails42' do
|
12
|
-
gem 'rails', '~> 4.2.
|
12
|
+
gem 'rails', '~> 4.2.3'
|
13
13
|
gem 'sprockets', '~> 2'
|
14
14
|
end
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# less-rails-semantic_ui [![Gem Version](https://badge.fury.io/rb/less-rails-semantic_ui.svg)](http://badge.fury.io/rb/less-rails-semantic_ui) [![Build Status](https://travis-ci.org/
|
1
|
+
# less-rails-semantic_ui [![Gem Version](https://badge.fury.io/rb/less-rails-semantic_ui.svg)](http://badge.fury.io/rb/less-rails-semantic_ui) [![Build Status](https://travis-ci.org/Semantic-Org/Semantic-UI-Rails-LESS.png?branch=master)](https://travis-ci.org/Semantic-Org/Semantic-UI-Rails-LESS)
|
2
2
|
|
3
3
|
This is a gem for Rails with [Semantic UI](https://github.com/Semantic-Org/Semantic-UI/) assets inside.
|
4
4
|
It provides the ability to customize component themes and variables on the fly in your application.
|
@@ -352,7 +352,7 @@ $.api = $.fn.api = function(parameters) {
|
|
352
352
|
}
|
353
353
|
else {
|
354
354
|
module.verbose('Found required variable', variable, value);
|
355
|
-
url = url.replace(templatedString, value);
|
355
|
+
url = url.replace(templatedString, module.get.urlEncodedValue(value));
|
356
356
|
}
|
357
357
|
});
|
358
358
|
}
|
@@ -686,6 +686,19 @@ $.api = $.fn.api = function(parameters) {
|
|
686
686
|
: settings
|
687
687
|
;
|
688
688
|
},
|
689
|
+
urlEncodedValue: function(value) {
|
690
|
+
var
|
691
|
+
decodedValue = window.decodeURIComponent(value),
|
692
|
+
encodedValue = window.encodeURIComponent(value),
|
693
|
+
alreadyEncoded = (decodedValue !== value)
|
694
|
+
;
|
695
|
+
if(alreadyEncoded) {
|
696
|
+
module.debug('URL value is already encoded, avoiding double encoding', value);
|
697
|
+
return value;
|
698
|
+
}
|
699
|
+
module.verbose('Encoding value for url', value, encodedValue);
|
700
|
+
return encodedValue;
|
701
|
+
},
|
689
702
|
defaultData: function() {
|
690
703
|
var
|
691
704
|
data = {}
|
@@ -341,7 +341,7 @@ $.fn.form = function(parameters) {
|
|
341
341
|
var
|
342
342
|
keys = Object.keys(parameters),
|
343
343
|
isLegacySettings = (keys.length > 0)
|
344
|
-
? (parameters[keys[0]].identifier !== undefined)
|
344
|
+
? (parameters[keys[0]].identifier !== undefined && parameters[keys[0]].rules !== undefined)
|
345
345
|
: false
|
346
346
|
;
|
347
347
|
if(isLegacySettings) {
|
@@ -495,6 +495,9 @@ $.fn.form = function(parameters) {
|
|
495
495
|
|
496
496
|
field: function(identifier) {
|
497
497
|
module.verbose('Checking for existence of a field with identifier', identifier);
|
498
|
+
if(typeof identifier !== 'string') {
|
499
|
+
module.error(error.identifier, identifier);
|
500
|
+
}
|
498
501
|
if( $field.filter('#' + identifier).length > 0 ) {
|
499
502
|
return true;
|
500
503
|
}
|
@@ -760,9 +763,11 @@ $.fn.form = function(parameters) {
|
|
760
763
|
ancillary,
|
761
764
|
functionType
|
762
765
|
;
|
763
|
-
// cast to string
|
764
|
-
value =
|
765
|
-
|
766
|
+
// cast to string avoiding encoding special values
|
767
|
+
value = (value === undefined || value === '' || value === null)
|
768
|
+
? ''
|
769
|
+
: $.trim(value + '')
|
770
|
+
;
|
766
771
|
// if bracket notation is used, pass in extra parameters
|
767
772
|
if(bracket) {
|
768
773
|
ancillary = '' + bracket[1];
|
@@ -989,7 +994,7 @@ $.fn.form.settings = {
|
|
989
994
|
email : "[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?",
|
990
995
|
integer : /^\-?\d+$/,
|
991
996
|
flags : /^\/(.*)\/(.*)?/,
|
992
|
-
url : /(
|
997
|
+
url : /(https?:\/\/(?:www\.|(?!www))[^\s\.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/i
|
993
998
|
},
|
994
999
|
|
995
1000
|
selector : {
|
@@ -1015,9 +1020,10 @@ $.fn.form.settings = {
|
|
1015
1020
|
},
|
1016
1021
|
|
1017
1022
|
error: {
|
1018
|
-
oldSyntax
|
1019
|
-
|
1020
|
-
|
1023
|
+
oldSyntax : 'Starting in 2.0 forms now only take a single settings object. Validation settings converted to new syntax automatically.',
|
1024
|
+
identifier : 'You must specify a string identifier for each field',
|
1025
|
+
noRule : 'There is no rule matching the one you specified',
|
1026
|
+
method : 'The method you called is not defined.'
|
1021
1027
|
},
|
1022
1028
|
|
1023
1029
|
templates: {
|
@@ -1045,25 +1051,16 @@ $.fn.form.settings = {
|
|
1045
1051
|
|
1046
1052
|
rules: {
|
1047
1053
|
|
1054
|
+
// is not empty or blank string
|
1055
|
+
empty: function(value) {
|
1056
|
+
return !(value === undefined || '' === value || $.isArray(value) && value.length === 0);
|
1057
|
+
},
|
1058
|
+
|
1048
1059
|
// checkbox checked
|
1049
1060
|
checked: function() {
|
1050
1061
|
return ($(this).filter(':checked').length > 0);
|
1051
1062
|
},
|
1052
1063
|
|
1053
|
-
// value contains text (insensitive)
|
1054
|
-
contains: function(value, text) {
|
1055
|
-
// escape regex characters
|
1056
|
-
text = text.replace($.fn.form.settings.regExp.escape, "\\$&");
|
1057
|
-
return (value.search( new RegExp(text, 'i') ) !== -1);
|
1058
|
-
},
|
1059
|
-
|
1060
|
-
// value contains text (case sensitive)
|
1061
|
-
containsExactly: function(value, text) {
|
1062
|
-
// escape regex characters
|
1063
|
-
text = text.replace($.fn.form.settings.regExp.escape, "\\$&");
|
1064
|
-
return (value.search( new RegExp(text) ) !== -1);
|
1065
|
-
},
|
1066
|
-
|
1067
1064
|
// is most likely an email
|
1068
1065
|
email: function(value){
|
1069
1066
|
var
|
@@ -1072,12 +1069,32 @@ $.fn.form.settings = {
|
|
1072
1069
|
return emailRegExp.test(value);
|
1073
1070
|
},
|
1074
1071
|
|
1075
|
-
// is
|
1076
|
-
|
1077
|
-
return
|
1072
|
+
// value is most likely url
|
1073
|
+
url: function(value) {
|
1074
|
+
return $.fn.form.settings.regExp.url.test(value);
|
1078
1075
|
},
|
1079
1076
|
|
1080
|
-
//
|
1077
|
+
// matches specified regExp
|
1078
|
+
regExp: function(value, regExp) {
|
1079
|
+
var
|
1080
|
+
regExpParts = regExp.match($.fn.form.settings.regExp.flags),
|
1081
|
+
flags
|
1082
|
+
;
|
1083
|
+
// regular expression specified as /baz/gi (flags)
|
1084
|
+
if(regExpParts) {
|
1085
|
+
regExp = (regExpParts.length >= 2)
|
1086
|
+
? regExpParts[1]
|
1087
|
+
: regExp
|
1088
|
+
;
|
1089
|
+
flags = (regExpParts.length >= 3)
|
1090
|
+
? regExpParts[2]
|
1091
|
+
: ''
|
1092
|
+
;
|
1093
|
+
}
|
1094
|
+
return value.match( new RegExp(regExp, flags) );
|
1095
|
+
},
|
1096
|
+
|
1097
|
+
// is valid integer or matches range
|
1081
1098
|
integer: function(value, range) {
|
1082
1099
|
var
|
1083
1100
|
intRegExp = $.fn.form.settings.regExp.integer,
|
@@ -1109,6 +1126,7 @@ $.fn.form.settings = {
|
|
1109
1126
|
);
|
1110
1127
|
},
|
1111
1128
|
|
1129
|
+
|
1112
1130
|
// is value (case insensitive)
|
1113
1131
|
is: function(value, text) {
|
1114
1132
|
text = (typeof text == 'string')
|
@@ -1127,17 +1145,78 @@ $.fn.form.settings = {
|
|
1127
1145
|
return (value == text);
|
1128
1146
|
},
|
1129
1147
|
|
1130
|
-
// is
|
1148
|
+
// value is not another value (case insensitive)
|
1149
|
+
not: function(value, notValue) {
|
1150
|
+
value = (typeof value == 'string')
|
1151
|
+
? value.toLowerCase()
|
1152
|
+
: value
|
1153
|
+
;
|
1154
|
+
notValue = (typeof notValue == 'string')
|
1155
|
+
? notValue.toLowerCase()
|
1156
|
+
: notValue
|
1157
|
+
;
|
1158
|
+
return (value != notValue);
|
1159
|
+
},
|
1160
|
+
|
1161
|
+
// value is not another value (case sensitive)
|
1162
|
+
notExactly: function(value, notValue) {
|
1163
|
+
return (value != notValue);
|
1164
|
+
},
|
1165
|
+
|
1166
|
+
// value contains text (insensitive)
|
1167
|
+
contains: function(value, text) {
|
1168
|
+
// escape regex characters
|
1169
|
+
text = text.replace($.fn.form.settings.regExp.escape, "\\$&");
|
1170
|
+
return (value.search( new RegExp(text, 'i') ) !== -1);
|
1171
|
+
},
|
1172
|
+
|
1173
|
+
// value contains text (case sensitive)
|
1174
|
+
containsExactly: function(value, text) {
|
1175
|
+
// escape regex characters
|
1176
|
+
text = text.replace($.fn.form.settings.regExp.escape, "\\$&");
|
1177
|
+
return (value.search( new RegExp(text) ) !== -1);
|
1178
|
+
},
|
1179
|
+
|
1180
|
+
// value contains text (insensitive)
|
1181
|
+
doesntContain: function(value, text) {
|
1182
|
+
// escape regex characters
|
1183
|
+
text = text.replace($.fn.form.settings.regExp.escape, "\\$&");
|
1184
|
+
return (value.search( new RegExp(text, 'i') ) === -1);
|
1185
|
+
},
|
1186
|
+
|
1187
|
+
// value contains text (case sensitive)
|
1188
|
+
doesntContainExactly: function(value, text) {
|
1189
|
+
// escape regex characters
|
1190
|
+
text = text.replace($.fn.form.settings.regExp.escape, "\\$&");
|
1191
|
+
return (value.search( new RegExp(text) ) === -1);
|
1192
|
+
},
|
1193
|
+
|
1194
|
+
// is exactly length
|
1131
1195
|
length: function(value, requiredLength) {
|
1196
|
+
return (value !== undefined)
|
1197
|
+
? (value.length == requiredLength)
|
1198
|
+
: false
|
1199
|
+
;
|
1200
|
+
},
|
1201
|
+
|
1202
|
+
// is at least string length
|
1203
|
+
minLength: function(value, requiredLength) {
|
1132
1204
|
return (value !== undefined)
|
1133
1205
|
? (value.length >= requiredLength)
|
1134
1206
|
: false
|
1135
1207
|
;
|
1136
1208
|
},
|
1137
1209
|
|
1210
|
+
// is less than length
|
1211
|
+
maxLength: function(value, maxLength) {
|
1212
|
+
return (value !== undefined)
|
1213
|
+
? (value.length <= maxLength)
|
1214
|
+
: false
|
1215
|
+
;
|
1216
|
+
},
|
1217
|
+
|
1138
1218
|
// matches another field
|
1139
|
-
|
1140
|
-
// use either id or name of field
|
1219
|
+
match: function(value, identifier) {
|
1141
1220
|
var
|
1142
1221
|
$form = $(this),
|
1143
1222
|
matchingValue
|
@@ -1155,13 +1234,13 @@ $.fn.form.settings = {
|
|
1155
1234
|
matchingValue = $('[name="' + identifier +'[]"]');
|
1156
1235
|
}
|
1157
1236
|
return (matchingValue !== undefined)
|
1158
|
-
? ( value.toString()
|
1237
|
+
? ( value.toString() == matchingValue.toString() )
|
1159
1238
|
: false
|
1160
1239
|
;
|
1161
1240
|
},
|
1162
1241
|
|
1163
|
-
//
|
1164
|
-
|
1242
|
+
// different than another field
|
1243
|
+
different: function(value, identifier) {
|
1165
1244
|
// use either id or name of field
|
1166
1245
|
var
|
1167
1246
|
$form = $(this),
|
@@ -1180,74 +1259,39 @@ $.fn.form.settings = {
|
|
1180
1259
|
matchingValue = $('[name="' + identifier +'[]"]');
|
1181
1260
|
}
|
1182
1261
|
return (matchingValue !== undefined)
|
1183
|
-
? ( value.toString()
|
1262
|
+
? ( value.toString() !== matchingValue.toString() )
|
1184
1263
|
: false
|
1185
1264
|
;
|
1186
1265
|
},
|
1187
1266
|
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1191
|
-
},
|
1192
|
-
|
1193
|
-
exactCount: function(value, count) {
|
1194
|
-
value = value.split(',');
|
1195
|
-
return ($.isArray(value) && value.length == count);
|
1196
|
-
},
|
1197
|
-
|
1198
|
-
minCount: function(value, count) {
|
1199
|
-
value = value.split(',');
|
1200
|
-
return ($.isArray(value) && value.length >= count);
|
1201
|
-
},
|
1202
|
-
|
1203
|
-
regExp: function(value, regExp) {
|
1204
|
-
var
|
1205
|
-
regExpParts = regExp.match($.fn.form.settings.regExp.flags),
|
1206
|
-
flags
|
1207
|
-
;
|
1208
|
-
// regular expression specified as /baz/gi (flags)
|
1209
|
-
if(regExpParts) {
|
1210
|
-
regExp = (regExpParts.length >= 2)
|
1211
|
-
? regExpParts[1]
|
1212
|
-
: regExp
|
1213
|
-
;
|
1214
|
-
flags = (regExpParts.length >= 3)
|
1215
|
-
? regExpParts[2]
|
1216
|
-
: ''
|
1217
|
-
;
|
1267
|
+
exactCount: function(value, exactCount) {
|
1268
|
+
if(exactCount == 0) {
|
1269
|
+
return (value === '');
|
1218
1270
|
}
|
1219
|
-
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1223
|
-
maxLength: function(value, maxLength) {
|
1224
|
-
return (value !== undefined)
|
1225
|
-
? (value.length <= maxLength)
|
1226
|
-
: false
|
1227
|
-
;
|
1228
|
-
},
|
1229
|
-
|
1230
|
-
// value is not value (case insensitive)
|
1231
|
-
not: function(value, notValue) {
|
1232
|
-
value = (typeof value == 'string')
|
1233
|
-
? value.toLowerCase()
|
1234
|
-
: value
|
1235
|
-
;
|
1236
|
-
notValue = (typeof notValue == 'string')
|
1237
|
-
? notValue.toLowerCase()
|
1238
|
-
: notValue
|
1239
|
-
;
|
1240
|
-
return (value != notValue);
|
1271
|
+
if(exactCount == 1) {
|
1272
|
+
return (value !== '' && value.search(',') === -1);
|
1273
|
+
}
|
1274
|
+
return (value.split(',').length == exactCount);
|
1241
1275
|
},
|
1242
1276
|
|
1243
|
-
|
1244
|
-
|
1245
|
-
|
1277
|
+
minCount: function(value, minCount) {
|
1278
|
+
if(minCount == 0) {
|
1279
|
+
return true;
|
1280
|
+
}
|
1281
|
+
if(minCount == 1) {
|
1282
|
+
return (value !== '');
|
1283
|
+
}
|
1284
|
+
return (value.split(',').length >= minCount);
|
1246
1285
|
},
|
1247
1286
|
|
1248
|
-
|
1249
|
-
|
1250
|
-
|
1287
|
+
maxCount: function(value, maxCount) {
|
1288
|
+
if(maxCount == 0) {
|
1289
|
+
return false;
|
1290
|
+
}
|
1291
|
+
if(maxCount == 1) {
|
1292
|
+
return (value.search(',') === -1);
|
1293
|
+
}
|
1294
|
+
return (value.split(',').length <= maxCount);
|
1251
1295
|
}
|
1252
1296
|
}
|
1253
1297
|
|
@@ -1137,9 +1137,18 @@ $.fn.visibility.settings = {
|
|
1137
1137
|
// whether to use mutation observers to follow changes
|
1138
1138
|
observeChanges : true,
|
1139
1139
|
|
1140
|
+
// check position immediately on init
|
1141
|
+
initialCheck : true,
|
1142
|
+
|
1140
1143
|
// whether to refresh calculations after all page images load
|
1141
1144
|
refreshOnLoad : true,
|
1142
1145
|
|
1146
|
+
// whether to refresh calculations after page resize event
|
1147
|
+
refreshOnResize : true,
|
1148
|
+
|
1149
|
+
// should call callbacks on refresh event (resize, etc)
|
1150
|
+
checkOnRefresh : true,
|
1151
|
+
|
1143
1152
|
// callback should only occur one time
|
1144
1153
|
once : true,
|
1145
1154
|
|
@@ -1155,9 +1164,6 @@ $.fn.visibility.settings = {
|
|
1155
1164
|
// scroll context for visibility checks
|
1156
1165
|
context : window,
|
1157
1166
|
|
1158
|
-
// check position immediately on init
|
1159
|
-
initialCheck : true,
|
1160
|
-
|
1161
1167
|
// visibility check delay in ms (defaults to animationFrame)
|
1162
1168
|
throttle : false,
|
1163
1169
|
|
@@ -1171,9 +1177,6 @@ $.fn.visibility.settings = {
|
|
1171
1177
|
// array of callbacks for percentage
|
1172
1178
|
onPassed : {},
|
1173
1179
|
|
1174
|
-
// should call callbacks on refresh event (resize, etc)
|
1175
|
-
checkOnRefresh : true,
|
1176
|
-
|
1177
1180
|
// standard callbacks
|
1178
1181
|
onOnScreen : false,
|
1179
1182
|
onOffScreen : false,
|
@@ -44,6 +44,8 @@ $.fn.checkbox = function(parameters) {
|
|
44
44
|
$label = $(this).children(selector.label),
|
45
45
|
$input = $(this).children(selector.input),
|
46
46
|
|
47
|
+
shortcutPressed = false,
|
48
|
+
|
47
49
|
instance = $module.data(moduleNamespace),
|
48
50
|
|
49
51
|
observer,
|
@@ -177,6 +179,8 @@ $.fn.checkbox = function(parameters) {
|
|
177
179
|
return;
|
178
180
|
}
|
179
181
|
module.toggle();
|
182
|
+
$input.focus();
|
183
|
+
event.preventDefault();
|
180
184
|
},
|
181
185
|
keydown: function(event) {
|
182
186
|
var
|
@@ -190,11 +194,19 @@ $.fn.checkbox = function(parameters) {
|
|
190
194
|
if(key == keyCode.escape) {
|
191
195
|
module.verbose('Escape key pressed blurring field');
|
192
196
|
$input.blur();
|
193
|
-
|
197
|
+
shortcutPressed = true;
|
194
198
|
}
|
195
|
-
if(!event.ctrlKey && (key == keyCode.
|
196
|
-
module.verbose('Enter key pressed, toggling checkbox');
|
199
|
+
else if(!event.ctrlKey && ( key == keyCode.space || key == keyCode.enter) ) {
|
200
|
+
module.verbose('Enter/space key pressed, toggling checkbox');
|
197
201
|
module.toggle();
|
202
|
+
shortcutPressed = true;
|
203
|
+
}
|
204
|
+
else {
|
205
|
+
shortcutPressed = false;
|
206
|
+
}
|
207
|
+
},
|
208
|
+
keyup: function(event) {
|
209
|
+
if(shortcutPressed) {
|
198
210
|
event.preventDefault();
|
199
211
|
}
|
200
212
|
}
|
@@ -453,6 +465,7 @@ $.fn.checkbox = function(parameters) {
|
|
453
465
|
$module
|
454
466
|
.on('click' + eventNamespace, module.event.click)
|
455
467
|
.on('keydown' + eventNamespace, selector.input, module.event.keydown)
|
468
|
+
.on('keyup' + eventNamespace, selector.input, module.event.keyup)
|
456
469
|
;
|
457
470
|
}
|
458
471
|
},
|