parsley-rails 2.0.5.0 → 2.0.6.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: 76cf51758dc96d0ff42b83a6988e3ddb53c62299
4
- data.tar.gz: e6ea3415d5304054f2dd7469a01c35c992e2d0cc
3
+ metadata.gz: 634825ca2abab6902f5c17a4bdd1bf6ab30e293c
4
+ data.tar.gz: 73666d399b9d5d6a02599eac268388dce139128b
5
5
  SHA512:
6
- metadata.gz: e04fa88da92f7537f5b642e58a9d5ff7d2d33434e57bb9830354d3f085686ecf80c166553842700d81788ce1627df7ff2a51af4e4ae7ed945e6e9f2247d1ead8
7
- data.tar.gz: a29fa3427c9b2bf3a9c62a8c100f1e9877de5d856f0fbe908bf4acc1deb5e756503ea5f2a8db7e7e3ad2dde17c5ed1b04670cbfbb492511f93e05b3aab6e7d42
6
+ metadata.gz: 205319188aab92ca38ce33f767f82f3e6f90dc4dcbf6eee85731c7396077ce85fd19069c7c50cef103ca08384a8bcf3e26e3c6c9ab7041a066b5e93a815903ed
7
+ data.tar.gz: ee8a53503db47367780240b7992b6d18cdfb9fa762ceb8e7e5bea4884182208a0b0116849fd60ff4b621be36e711abce66613fd3625930b9b43cd4d41f4c3c77
data/README.md CHANGED
@@ -25,11 +25,22 @@ To use the `remote` library or a different i18n, add this right after:
25
25
  //= require parsley.remote
26
26
  //= require parsley.i18n.fr
27
27
 
