guardsjs-rails 1.1.0 → 1.2.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 72981352511130c6aaf04be921425664000da019
4
+ data.tar.gz: bd4422e7f74f30395cb83a9cd92db5389b42ff71
5
+ SHA512:
6
+ metadata.gz: cde1c3d54ae73b52be50ad3ebafcf35111393647e524603340f7810be72943b7fd25d332e47f16eb9feda02b9d60f08995e5b4a665f958948ee317736b6e9183
7
+ data.tar.gz: 51794b18c806eea94134d418e0f05ba69c56e37ca9982d123308e606c5727a3bad4819f8c7506c798b6f9adf081932191024e33b394bd6f20fd2d76910dbf765
@@ -1,5 +1,5 @@
1
1
  module GuardsJS
2
2
  module Rails
3
- VERSION = "1.1.0"
3
+ VERSION = "1.2.0"
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Guards JavaScript jQuery Plugin v1.1.0
2
+ * Guards JavaScript jQuery Plugin v1.2.0
3
3
  * https://github.com/on-site/guards.js
4
4
  *
5
5
  * Copyright 2010-2013, On-Site.com, http://www.on-site.com/
@@ -8,7 +8,7 @@
8
8
  * Includes code for email and phone number validation from the jQuery
9
9
  * Validation plugin. http://docs.jquery.com/Plugins/Validation
10
10
  *
11
- * Date: Fri Jun 28 00:51:31 2013 -0700
11
+ * Date: Wed Sep 18 02:45:55 2013 -0700
12
12
  */
13
13
 
14
14
  /**
@@ -48,7 +48,7 @@
48
48
  return $.guards.add(selector);
49
49
  };
50
50
 
51
- $.guard.version = "1.1.0";
51
+ $.guard.version = "1.2.0";
52
52
 
53
53
  $.Guards = function() {
54
54
  var self = this;
@@ -540,6 +540,30 @@
540
540
  */
541
541
  this.name("phoneUS").using(this.aggregate(this.isAllValid, this.isValidPhoneUS)).message("Please enter a valid phone number.");
542
542
 
543
+ /**
544
+ * @page Named Guards
545
+ * @section regex
546
+ * @since 1.2.0
547
+ *
548
+ * <p>
549
+ * These guarded fields must match the provided regex to pass. An empty value is considered valid.
550
+ * </p>
551
+ *
552
+ * <div class="example">
553
+ * <div class="display">
554
+ * <script>
555
+ * $.guard(".regex1").using("regex", /^abc\d{1,3}$/);
556
+ * </script>
557
+ *
558
+ * <p>
559
+ * <input class="regex1" type="text" /><br />
560
+ * <small>abc with 1-3 digits is required, like 'abc123'</small>
561
+ * </p>
562
+ * </div>
563
+ * </div>
564
+ */
565
+ this.name("regex").using(this.aggregate(this.isAllValid, this.matchesRegex)).message("Please enter valid input.");
566
+
543
567
  /**
544
568
  * @page Named Guards
545
569
  * @section required
@@ -650,7 +674,7 @@
650
674
  * This version of guards.js library as a string, like <code>"1.0.0"</code>.
651
675
  * </p>
652
676
  */
653
- $.Guards.prototype.version = "1.1.0";
677
+ $.Guards.prototype.version = "1.2.0";
654
678
 
655
679
  $.Guards.prototype.parentContext = function(element) {
656
680
  var $element = $(element);
@@ -1268,6 +1292,17 @@
1268
1292
  return this.isValidInt("" + value.length, options);
1269
1293
  };
1270
1294
 
1295
+ /**
1296
+ * Validates the given value matches the given regex.
1297
+ */
1298
+ $.Guards.prototype.matchesRegex = function(value, regex) {
1299
+ if ($.type(regex) != "regexp") {
1300
+ throw new Error("The regex must be provided as an option!");
1301
+ }
1302
+
1303
+ return value === "" || regex.test(value);
1304
+ };
1305
+
1271
1306
  /**
1272
1307
  * This guard test method is intended to never fail, thus it
1273
1308
  * returns true no matter what. It is intended to be used to set
metadata CHANGED
@@ -1,22 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guardsjs-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
5
- prerelease:
4
+ version: 1.2.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Mike Virata-Stone
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-06-28 00:00:00.000000000 Z
11
+ date: 2013-09-18 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: railties
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '3.0'
22
20
  - - <
@@ -25,9 +23,8 @@ dependencies:
25
23
  type: :runtime
26
24
  prerelease: false
27
25
  version_requirements: !ruby/object:Gem::Requirement
28
- none: false
29
26
  requirements:
30
- - - ! '>='
27
+ - - '>='
31
28
  - !ruby/object:Gem::Version
32
29
  version: '3.0'
33
30
  - - <
@@ -41,34 +38,30 @@ executables: []
41
38
  extensions: []
42
39
  extra_rdoc_files: []
43
40
  files:
44
- - lib/guardsjs-rails/version.rb
45
41
  - lib/guardsjs-rails.rb
42
+ - lib/guardsjs-rails/version.rb
46
43
  - vendor/assets/javascripts/guards.js
47
44
  homepage: http://guardsjs.com/
48
45
  licenses: []
46
+ metadata: {}
49
47
  post_install_message:
50
48
  rdoc_options: []
51
49
  require_paths:
52
50
  - lib
53
51
  required_ruby_version: !ruby/object:Gem::Requirement
54
- none: false
55
52
  requirements:
56
- - - ! '>='
53
+ - - '>='
57
54
  - !ruby/object:Gem::Version
58
55
  version: '0'
59
- segments:
60
- - 0
61
- hash: 1471807923169786715
62
56
  required_rubygems_version: !ruby/object:Gem::Requirement
63
- none: false
64
57
  requirements:
65
- - - ! '>='
58
+ - - '>='
66
59
  - !ruby/object:Gem::Version
67
60
  version: '0'
68
61
  requirements: []
69
62
  rubyforge_project:
70
- rubygems_version: 1.8.24
63
+ rubygems_version: 2.0.3
71
64
  signing_key:
72
- specification_version: 3
65
+ specification_version: 4
73
66
  summary: Rails asset gem for guards.js.
74
67
  test_files: []