parsley-rails 1.1.10.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in parsley-rails.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Jiri Pospisil
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Parsley.js for Rails Asset Pipeline
2
+
3
+ [Parsley.js](https://github.com/guillaumepotier/Parsley.js) is an awesome form validation library ([documentation](http://parsleyjs.org/documentation.html)).
4
+ This gem makes it easy to use it with Rails Asset Pipeline.
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ gem "parsley-rails"
11
+
12
+ And then execute:
13
+
14
+ $ bundle
15
+
16
+ ## Usage
17
+
18
+ Add the following to your `app/assets/javascripts/application.js`:
19
+
20
+ //= require jquery
21
+ //= require parsley
22
+
23
+ To use the `extend` library, add this right after:
24
+
25
+ //= require parsley.extend
26
+
27
+ Finally, if you want to use a different i18n:
28
+
29
+ //= require parsley.i18n.fr
30
+
31
+ See complete [Parsley.js documentation](http://parsleyjs.org/documentation.html).
32
+
33
+ ## Contributing
34
+
35
+ 1. Fork it
36
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
37
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
38
+ 4. Push to the branch (`git push origin my-new-feature`)
39
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,8 @@
1
+ require "parsley-rails/version"
2
+
3
+ module Parsley
4
+ module Rails
5
+ class Engine < ::Rails::Engine
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,5 @@
1
+ module Parsley
2
+ module Rails
3
+ VERSION = "1.1.10.0"
4
+ end
5
+ end
@@ -0,0 +1,17 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'parsley-rails/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "parsley-rails"
8
+ gem.version = Parsley::Rails::VERSION
9
+ gem.authors = ["Jiri Pospisil"]
10
+ gem.email = ["mekishizufu@gmail.com"]
11
+ gem.description = %q{Parsley.js bundled for Rails Asset Pipeline}
12
+ gem.summary = %q{Parsley.js bundled for Rails Asset Pipeline}
13
+ gem.homepage = "https://github.com/mekishizufu/parsley-rails"
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.require_paths = ["lib"]
17
+ end
data/update.sh ADDED
@@ -0,0 +1,31 @@
1
+ #!/bin/sh
2
+
3
+ set -e
4
+
5
+ if [ $# -eq 0 ]; then
6
+ echo "No tag supplied. Usage: ./update.sh 1.1.10"
7
+ exit 1
8
+ fi
9
+
10
+ TAG=$1
11
+ EXTRACT_DIRECTORY="$$$(date "+%Y%m%d%H%M%S")"
12
+ FILE_NAME="$EXTRACT_DIRECTORY.tar.gz"
13
+ RELEASE_URL="https://github.com/guillaumepotier/Parsley.js/archive/$TAG.tar.gz"
14
+ RELEASE_PATH="$EXTRACT_DIRECTORY/Parsley.js-$TAG"
15
+
16
+ VENDOR_PATH="vendor/assets/javascripts"
17
+
18
+ wget -O $FILE_NAME $RELEASE_URL
19
+ mkdir $EXTRACT_DIRECTORY
20
+ tar xfz $FILE_NAME -C $EXTRACT_DIRECTORY
21
+
22
+ cp "$RELEASE_PATH/parsley.js" $VENDOR_PATH
23
+ cp "$RELEASE_PATH/parsley.extend.js" $VENDOR_PATH
24
+
25
+ for file in "$RELEASE_PATH/i18n/"*; do
26
+ base_name=${file##*/}
27
+ final_name="parsley.i18n.$(echo $base_name | cut -d "." -f2).js"
28
+ cp $file "$VENDOR_PATH/$final_name"
29
+ done
30
+
31
+ rm -rf $FILE_NAME $EXTRACT_DIRECTORY
@@ -0,0 +1,53 @@
1
+ window.ParsleyConfig = window.ParsleyConfig || {};
2
+
3
+ (function ($) {
4
+ window.ParsleyConfig = $.extend( true, {}, window.ParsleyConfig, {
5
+ validators: {
6
+ minwords: function ( val, nbWords ) {
7
+ val = val.replace( /(^\s*)|(\s*$)/gi, "" );
8
+ val = val.replace( /[ ]{2,}/gi, " " );
9
+ val = val.replace( /\n /, "\n" );
10
+ val = val.split(' ').length;
11
+
12
+ return val >= nbWords;
13
+ }
14
+
15
+ , maxwords : function ( val, nbWords ) {
16
+ val = val.replace( /(^\s*)|(\s*$)/gi, "" );
17
+ val = val.replace( /[ ]{2,}/gi, " " );
18
+ val = val.replace( /\n /, "\n" );
19
+ val = val.split(' ').length;
20
+
21
+ return val <= nbWords;
22
+ }
23
+
24
+ , rangewords: function ( val, obj ) {
25
+ val = val.replace( /(^\s*)|(\s*$)/gi, "" );
26
+ val = val.replace( /[ ]{2,}/gi, " " );
27
+ val = val.replace( /\n /, "\n" );
28
+ val = val.split(' ').length;
29
+
30
+ return val >= obj[0] && val <= obj[1];
31
+ }
32
+
33
+ , greaterthan: function ( val, elem, self ) {
34
+ self.options.validateIfUnchanged = true;
35
+
36
+ return new Number(val) > new Number($( elem ).val());
37
+ }
38
+
39
+ , lessthan: function ( val, elem, self ) {
40
+ self.options.validateIfUnchanged = true;
41
+
42
+ return new Number(val) < new Number($( elem ).val());
43
+ }
44
+ }
45
+ , messages: {
46
+ minwords: "This value should have %s words at least."
47
+ , maxwords: "This value should have %s words maximum."
48
+ , rangewords: "This value should have between %s and %s words."
49
+ , greaterthan: "This value should be greater than %s."
50
+ , lessthan: "This value should be less than %s."
51
+ }
52
+ });
53
+ }(window.jQuery || window.Zepto));
@@ -0,0 +1,39 @@
1
+ window.ParsleyConfig = window.ParsleyConfig || {};
2
+
3
+ (function ($) {
4
+ window.ParsleyConfig = $.extend( true, {}, window.ParsleyConfig, {
5
+ messages: {
6
+ // parsley //////////////////////////////////////
7
+ defaultMessage: "Mae'r gwerth hwn yn ymddangos i fod yn annilys."
8
+ , type: {
9
+ email: "Dylai'r gwerth hwn fod yn e-bost dilys."
10
+ , url: "Dylai'r gwerth hwn fod yn url dilys."
11
+ , urlstrict: "Dylai'r gwerth hwn fod yn url dilys."
12
+ , number: "Dylai'r gwerth hwn fod yn rhif dilys."
13
+ , digits: "Dylai'r gwerth hwn fod yn werth digidau."
14
+ , dateIso: "Dylai'r gwerth hwn fod yn ddyddiad dilys (YYYY-MM-DD)."
15
+ , alphanum: "Dylai hyn fod yn werth alffaniwmerig."
16
+ }
17
+ , notnull: "Ni ddylai hyn fod yn werth null."
18
+ , notblank: "Ni ddylai hyn fod yn werth gwag."
19
+ , required: "Mae'r gwerth hwn yn ofynnol."
20
+ , regexp: "Mae'r gwerth hwn yn ymddangos i fod yn annilys."
21
+ , min: "Dylai'r gwerth hwn fod yn fwy na %s."
22
+ , max: "Dylai'r gwerth hwn fod yn is na %s."
23
+ , range: "Dylai'r gwerth hwn fod rhwng s% a %s."
24
+ , minlength: "Mae'r gwerth hwn yn rhy fyr. Dylai fod yna %s neu fwy o lythrennau."
25
+ , maxlength: "Mae'r gwerth hwn yn rhy hir. Dylai fod yna %s neu llai o lythrennau"
26
+ , rangelength: "Mae'r gwerth hyd yn annilys. Dylai fod yna rhwng %s a %s o lythrennau"
27
+ , equalto: "Dylai'r gwerth hwn fod yr un fath."
28
+
29
+
30
+ // parsley.extend ///////////////////////////////
31
+ , minwords: "Dylai'r gwerth hwn cynnwys o leiaf %s gair."
32
+ , maxwords: "Dylai'r gwerth hwn cynnwys %s gair ar yr mwyaf."
33
+ , rangewords: "Dylai'r gwerth hwn cynnwys rhwng %s a %s o eiriau."
34
+ , greaterthan: "Dylai'r gwerth hwn fod yn fwy na %s."
35
+ , lessthan: "Dylai hyn gwerth yn llai na %s."
36
+
37
+ }
38
+ });
39
+ }(window.jQuery || window.Zepto));
@@ -0,0 +1,37 @@
1
+ window.ParsleyConfig = window.ParsleyConfig || {};
2
+
3
+ (function ($) {
4
+ window.ParsleyConfig = $.extend( true, {}, window.ParsleyConfig, {
5
+ messages: {
6
+ // parsley //////////////////////////////////////
7
+ defaultMessage: "Die Eingabe scheint nicht korrekt zu sein."
8
+ , type: {
9
+ email: "Die Eingabe muss eine gültige E-Mail-Adresse sein."
10
+ , url: "Die Eingabe muss eine gültige URL sein."
11
+ , urlstrict: "Die Eingabe muss eine gültige URL sein."
12
+ , number: "Die Eingabe muss eine Zahl sein."
13
+ , digits: "Die Eingabe darf nur Ziffern enthalten."
14
+ , dateIso: "Die Eingabe muss ein gültiges Datum im Format YYYY-MM-DD sein."
15
+ , alphanum: "Die Eingabe muss alphanumerisch sein."
16
+ }
17
+ , notnull: "Die Eingabe darf nicht leer sein."
18
+ , notblank: "Die Eingabe darf nicht leer sein."
19
+ , required: "Dies ist ein Pflichtfeld."
20
+ , regexp: "Die Eingabe scheint ungültig zu sein."
21
+ , min: "Die Eingabe muss größer oder gleich %s sein."
22
+ , max: "Die Eingabe muss kleiner oder gleich %s sein."
23
+ , range: "Die Eingabe muss zwischen %s und %s liegen."
24
+ , minlength: "Die Eingabe ist zu kurz. Es müssen mindestens %s Zeichen eingegeben werden."
25
+ , maxlength: "Die Eingabe ist zu lang. Es dürfen höchstens %s Zeichen eingegeben werden."
26
+ , rangelength: "Die Länge der Eingabe ist ungültig. Es müssen zwischen %s und %s Zeichen eingegeben werden."
27
+ , equalto: "Dieses Feld muss dem anderen entsprechen."
28
+
29
+ // parsley.extend ///////////////////////////////
30
+ , minwords: "Die Eingabe muss mindestens %s Wörter enthalten."
31
+ , maxwords: "Die Eingabe darf höchstens %s Wörter enthalten."
32
+ , rangewords: "Die Eingabe muss zwischen %s und %s Wörter enthalten."
33
+ , greaterthan: "Die Eingabe muss größer als %s sein."
34
+ , lessthan: "Die Eingabe muss kleiner als %s sein."
35
+ }
36
+ });
37
+ }(window.jQuery || window.Zepto));
@@ -0,0 +1,37 @@
1
+ window.ParsleyConfig = window.ParsleyConfig || {};
2
+
3
+ (function ($) {
4
+ window.ParsleyConfig = $.extend( true, {}, window.ParsleyConfig, {
5
+ messages: {
6
+ // parsley //////////////////////////////////////
7
+ defaultMessage: "Este valor parece ser inválido."
8
+ , type: {
9
+ email: "Este valor debe ser un correo válido."
10
+ , url: "Este valor debe ser una URL válida."
11
+ , urlstrict: "Este valor debe ser una URL válida."
12
+ , number: "Este valor debe ser un número válido."
13
+ , digits: "Este valor debe ser un dígito válido."
14
+ , dateIso: "Este valor debe ser una fecha válida (YYYY-MM-DD)."
15
+ , alphanum: "Este valor debe ser alfanumérico."
16
+ }
17
+ , notnull: "Este valor no debe ser nulo."
18
+ , notblank: "Este valor no debe estar en blanco."
19
+ , required: "Este valor es requerido."
20
+ , regexp: "Este valor es incorrecto."
21
+ , min: "Este valor no debe ser menor que %s."
22
+ , max: "Este valor no debe ser mayor que %s."
23
+ , range: "Este valor debe estar entre %s y %s."
24
+ , minlength: "Este valor es muy corto. La longitud mínima es de %s caracteres."
25
+ , maxlength: "Este valor es muy largo. La longitud máxima es de %s caracteres."
26
+ , rangelength: "La longitud de este valor debe estar entre %s y %s caracteres."
27
+ , equalto: "Este valor debe ser idéntico."
28
+
29
+ // parsley.extend ///////////////////////////////
30
+ , minwords: "Este valor debe tener al menos %s palabras."
31
+ , maxwords: "Este valor no debe exceder las %s palabras."
32
+ , rangewords: "Este valor debe tener entre %s y %s palabras."
33
+ , greaterthan: "Este valor no debe ser mayor que %s."
34
+ , lessthan: "Este valor no debe ser menor que %s."
35
+ }
36
+ });
37
+ }(window.jQuery || window.Zepto));
@@ -0,0 +1,40 @@
1
+ window.ParsleyConfig = window.ParsleyConfig || {};
2
+
3
+ (function ($) {
4
+ window.ParsleyConfig = $.extend( true, {}, window.ParsleyConfig, {
5
+ messages: {
6
+ // parsley //////////////////////////////////////
7
+ defaultMessage: "Tämä arvo on virheellinen."
8
+ , type: {
9
+ email: "Tämän arvo pitäisi olla sähköpostiosoite."
10
+ , url: "Tämän arvo pitäisi olla URL-osoite."
11
+ , urlstrict: "Tämän arvo pitäisi olla URL-osoite."
12
+ , number: "Tämän arvo pitäisi olla numero."
13
+ , digits: "Tämän arvo pitäisi olla numeroita."
14
+ , dateIso: "Tämän arvo pitäisi olla päivämäärä (VVVV-KK-PP)."
15
+ , alphanum: "Tämän arvo pitäisi olla alfanumeerinen."
16
+ }
17
+ , notnull: "Tämän arvo ei pitäisi olla nolla."
18
+ , notblank: "Tämän arvo ei pitäisi olla tyhjä."
19
+ , required: "Tämä arvo on pakollinen."
20
+ , regexp: "Tämä arvo vaikuttaa virheelliseltä."
21
+ , min: "Tämän arvo pitäisi olla suurempi kuin %s."
22
+ , max: "Tämän arvo pitäisi olla pienempi kuin %s."
23
+ , range: "Tämän arvo pitäisi olla lukujen %s ja %s välillä."
24
+ , minlength: "Tämän arvo on liian lyhyt. Tässä pitäisi olla %s merkkiä tai enemmän."
25
+ , maxlength: "Tämän arvo on liian pitkä. Tässä pitäisi olla %s merkkiä tai vähemmän."
26
+ , rangelength: "Tämän arvon pituus on virheellinen. Tämän pitäisi olla %s-%s merkkiä pitkä."
27
+ , equalto: "Tämän arvon pitäisi vastata toista arvoa."
28
+ , mincheck: "Sinun pitää valita vähintään %s valikoima(a)."
29
+ , maxcheck: "Sinun pitää valita %s valikoima(a) tai vähemmän."
30
+ , rangecheck: "Sinun pitää valita %s-%s valikoima(a)."
31
+
32
+ // parsley.extend ///////////////////////////////
33
+ , minwords: "Tämän arvon pitäisi sisältää vähintään %s sana(a)."
34
+ , maxwords: "Tämän arvo voi olla korkeintaan %s sana(a)."
35
+ , rangewords: "Tämän arvo pitäisi olla %s-%s sana(a)."
36
+ , greaterthan: "Tämän arvo pitäisi olla suurempi kuin %s."
37
+ , lessthan: "Tämän arvo pitäisi olla pienempi kuin %s."
38
+ }
39
+ });
40
+ }(window.jQuery || window.Zepto));
@@ -0,0 +1,40 @@
1
+ window.ParsleyConfig = window.ParsleyConfig || {};
2
+
3
+ (function ($) {
4
+ window.ParsleyConfig = $.extend( true, {}, window.ParsleyConfig, {
5
+ messages: {
6
+ // parsley //////////////////////////////////////
7
+ defaultMessage: "Cette valeur semble non valide."
8
+ , type: {
9
+ email: "Cette valeur n'est pas une adresse email valide."
10
+ , url: "Cette valeur n'est pas une URL valide."
11
+ , urlstrict: "Cette valeur n'est pas une URL valide."
12
+ , number: "Cette valeur doit être un nombre."
13
+ , digits: "Cette valeur doit être numérique."
14
+ , dateIso: "Cette valeur n'est pas une date valide (YYYY-MM-DD)."
15
+ , alphanum: "Cette valeur doit être alphanumérique."
16
+ }
17
+ , notnull: "Cette valeur ne peut pas être nulle."
18
+ , notblank: "Cette valeur ne peut pas être vide."
19
+ , required: "Ce champ est requis."
20
+ , regexp: "Cette valeur semble non valide."
21
+ , min: "Cette valeur ne doit pas être inféreure à %s."
22
+ , max: "Cette valeur ne doit pas excéder %s."
23
+ , range: "Cette valeur doit être comprise entre %s et %s."
24
+ , minlength: "Cette chaîne est trop courte. Elle doit avoir au minimum %s caractères."
25
+ , maxlength: "Cette chaîne est trop longue. Elle doit avoir au maximum %s caractères."
26
+ , rangelength: "Cette valeur doit contenir entre %s et %s caractères."
27
+ , equalto: "Cette valeur devrait être identique."
28
+ , mincheck: "Vous devez sélectionner au moins %s choix."
29
+ , maxcheck: "Vous devez sélectionner %s choix maximum."
30
+ , rangecheck: "Vous devez sélectionner entre %s et %s choix."
31
+
32
+ // parsley.extend ///////////////////////////////
33
+ , minwords: "Cette valeur doit contenir plus de %s mots."
34
+ , maxwords: "Cette valeur ne peut pas dépasser %s mots."
35
+ , rangewords: "Cette valeur doit comprendre %s à %s mots."
36
+ , greaterthan: "Cette valeur doit être plus grande que %s."
37
+ , lessthan: "Cette valeur doit être plus petite que %s."
38
+ }
39
+ });
40
+ }(window.jQuery || window.Zepto));
@@ -0,0 +1,40 @@
1
+ window.ParsleyConfig = window.ParsleyConfig || {};
2
+
3
+ (function ($) {
4
+ window.ParsleyConfig = $.extend( true, {}, window.ParsleyConfig, {
5
+ messages: {
6
+ // parsley //////////////////////////////////////
7
+ defaultMessage: "Nilai ini tidak valid."
8
+ , type: {
9
+ email: "Nilai ini harus berupa email yang valid."
10
+ , url: "Nilai ini harus berupa url yang valid."
11
+ , urlstrict: "Nilai ini harus berupa url yang valid."
12
+ , number: "Nilai ini harus berupa angka yang valid."
13
+ , digits: "Nilai ini harus berupa digit."
14
+ , dateIso: "Nilai ini harus berupa tanggal yang valid (YYYY-MM-DD)."
15
+ , alphanum: "Nilai ini harus berupa alfanumerik."
16
+ }
17
+ , notnull: "Nilai ini tidak boleh null."
18
+ , notblank: "Nilai ini tidak boleh kosong."
19
+ , required: "Nilai ini wajib diisi."
20
+ , regexp: "Nilai ini tidak valid."
21
+ , min: "Nilai ini harus lebih besar daripada %s."
22
+ , max: "Nilai ini harus lebih kecil daripada %s."
23
+ , range: "Nilai ini harus diantara %s sampai dengan %s."
24
+ , minlength: "Nilai ini terlalu pendek. Harus memiliki %s karakter atau lebih."
25
+ , maxlength: "Nilai ini terlalu panjang. Harus memiliki %s karakter atau kurang."
26
+ , rangelength: "Panjang nilai ini tidak valid. Harus memiliki panjang di antara %s sampai dengan %s karakter."
27
+ , equalto: "Nilai ini harus sama."
28
+ , mincheck: "Anda harus memilih minimal %s pilihan."
29
+ , maxcheck: "Anda harus memilih %s pilihan atau kurang."
30
+ , rangecheck: "Anda harus memilih diantara %s sampai %s pilihan."
31
+
32
+ // parsley.extend ///////////////////////////////
33
+ , minwords: "Nilai ini harus memiliki minimum %s kata."
34
+ , maxwords: "Nilai ini harus memiliki maksimum %s kata."
35
+ , rangewords: "Nilai ini harus diantara %s sampai %s kata."
36
+ , greaterthan: "Nilai ini harus lebih besar daripada %s."
37
+ , lessthan: "Nilai ini harus lebih kecil daripada %s."
38
+ }
39
+ });
40
+ }(window.jQuery || window.Zepto));