ico-validator 0.2.1 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 445efa9a4a16a63921488b1705c8466118f23919
4
- data.tar.gz: 4523e53a5c307ddddcc2fac7a8e2771add7caad6
3
+ metadata.gz: 8f5b6f7916008ebce0e7709887fb2677eec84a15
4
+ data.tar.gz: 888f0b734d86e4329e47dbc23c054176cf6954d5
5
5
  SHA512:
6
- metadata.gz: 4c4efb7ae56d1d557fbf9b73b2fd0f4db080380431cd0114b168c4ff143d6d699ed607be33add88ce374a48035d1316fc5322ef7f80ecbf6ebba23072123b022
7
- data.tar.gz: 086d4c1f60feb469964b4c1c63ead9247d621db7a7bb3d2a67d039681ac0edad4b3c8c9ea8df6f47380ae146d4c69dcb2722b8afa3dd8296a86de1a200a324b2
6
+ metadata.gz: 10227fc127a0b939b3215d5c69e37ff5afabf04755f564f476180d7e4dc6898566ee275e591baf5dbb66ceac0bf4aa68c8d51d969213e6b29c12f0938966781c
7
+ data.tar.gz: be64e02531dfb3060c8e92b2f646d6108e0a2e93fdb46b43dc89e4cd5226da0e1a2af3388b9495d3df6d8472e25461cb502899f30d3b6e0ea210365ec419613a
@@ -0,0 +1,4 @@
1
+ # Prefer single quotes
2
+ StringLiterals:
3
+ EnforcedStyle: single_quotes
4
+ Enabled: true
@@ -7,3 +7,6 @@ rvm:
7
7
  script:
8
8
  - bundle exec rspec
9
9
  - bundle exec rake jasmine:ci
10
+ addons:
11
+ code_climate:
12
+ repo_token: eebc129fa878929ebbf8f1097a518df71c73bf316dc0ae59eec048f4e3d4fdd6
@@ -1,3 +1,11 @@
1
+ ## v0.3.1
2
+
3
+ * Fire 'change' event on paste ico from clipboard and validate
4
+
5
+ ## v0.3.0
6
+
7
+ * Live validate (for dynamic forms)
8
+
1
9
  ## v0.2.1
2
10
 
3
11
  * Allow blank ICO fields
data/README.md CHANGED
@@ -1,6 +1,13 @@
1
- ico-validator [![Build Status](https://travis-ci.org/ucetnictvi-on-line/ico-validator.svg?branch=master)](https://travis-ci.org/ucetnictvi-on-line/ico-validator) [![Code Climate](https://codeclimate.com/github/ucetnictvi-on-line/ico-validator/badges/gpa.svg)](https://codeclimate.com/github/ucetnictvi-on-line/ico-validator) [![Test Coverage](https://codeclimate.com/github/ucetnictvi-on-line/ico-validator/badges/coverage.svg)](https://codeclimate.com/github/ucetnictvi-on-line/ico-validator)
1
+ ico-validator
2
2
  =============
3
3
 
4
+ [![Build Status](https://travis-ci.org/ucetnictvi-on-line/ico-validator.svg?branch=master)](https://travis-ci.org/ucetnictvi-on-line/ico-validator)
5
+ [![Dependency Status](https://gemnasium.com/ucetnictvi-on-line/ico-validator.svg)](https://gemnasium.com/ucetnictvi-on-line/ico-validator)
6
+ [![Code Climate](https://codeclimate.com/github/ucetnictvi-on-line/ico-validator/badges/gpa.svg)](https://codeclimate.com/github/ucetnictvi-on-line/ico-validator)
7
+ [![Test Coverage](https://codeclimate.com/github/ucetnictvi-on-line/ico-validator/badges/coverage.svg)](https://codeclimate.com/github/ucetnictvi-on-line/ico-validator)
8
+
9
+
10
+
4
11
  Rails validator for format of [Czech company identification number - ICO](http://cs.wikipedia.org/wiki/Identifika%C4%8Dn%C3%AD_%C4%8D%C3%ADslo_osoby)
5
12
 
6
13
  ## Usage
@@ -22,7 +22,7 @@ var ico_validator = {
22
22
  };
23
23
 
24
24
  jQuery( function($) {
25
- var ico_fields = $('.ico-validate');
25
+ var icoFields = '.ico-validate';
26
26
 
27
27
  function validate(el) {
28
28
  var value = $(el).val();
@@ -33,20 +33,31 @@ jQuery( function($) {
33
33
  }
34
34
  }
35
35
 
36
- ico_fields.on('change', function() {
36
+ $(document).on('change', icoFields, function() {
37
37
  validate(this);
38
38
  });
39
39
 
40
- ico_fields.on('keyup', function() {
40
+ $(document).on('keyup', icoFields, function() {
41
41
  validate(this);
42
42
  });
43
43
 
44
- ico_fields.closest('form').on('submit', function() {
44
+ $(document).on('paste', icoFields, function() {
45
+ var el = this;
46
+ setTimeout( function() {
47
+ validate(el);
48
+ $(el).trigger('change');
49
+ }, 10);
50
+ });
51
+
52
+ $(document).on('submit', 'form', function(e) {
45
53
  var wrong = $(this).find('.field_with_errors .ico-validate');
46
54
  if( wrong.length <= 0 ) {
47
55
  return;
48
56
  }
49
57
  wrong.focus();
58
+ e.stopPropagation();
59
+ e.preventDefault();
60
+ e.stopImmediatePropagation();
50
61
  return false;
51
62
  });
52
63
  });
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'ico-validator'
7
- spec.version = '0.2.1'
7
+ spec.version = '0.3.1'
8
8
  spec.authors = ['Premysl Donat']
9
9
  spec.email = ['donat@uol.cz']
10
10
  spec.summary = %q{Rails validator for validating format of czech identification number = IC}
@@ -1,3 +1,5 @@
1
+ require 'rails'
2
+
1
3
  module IcoValidation
2
4
  class Engine < ::Rails::Engine
3
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ico-validator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Premysl Donat
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-01 00:00:00.000000000 Z
11
+ date: 2015-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -89,6 +89,7 @@ extensions: []
89
89
  extra_rdoc_files: []
90
90
  files:
91
91
  - ".gitignore"
92
+ - ".hound.yml"
92
93
  - ".travis.yml"
93
94
  - CHANGELOG.md
94
95
  - Gemfile
@@ -127,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
127
128
  version: '0'
128
129
  requirements: []
129
130
  rubyforge_project:
130
- rubygems_version: 2.4.5
131
+ rubygems_version: 2.4.6
131
132
  signing_key:
132
133
  specification_version: 4
133
134
  summary: Rails validator for validating format of czech identification number = IC