28
+ Note that in order to use the Russian i18n and avoid bumping into [sstephenson/sprockets#529](https://github.com/sstephenson/sprockets/issues/529), you need to append `.js` to the filename (`parsley.i18n.ru.js`).
29
+
28
30
  Finally, if you want to use the default CSS, add the following to your
29
31
  `app/assets/stylesheets/application.css`:
30
32
 
31
33
  *= require parsley
32
34
 
35
+ ## Sass Support
36
+
37
+ If you prefer SCSS, add this to your application.css.scss file:
38
+
39
+ @import 'parsley';
40
+
41
+ If you use the Sass indented syntax, add this to your application.css.sass file:
42
+
43
+ @import parsley
33
44
 
34
45
  See the complete [Parsley.js documentation](http://parsleyjs.org/doc/index.html).
35
46
 
@@ -1,5 +1,5 @@
1
1
  module Parsley
2
2
  module Rails
3
- VERSION = "2.0.5.0"
3
+ VERSION = "2.0.6.0"
4
4
  end
5
5
  end
@@ -13,7 +13,6 @@ window.ParsleyConfig.i18n.bg = $.extend(window.ParsleyConfig.i18n.bg || {}, {
13
13
  digits: "Невалидни цифри.",
14
14
  alphanum: "Стойността трябва да садържа само букви или цифри."
15
15
  },
16
- notnull: "Полето е задължително.",
17
16
  notblank: "Полето е задължително.",
18
17
  required: "Полето е задължително.",
19
18
  pattern: "Невалидна стойност.",
@@ -6,22 +6,22 @@ window.ParsleyConfig.i18n = window.ParsleyConfig.i18n || {};
6
6
  window.ParsleyConfig.i18n.da = $.extend(window.ParsleyConfig.i18n.da || {}, {
7
7
  defaultMessage: "Indtast venligst en korrekt værdi.",
8
8
  type: {
9
- email: "Indtast venligst en korrekt email.",
9
+ email: "Indtast venligst en korrekt emailadresse.",
10
10
  url: "Indtast venligst en korrekt internetadresse.",
11
- number: "Indtast venligst et korrekt nummer.",
12
- integer: "Indtast venligst et korrekt tal.",
11
+ number: "Indtast venligst et tal.",
12
+ integer: "Indtast venligst et heltal.",
13
13
  digits: "Dette felt må kun bestå af tal.",
14
14
  alphanum: "Dette felt skal indeholde både tal og bogstaver."
15
15
  },
16
16
  notblank: "Dette felt må ikke være tomt.",
17
17
  required: "Dette felt er påkrævet.",
18
18
  pattern: "Ugyldig indtastning.",
19
- min: "Dette felt skal indeholde mindst %s tegn.",
20
- max: "Dette felt kan højest indeholde %s tegn.",
21
- range: "Dette felt skal være mellem %s og %s tegn.",
19
+ min: "Dette felt skal indeholde et tal som er større end eller lig med %s.",
20
+ max: "Dette felt skal indeholde et tal som er mindre end eller lig med %s.",
21
+ range: "Dette felt skal indeholde et tal mellem %s og %s.",
22
22
  minlength: "Indtast venligst mindst %s tegn.",
23
- maxlength: "Dette felt kan kun indeholde %s tegn.",
24
- length: "This value length is invalid. It should be between %s and %s characters long.",
23
+ maxlength: "Dette felt kan højst indeholde %s tegn.",
24
+ length: "Længden af denne værdi er ikke korrekt. Værdien skal være mellem %s og %s tegn lang.",
25
25
  mincheck: "Vælg mindst %s muligheder.",
26
26
  maxcheck: "Vælg op til %s muligheder.",
27
27
  check: "Vælg mellem %s og %s muligheder.",
@@ -31,3 +31,4 @@ window.ParsleyConfig.i18n.da = $.extend(window.ParsleyConfig.i18n.da || {}, {
31
31
  // If file is loaded after Parsley main file, auto-load locale
32
32
  if ('undefined' !== typeof window.ParsleyValidator)
33
33
  window.ParsleyValidator.addCatalog('da', window.ParsleyConfig.i18n.da, true);
34
+
@@ -5,5 +5,9 @@ window.ParsleyConfig.i18n.en = $.extend(window.ParsleyConfig.i18n.en || {}, {
5
5
  dateiso: "This value should be a valid date (YYYY-MM-DD).",
6
6
  minwords: "This value is too short. It should have %s words or more.",
7
7
  maxwords: "This value is too long. It should have %s words or fewer.",
8
- words: "This value length is invalid. It should be between %s and %s words long."
8
+ words: "This value length is invalid. It should be between %s and %s words long.",
9
+ gt: "This value should be greater.",
10
+ gte: "This value should be greater or equal.",
11
+ lt: "This value should be less.",
12
+ lte: "This value should be less or equal."
9
13
  });
@@ -23,7 +23,7 @@ window.ParsleyConfig.i18n.es = $.extend(window.ParsleyConfig.i18n.es || {}, {
23
23
  length: "La longitud de este valor debe estar entre %s y %s caracteres.",
24
24
  mincheck: "Debe seleccionar al menos %s opciones.",
25
25
  maxcheck: "Debe seleccionar %s opciones o menos.",
26
- rangecheck: "Debe seleccionar entre %s y %s opciones.",
26
+ check: "Debe seleccionar entre %s y %s opciones.",
27
27
  equalto: "Este valor debe ser idéntico."
28
28
  });
29
29
 
@@ -0,0 +1,33 @@
1
+ // ParsleyConfig definition if not already set
2
+ window.ParsleyConfig = window.ParsleyConfig || {};
3
+ window.ParsleyConfig.i18n = window.ParsleyConfig.i18n || {};
4
+
5
+ // Define then the messages
6
+ window.ParsleyConfig.i18n.ko = $.extend(window.ParsleyConfig.i18n.ko || {}, {
7
+ defaultMessage: "입력하신 내용이 올바르지 않습니다.",
8
+ type: {
9
+ email: "입력하신 이메일이 유효하지 않습니다.",
10
+ url: "입력하신 URL이 유효하지 않습니다.",
11
+ number: "입력하신 전화번호가 올바르지 않습니다.",
12
+ integer: "입력하신 URL이 유효하지 않습니다.",
13
+ digits: "숫자를 입력하여 주십시오.",
14
+ alphanum: "입력하신 내용은 알파벳과 숫자의 조합이어야 합니다."
15
+ },
16
+ notblank: "공백은 입력하실 수 없습니다.",
17
+ required: "필수 입력사항입니다.",
18
+ pattern: "입력하신 내용이 올바르지 않습니다.",
19
+ min: "입력하신 내용이 %s보다 크거나 같아야 합니다. ",
20
+ max: "입력하신 내용이 %s보다 작거나 같아야 합니다.",
21
+ range: "입력하신 내용이 %s보다 크고 %s 보다 작아야 합니다.",
22
+ minlength: "%s 이상의 글자수를 입력하십시오. ",
23
+ maxlength: "%s 이하의 글자수를 입력하십시오. ",
24
+ length: "입력하신 내용의 글자수가 %s보다 크고 %s보다 작아야 합니다.",
25
+ mincheck: "최소한 %s개를 선택하여 주십시오. ",
26
+ maxcheck: "%s개 또는 그보다 적게 선택하여 주십시오.",
27
+ check: "선택하신 내용이 %s보다 크거나 %s보다 작아야 합니다.",
28
+ equalto: "같은 값을 입력하여 주십시오."
29
+ });
30
+
31
+ // If file is loaded after Parsley main file, auto-load locale
32
+ if ('undefined' !== typeof window.ParsleyValidator)
33
+ window.ParsleyValidator.addCatalog('ko', window.ParsleyConfig.i18n.ko, true);
@@ -0,0 +1,13 @@
1
+ window.ParsleyConfig = window.ParsleyConfig || {};
2
+ window.ParsleyConfig.i18n = window.ParsleyConfig.i18n || {};
3
+
4
+ window.ParsleyConfig.i18n.ms_MY = $.extend(window.ParsleyConfig.i18n.ms_MY || {}, {
5
+ dateiso: "Nilai hendaklah berbentuk tarikh yang sah (YYYY-MM-DD).",
6
+ minwords: "Ayat terlalu pendek. Ianya perlu sekurang-kurangnya %s patah perkataan.",
7
+ maxwords: "Ayat terlalu panjang. Ianya tidak boleh melebihi %s patah perkataan.",
8
+ words: "Panjang ayat tidak sah. Jumlah perkataan adalah diantara %s hingga %s patah perkataan.",
9
+ gt: "Nilai lebih besar diperlukan.",
10
+ gte: "Nilai hendaklah lebih besar atau sama.",
11
+ lt: "Nilai lebih kecil diperlukan.",
12
+ lte: "Nilai hendaklah lebih kecil atau sama."
13
+ });
@@ -0,0 +1,33 @@
1
+ // ParsleyConfig definition if not already set
2
+ window.ParsleyConfig = window.ParsleyConfig || {};
3
+ window.ParsleyConfig.i18n = window.ParsleyConfig.i18n || {};
4
+
5
+ // Define then the messages
6
+ window.ParsleyConfig.i18n.ms_MY = $.extend(window.ParsleyConfig.i18n.ms_MY || {}, {
7
+ defaultMessage: "Nilai tidak sah.",
8
+ type: {
9
+ email: "Nilai mestilah dalam format emel yang sah.",
10
+ url: "Nilai mestilah dalam bentuk url yang sah.",
11
+ number: "Hanya nombor dibenarkan.",
12
+ integer: "Hanya integer dibenarkan.",
13
+ digits: "Hanya angka dibenarkan.",
14
+ alphanum: "Hanya alfanumerik dibenarkan."
15
+ },
16
+ notblank: "Nilai ini tidak boleh kosong.",
17
+ required: "Nilai ini wajib diisi.",
18
+ pattern: "Bentuk nilai ini tidak sah.",
19
+ min: "Nilai perlu lebih besar atau sama dengan %s.",
20
+ max: "Nilai perlu lebih kecil atau sama dengan %s.",
21
+ range: "Nilai perlu berada antara %s hingga %s.",
22
+ minlength: "Nilai terlalu pendek. Ianya perlu sekurang-kurangnya %s huruf.",
23
+ maxlength: "Nilai terlalu panjang. Ianya tidak boleh melebihi %s huruf.",
24
+ length: "Panjang nilai tidak sah. Panjangnya perlu diantara %s hingga %s huruf.",
25
+ mincheck: "Anda mesti memilih sekurang-kurangnya %s pilihan.",
26
+ maxcheck: "Anda tidak boleh memilih lebih daripada %s pilihan.",
27
+ check: "Anda mesti memilih diantara %s hingga %s pilihan.",
28
+ equalto: "Nilai dimasukkan hendaklah sama."
29
+ });
30
+
31
+ // If file is loaded after Parsley main file, auto-load locale
32
+ if ('undefined' !== typeof window.ParsleyValidator)
33
+ window.ParsleyValidator.addCatalog('ms_MY', window.ParsleyConfig.i18n.ms_MY, true);
@@ -0,0 +1,11 @@
1
+ window.ParsleyConfig = window.ParsleyConfig || {};
2
+ window.ParsleyConfig.i18n = window.ParsleyConfig.i18n || {};
3
+
4
+ window.ParsleyConfig.i18n.nl = $.extend(window.ParsleyConfig.i18n.nl || {}, {
5
+ dateiso: "Deze waarde moet een datum in het volgende formaat zijn: (YYYY-MM-DD).",
6
+ minwords: "Deze waarde moet minstens %s woorden bevatten.",
7
+ maxwords: "Deze waarde mag maximaal %s woorden bevatten.",
8
+ words: "Deze waarde moet tussen de %s en %s woorden bevatten.",
9
+ gt: "Deze waarde moet groter dan %s zijn.",
10
+ lt: "Deze waarde moet kleiner dan %s zijn."
11
+ });
@@ -4,36 +4,25 @@ window.ParsleyConfig.i18n = window.ParsleyConfig.i18n || {};
4
4
 
5
5
  // Define then the messages
6
6
  window.ParsleyConfig.i18n.nl = $.extend(window.ParsleyConfig.i18n.nl || {}, {
7
- // parsley //////////////////////////////////////
8
- defaultMessage: "Deze waarde lijkt onjuist."
9
- , type: {
10
- email: "Dit lijkt geen geldig e-mail adres te zijn."
11
- , url: "Dit lijkt geen geldige URL te zijn."
12
- , urlstrict: "Dit is geen geldige URL."
13
- , number: "Deze waarde moet een nummer zijn."
14
- , integer: "Deze waarde moet een nummer zijn."
15
- , digits: "Deze waarde moet numeriek zijn."
16
- , dateIso: "Deze waarde moet een datum in het volgende formaat zijn: (YYYY-MM-DD)."
17
- , alphanum: "Deze waarde moet alfanumeriek zijn."
18
- }
19
- , notnull: "Deze waarde mag niet leeg zijn."
20
- , notblank: "Deze waarde mag niet leeg zijn."
21
- , required: "Dit veld is verplicht"
22
- , regexp: "Deze waarde lijkt onjuist te zijn."
23
- , min: "Deze waarde mag niet lager zijn dan %s."
24
- , max: "Deze waarde mag niet groter zijn dan %s."
25
- , range: "Deze waarde moet tussen %s en %s liggen."
26
- , minlength: "Deze tekst is te kort. Deze moet uit minimaal %s karakters bestaan."
27
- , maxlength: "Deze waarde is te lang. Deze mag maximaal %s karakters lang zijn."
28
- , rangelength: "Deze waarde moet tussen %s en %s karakters lang zijn."
29
- , equalto: "Deze waardes moeten identiek zijn."
30
-
31
- // parsley.extend ///////////////////////////////
32
- , minwords: "Deze waarde moet minstens %s woorden bevatten."
33
- , maxwords: "Deze waarde mag maximaal %s woorden bevatten."
34
- , rangewords: "Deze waarde moet tussen de %s en %s woorden bevatten."
35
- , greaterthan: "Deze waarde moet groter dan %s zijn."
36
- , lessthan: "Deze waarde moet kleiner dan %s zijn."
7
+ defaultMessage: "Deze waarde lijkt onjuist.",
8
+ type: {
9
+ email: "Dit lijkt geen geldig e-mail adres te zijn.",
10
+ url: "Dit lijkt geen geldige URL te zijn.",
11
+ number: "Deze waarde moet een nummer zijn.",
12
+ integer: "Deze waarde moet een nummer zijn.",
13
+ digits: "Deze waarde moet numeriek zijn.",
14
+ alphanum: "Deze waarde moet alfanumeriek zijn."
15
+ },
16
+ notblank: "Deze waarde mag niet leeg zijn.",
17
+ required: "Dit veld is verplicht.",
18
+ pattern: "Deze waarde lijkt onjuist te zijn.",
19
+ min: "Deze waarde mag niet lager zijn dan %s.",
20
+ max: "Deze waarde mag niet groter zijn dan %s.",
21
+ range: "Deze waarde moet tussen %s en %s liggen.",
22
+ minlength: "Deze tekst is te kort. Deze moet uit minimaal %s karakters bestaan.",
23
+ maxlength: "Deze waarde is te lang. Deze mag maximaal %s karakters lang zijn.",
24
+ length: "Deze waarde moet tussen %s en %s karakters lang zijn.",
25
+ equalto: "Deze waardes moeten identiek zijn."
37
26
  });
38
27
 
39
28
  // If file is loaded after Parsley main file, auto-load locale
@@ -2,5 +2,8 @@ window.ParsleyConfig = window.ParsleyConfig || {};
2
2
  window.ParsleyConfig.i18n = window.ParsleyConfig.i18n || {};
3
3
 
4
4
  window.ParsleyConfig.i18n.ru = $.extend(window.ParsleyConfig.i18n.ru || {}, {
5
- dateiso: "Это значение должно быть корректной датой (ГГГГ-ММ-ДД)."
5
+ dateiso: "Это значение должно быть корректной датой (ГГГГ-ММ-ДД).",
6
+ minwords: "Это значение должно содержать не менее %s слов.",
7
+ maxwords: "Это значение должно содержать не более %s слов.",
8
+ words: "Это значение должно содержать от %s до %s слов."
6
9
  });
@@ -23,10 +23,10 @@ window.ParsleyConfig.i18n.ru = $.extend(window.ParsleyConfig.i18n.ru || {}, {
23
23
  pattern: "Это значение некорректно.",
24
24
  min: "Это значение должно быть не менее чем %s.",
25
25
  max: "Это значение должно быть не более чем %s.",
26
- range: "Это значение должно быть в интервале от %s до %s.",
27
- minlength: "Введите не менее %s символов.",
28
- maxlength: "Введите не более %s символов.",
29
- length: "Длина строки должна быть от %s до %s символов.",
26
+ range: "Это значение должно быть от %s до %s.",
27
+ minlength: "Это значение должно содержать не менее %s символов.",
28
+ maxlength: "Это значение должно содержать не более %s символов.",
29
+ length: "Это значение должно содержать от %s до %s символов.",
30
30
  mincheck: "Выберите не менее %s значений.",
31
31
  maxcheck: "Выберите не более %s значений.",
32
32
  check: "Выберите от %s до %s значений.",
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Parsleyjs
3
3
  * Guillaume Potier - <guillaume@wisembly.com>
4
- * Version 2.0.5 - built Thu Aug 28 2014 11:27:36
4
+ * Version 2.0.6 - built Tue Dec 02 2014 17:12:12
5
5
  * MIT Licensed
6
6
  *
7
7
  */
@@ -1001,11 +1001,11 @@ var Validator = ( function ( ) {
1001
1001
  },
1002
1002
  maxlength: function (value) {
1003
1003
  return $.extend(new Validator.Assert().Length({ max: value }), {
1004
- priority: 30,
1005
- requirementsTransformer: function () {
1004
+ priority: 30,
1005
+ requirementsTransformer: function () {
1006
1006
  return 'string' === typeof value && !isNaN(value) ? parseInt(value, 10) : value;
1007
1007
  }
1008
- });
1008
+ });
1009
1009
  },
1010
1010
  length: function (array) {
1011
1011
  return $.extend(new Validator.Assert().Length({ min: array[0], max: array[1] }), { priority: 32 });
@@ -1343,9 +1343,10 @@ var Validator = ( function ( ) {
1343
1343
  if ('ParsleyForm' === parsleyInstance.__class__)
1344
1344
  return;
1345
1345
  // Reset all errors' li
1346
- parsleyInstance._ui.$errorsWrapper.children().each(function () {
1347
- $(this).remove();
1348
- });
1346
+ parsleyInstance._ui.$errorsWrapper
1347
+ .removeClass('filled')
1348
+ .children()
1349
+ .remove();
1349
1350
  // Reset validation class
1350
1351
  this._resetClass(parsleyInstance);
1351
1352
  // Reset validation flags and last validation result
@@ -1465,7 +1466,7 @@ var Validator = ( function ( ) {
1465
1466
  },
1466
1467
  _isFieldInGroup: function (field, group) {
1467
1468
  if(ParsleyUtils.isArray(field.options.group))
1468
- return -1 !== $.inArray(field.options.group, group);
1469
+ return -1 !== $.inArray(group, field.options.group);
1469
1470
  return field.options.group === group;
1470
1471
  },
1471
1472
  _refreshFields: function () {
@@ -1556,11 +1557,13 @@ var Validator = ( function ( ) {
1556
1557
  this.refreshConstraints();
1557
1558
  // Sort priorities to validate more important first
1558
1559
  var priorities = this._getConstraintsSortedPriorities();
1560
+ if (0 === priorities.length)
1561
+ return this.validationResult = [];
1559
1562
  // Value could be passed as argument, needed to add more power to 'parsley:field:validate'
1560
1563
  value = value || this.getValue();
1561
1564
  // If a field is empty and not required, leave it alone, it's just fine
1562
1565
  // Except if `data-parsley-validate-if-empty` explicitely added, useful for some custom validators
1563
- if (0 === value.length && !this._isRequired() && 'undefined' === typeof this.options.validateIfEmpty && true !== force)
1566
+ if (!value.length && !this._isRequired() && 'undefined' === typeof this.options.validateIfEmpty && true !== force)
1564
1567
  return this.validationResult = [];
1565
1568
  // If we want to validate field against all constraints, just call Validator and let it do the job
1566
1569
  if (false === this.options.priorityEnabled)
@@ -1620,6 +1623,7 @@ var Validator = ( function ( ) {
1620
1623
  this.constraints.splice(i, 1);
1621
1624
  break;
1622
1625
  }
1626
+ delete this.constraintsByName[name];
1623
1627
  return this;
1624
1628
  },
1625
1629
  // Update a constraint (Remove + re-add)
@@ -1631,12 +1635,15 @@ var Validator = ( function ( ) {
1631
1635
  // Internal only.
1632
1636
  // Bind constraints from config + options + DOM
1633
1637
  _bindConstraints: function () {
1634
- var constraints = [];
1638
+ var constraints = [], constraintsByName = {};
1635
1639
  // clean all existing DOM constraints to only keep javascript user constraints
1636
1640
  for (var i = 0; i < this.constraints.length; i++)
1637
- if (false === this.constraints[i].isDomConstraint)
1641
+ if (false === this.constraints[i].isDomConstraint) {
1638
1642
  constraints.push(this.constraints[i]);
1643
+ constraintsByName[this.constraints[i].name] = this.constraints[i];
1644
+ }
1639
1645
  this.constraints = constraints;
1646
+ this.constraintsByName = constraintsByName;
1640
1647
  // then re-add Parsley DOM-API constraints
1641
1648
  for (var name in this.options)
1642
1649
  this.addConstraint(name, this.options[name]);
@@ -1665,12 +1672,17 @@ var Validator = ( function ( ) {
1665
1672
  var type = this.$element.attr('type');
1666
1673
  if ('undefined' === typeof type)
1667
1674
  return this;
1668
- // Small special case here for HTML5 number, that is in fact an integer validator
1669
- if ('number' === type)
1670
- return this.addConstraint('type', 'integer', undefined, true);
1675
+ // Small special case here for HTML5 number: integer validator if step attribute is undefined or an integer value, number otherwise
1676
+ if ('number' === type) {
1677
+ if (('undefined' === typeof this.$element.attr('step')) || (0 === parseFloat(this.$element.attr('step')) % 1)) {
1678
+ return this.addConstraint('type', 'integer', undefined, true);
1679
+ } else {
1680
+ return this.addConstraint('type', 'number', undefined, true);
1681
+ }
1671
1682
  // Regular other HTML5 supported types
1672
- else if (new RegExp(type, 'i').test('email url range'))
1683
+ } else if (new RegExp(type, 'i').test('email url range')) {
1673
1684
  return this.addConstraint('type', type, undefined, true);
1685
+ }
1674
1686
  return this;
1675
1687
  },
1676
1688
  // Internal only.
@@ -1863,7 +1875,7 @@ window.ParsleyConfig.i18n.en = $.extend(window.ParsleyConfig.i18n.en || {}, {
1863
1875
  if ('undefined' !== typeof window.ParsleyValidator)
1864
1876
  window.ParsleyValidator.addCatalog('en', window.ParsleyConfig.i18n.en, true);
1865
1877
 
1866
- // Parsley.js 2.0.5
1878
+ // Parsley.js 2.0.6
1867
1879
  // http://parsleyjs.org
1868
1880
  // (c) 20012-2014 Guillaume Potier, Wisembly
1869
1881
  // Parsley may be freely distributed under the MIT license.
@@ -1871,7 +1883,7 @@ if ('undefined' !== typeof window.ParsleyValidator)
1871
1883
  // ### Parsley factory
1872
1884
  var Parsley = function (element, options, parsleyFormInstance) {
1873
1885
  this.__class__ = 'Parsley';
1874
- this.__version__ = '2.0.5';
1886
+ this.__version__ = '2.0.6';
1875
1887
  this.__id__ = ParsleyUtils.hash(4);
1876
1888
  // Parsley must be instanciated with a DOM element or jQuery $element
1877
1889
  if ('undefined' === typeof element)
@@ -1934,7 +1946,7 @@ if ('undefined' !== typeof window.ParsleyValidator)
1934
1946
  return this;
1935
1947
  }
1936
1948
  // Remove special chars
1937
- multiple = multiple.replace(/(:|\.|\[|\]|\$)/g, '');
1949
+ multiple = multiple.replace(/(:|\.|\[|\]|\{|\}|\$)/g, '');
1938
1950
  // Add proper `data-parsley-multiple` to siblings if we have a valid multiple name
1939
1951
  if ('undefined' !== typeof name) {
1940
1952
  $('input[name="' + name + '"]').each(function () {
@@ -2054,7 +2066,7 @@ if ('undefined' !== typeof window.ParsleyValidator)
2054
2066
  // ### PARSLEY auto-binding
2055
2067
  // Prevent it by setting `ParsleyConfig.autoBind` to `false`
2056
2068
  if (false !== ParsleyUtils.get(window, 'ParsleyConfig.autoBind'))
2057
- $(document).ready(function () {
2069
+ $(function () {
2058
2070
  // Works only on `data-parsley-validate`.
2059
2071
  if ($('[data-parsley-validate]').length)
2060
2072
  $('[data-parsley-validate]').parsley();
@@ -9,7 +9,7 @@ window.ParsleyExtend = $.extend(window.ParsleyExtend, {
9
9
  asyncSupport: true,
10
10
 
11
11
  asyncValidators: $.extend({
12
- default: {
12
+ 'default': {
13
13
  fn: function (xhr) {
14
14
  return 'resolved' === xhr.state();
15
15
  },
@@ -170,7 +170,7 @@ window.ParsleyExtend = $.extend(window.ParsleyExtend, {
170
170
  data = {},
171
171
  ajaxOptions,
172
172
  csr,
173
- validator = this.options.remoteValidator || (true === this.options.remoteReverse ? 'reverse' : 'default');
173
+ validator = this.options.remoteValidator || (true === this.options.remoteReverse ? 'reverse' : 'default');
174
174
 
175
175
  validator = validator.toLowerCase();
176
176
 
@@ -259,7 +259,7 @@ window.ParsleyConfig.validators.remote = {
259
259
  /*!
260
260
  * Parsleyjs
261
261
  * Guillaume Potier - <guillaume@wisembly.com>
262
- * Version 2.0.5 - built Thu Aug 28 2014 11:27:36
262
+ * Version 2.0.6 - built Tue Dec 02 2014 17:12:12
263
263
  * MIT Licensed
264
264
  *
265
265
  */
@@ -1259,11 +1259,11 @@ var Validator = ( function ( ) {
1259
1259
  },
1260
1260
  maxlength: function (value) {
1261
1261
  return $.extend(new Validator.Assert().Length({ max: value }), {
1262
- priority: 30,
1263
- requirementsTransformer: function () {
1262
+ priority: 30,
1263
+ requirementsTransformer: function () {
1264
1264
  return 'string' === typeof value && !isNaN(value) ? parseInt(value, 10) : value;
1265
1265
  }
1266
- });
1266
+ });
1267
1267
  },
1268
1268
  length: function (array) {
1269
1269
  return $.extend(new Validator.Assert().Length({ min: array[0], max: array[1] }), { priority: 32 });
@@ -1601,9 +1601,10 @@ var Validator = ( function ( ) {
1601
1601
  if ('ParsleyForm' === parsleyInstance.__class__)
1602
1602
  return;
1603
1603
  // Reset all errors' li
1604
- parsleyInstance._ui.$errorsWrapper.children().each(function () {
1605
- $(this).remove();
1606
- });
1604
+ parsleyInstance._ui.$errorsWrapper
1605
+ .removeClass('filled')
1606
+ .children()
1607
+ .remove();
1607
1608
  // Reset validation class
1608
1609
  this._resetClass(parsleyInstance);
1609
1610
  // Reset validation flags and last validation result
@@ -1723,7 +1724,7 @@ var Validator = ( function ( ) {
1723
1724
  },
1724
1725
  _isFieldInGroup: function (field, group) {
1725
1726
  if(ParsleyUtils.isArray(field.options.group))
1726
- return -1 !== $.inArray(field.options.group, group);
1727
+ return -1 !== $.inArray(group, field.options.group);
1727
1728
  return field.options.group === group;
1728
1729
  },
1729
1730
  _refreshFields: function () {
@@ -1814,11 +1815,13 @@ var Validator = ( function ( ) {
1814
1815
  this.refreshConstraints();
1815
1816
  // Sort priorities to validate more important first
1816
1817
  var priorities = this._getConstraintsSortedPriorities();
1818
+ if (0 === priorities.length)
1819
+ return this.validationResult = [];
1817
1820
  // Value could be passed as argument, needed to add more power to 'parsley:field:validate'
1818
1821
  value = value || this.getValue();
1819
1822
  // If a field is empty and not required, leave it alone, it's just fine
1820
1823
  // Except if `data-parsley-validate-if-empty` explicitely added, useful for some custom validators
1821
- if (0 === value.length && !this._isRequired() && 'undefined' === typeof this.options.validateIfEmpty && true !== force)
1824
+ if (!value.length && !this._isRequired() && 'undefined' === typeof this.options.validateIfEmpty && true !== force)
1822
1825
  return this.validationResult = [];
1823
1826
  // If we want to validate field against all constraints, just call Validator and let it do the job
1824
1827
  if (false === this.options.priorityEnabled)
@@ -1878,6 +1881,7 @@ var Validator = ( function ( ) {
1878
1881
  this.constraints.splice(i, 1);
1879
1882
  break;
1880
1883
  }
1884
+ delete this.constraintsByName[name];
1881
1885
  return this;
1882
1886
  },
1883
1887
  // Update a constraint (Remove + re-add)
@@ -1889,12 +1893,15 @@ var Validator = ( function ( ) {
1889
1893
  // Internal only.
1890
1894
  // Bind constraints from config + options + DOM
1891
1895
  _bindConstraints: function () {
1892
- var constraints = [];
1896
+ var constraints = [], constraintsByName = {};
1893
1897
  // clean all existing DOM constraints to only keep javascript user constraints
1894
1898
  for (var i = 0; i < this.constraints.length; i++)
1895
- if (false === this.constraints[i].isDomConstraint)
1899
+ if (false === this.constraints[i].isDomConstraint) {
1896
1900
  constraints.push(this.constraints[i]);
1901
+ constraintsByName[this.constraints[i].name] = this.constraints[i];
1902
+ }
1897
1903
  this.constraints = constraints;
1904
+ this.constraintsByName = constraintsByName;
1898
1905
  // then re-add Parsley DOM-API constraints
1899
1906
  for (var name in this.options)
1900
1907
  this.addConstraint(name, this.options[name]);
@@ -1923,12 +1930,17 @@ var Validator = ( function ( ) {
1923
1930
  var type = this.$element.attr('type');
1924
1931
  if ('undefined' === typeof type)
1925
1932
  return this;
1926
- // Small special case here for HTML5 number, that is in fact an integer validator
1927
- if ('number' === type)
1928
- return this.addConstraint('type', 'integer', undefined, true);
1933
+ // Small special case here for HTML5 number: integer validator if step attribute is undefined or an integer value, number otherwise
1934
+ if ('number' === type) {
1935
+ if (('undefined' === typeof this.$element.attr('step')) || (0 === parseFloat(this.$element.attr('step')) % 1)) {
1936
+ return this.addConstraint('type', 'integer', undefined, true);
1937
+ } else {
1938
+ return this.addConstraint('type', 'number', undefined, true);
1939
+ }
1929
1940
  // Regular other HTML5 supported types
1930
- else if (new RegExp(type, 'i').test('email url range'))
1941
+ } else if (new RegExp(type, 'i').test('email url range')) {
1931
1942
  return this.addConstraint('type', type, undefined, true);
1943
+ }
1932
1944
  return this;
1933
1945
  },
1934
1946
  // Internal only.
@@ -2121,7 +2133,7 @@ window.ParsleyConfig.i18n.en = $.extend(window.ParsleyConfig.i18n.en || {}, {
2121
2133
  if ('undefined' !== typeof window.ParsleyValidator)
2122
2134
  window.ParsleyValidator.addCatalog('en', window.ParsleyConfig.i18n.en, true);
2123
2135
 
2124
- // Parsley.js 2.0.5
2136
+ // Parsley.js 2.0.6
2125
2137
  // http://parsleyjs.org
2126
2138
  // (c) 20012-2014 Guillaume Potier, Wisembly
2127
2139
  // Parsley may be freely distributed under the MIT license.
@@ -2129,7 +2141,7 @@ if ('undefined' !== typeof window.ParsleyValidator)
2129
2141
  // ### Parsley factory
2130
2142
  var Parsley = function (element, options, parsleyFormInstance) {
2131
2143
  this.__class__ = 'Parsley';
2132
- this.__version__ = '2.0.5';
2144
+ this.__version__ = '2.0.6';
2133
2145
  this.__id__ = ParsleyUtils.hash(4);
2134
2146
  // Parsley must be instanciated with a DOM element or jQuery $element
2135
2147
  if ('undefined' === typeof element)
@@ -2192,7 +2204,7 @@ if ('undefined' !== typeof window.ParsleyValidator)
2192
2204
  return this;
2193
2205
  }
2194
2206
  // Remove special chars
2195
- multiple = multiple.replace(/(:|\.|\[|\]|\$)/g, '');
2207
+ multiple = multiple.replace(/(:|\.|\[|\]|\{|\}|\$)/g, '');
2196
2208
  // Add proper `data-parsley-multiple` to siblings if we have a valid multiple name
2197
2209
  if ('undefined' !== typeof name) {
2198
2210
  $('input[name="' + name + '"]').each(function () {
@@ -2312,7 +2324,7 @@ if ('undefined' !== typeof window.ParsleyValidator)
2312
2324
  // ### PARSLEY auto-binding
2313
2325
  // Prevent it by setting `ParsleyConfig.autoBind` to `false`
2314
2326
  if (false !== ParsleyUtils.get(window, 'ParsleyConfig.autoBind'))
2315
- $(document).ready(function () {
2327
+ $(function () {
2316
2328
  // Works only on `data-parsley-validate`.
2317
2329
  if ($('[data-parsley-validate]').length)
2318
2330
  $('[data-parsley-validate]').parsley();
@@ -15,7 +15,7 @@ textarea.parsley-error {
15
15
  }
16
16
 
17
17
  .parsley-errors-list {
18
- margin: 2px 0 3px 0;
18
+ margin: 2px 0 3px;
19
19
  padding: 0;
20
20
  list-style-type: none;
21
21
  font-size: 0.9em;
@@ -26,7 +26,6 @@ textarea.parsley-error {
26
26
 
27
27
  transition: all .3s ease-in;
28
28
  -o-transition: all .3s ease-in;
29
- -ms-transition: all .3s ease-in;
30
29
  -moz-transition: all .3s ease-in;
31
30
  -webkit-transition: all .3s ease-in;
32
31
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parsley-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.5.0
4
+ version: 2.0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jiri Pospisil
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-01 00:00:00.000000000 Z
11
+ date: 2014-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -59,6 +59,10 @@ files:
59
59
  - vendor/assets/javascripts/parsley.i18n.it.extra.js
60
60
  - vendor/assets/javascripts/parsley.i18n.it.js
61
61
  - vendor/assets/javascripts/parsley.i18n.ja.js
62
+ - vendor/assets/javascripts/parsley.i18n.ko.js
63
+ - vendor/assets/javascripts/parsley.i18n.ms_MY.extra.js
64
+ - vendor/assets/javascripts/parsley.i18n.ms_MY.js
65
+ - vendor/assets/javascripts/parsley.i18n.nl.extra.js
62
66
  - vendor/assets/javascripts/parsley.i18n.nl.js
63
67
  - vendor/assets/javascripts/parsley.i18n.pl.js
64
68
  - vendor/assets/javascripts/parsley.i18n.pt-br.js
@@ -98,4 +102,3 @@ signing_key:
98
102
  specification_version: 4
99
103
  summary: Parsley.js bundled for Rails Asset Pipeline
100
104
  test_files: []
101
- has_rdoc: