guardsjs-rails 1.4.1 → 1.4.2

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: 4b33cce3f56194a6419e692170971eb0448bce21
4
- data.tar.gz: ccf8b58789a570d35d4a1596cd34b501170c9be8
3
+ metadata.gz: dc2348983238ae6b8ea63aed9f0a0fb57ffe6c69
4
+ data.tar.gz: 2c7fc38a40a9f2bda81572b05184ad13b2e3954d
5
5
  SHA512:
6
- metadata.gz: fde636ab4a6ad69fbd9572b82a65077da58394f990c20f47c0b0b1443b36d3481e7241ccea05668850f0214414dd5b74b808692c64cf968fabec56ec31cc54a3
7
- data.tar.gz: 08d9197bd98ed7bf24ede0ffab1af03ec4f14716e203ba630b061c3a58ca10e0932cc73cff4cc1be85c66c9848d8b7f5a78655ca5d5a386e6bd6dd73a102a913
6
+ metadata.gz: 42f99bc0262db77bc545fe39d57c065d18c510702ee2d092b6365554d44b9335c811a22902eef8f88ba4371c71248af0315ac3be9985b7693b78e687cd682cd6
7
+ data.tar.gz: 3a34db039739705c71b727bd2a40eef5bc2c120bd28279512abde936769afd6e2f571af8ec7b6ed414492831e4864de1acb676b53e573f3703846b927c357f45
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Guards JavaScript jQuery Plugin v1.4.1
2
+ * Guards JavaScript jQuery Plugin v1.4.2
3
3
  * https://github.com/on-site/guards.js
4
4
  *
5
5
  * Copyright 2010-2014, 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: Wed Nov 12 21:12:25 2014 -0800
11
+ * Date: Fri Nov 14 01:44:15 2014 -0800
12
12
  */
13
13
 
14
14
  /**
@@ -48,7 +48,7 @@
48
48
  return $.guards.add(selector);
49
49
  };
50
50
 
51
- $.guard.version = "1.4.1";
51
+ $.guard.version = "1.4.2";
52
52
 
53
53
  $.Guards = function() {
54
54
  var self = this;
@@ -745,7 +745,7 @@
745
745
  * This version of guards.js library as a string, like <code>"1.0.0"</code>.
746
746
  * </p>
747
747
  */
748
- $.Guards.prototype.version = "1.4.1";
748
+ $.Guards.prototype.version = "1.4.2";
749
749
 
750
750
  $.Guards.prototype.parentContext = function(element) {
751
751
  var $element = $(element);
@@ -2619,7 +2619,9 @@
2619
2619
  }
2620
2620
 
2621
2621
  if (!result) {
2622
- this.triggerError($elements);
2622
+ var check = new NotUsedExternally();
2623
+ this.triggerError($elements, check);
2624
+ result = !!check.defaultPrevented;
2623
2625
  }
2624
2626
 
2625
2627
  return result;
@@ -2688,19 +2690,26 @@
2688
2690
  */
2689
2691
  $.Guard.prototype.triggerError = function() {
2690
2692
  var elements;
2693
+ var check = null;
2691
2694
 
2692
2695
  if (arguments.length === 0) {
2693
2696
  elements = this._selector;
2697
+ } else if (arguments.length === 1 && arguments[0].constructor === NotUsedExternally) {
2698
+ elements = this._selector;
2699
+ check = arguments[0];
2694
2700
  } else if (arguments.length === 1) {
2695
2701
  elements = arguments[0];
2702
+ } else if (arguments.length === 2 && arguments[1].constructor === NotUsedExternally) {
2703
+ elements = arguments[0];
2704
+ check = arguments[1];
2696
2705
  } else {
2697
2706
  throw new Error("Expected 0 or 1 argument to triggerError, got " + arguments.length);
2698
2707
  }
2699
2708
 
2700
2709
  if (this.isGrouped()) {
2701
- $(elements).addSingleError(this);
2710
+ $(elements).addSingleError(this, check || new NotUsedExternally());
2702
2711
  } else {
2703
- $(elements).addError(this);
2712
+ $(elements).addError(this, check || new NotUsedExternally());
2704
2713
  }
2705
2714
 
2706
2715
  return this;
@@ -2787,6 +2796,14 @@
2787
2796
  }
2788
2797
  };
2789
2798
 
2799
+ /**
2800
+ * Simple object that can be type checked so it is guaranteed to
2801
+ * not be used externally, and can pass information back to
2802
+ * callers.
2803
+ */
2804
+ function NotUsedExternally() {
2805
+ }
2806
+
2790
2807
  /**
2791
2808
  * Find any applicable fields for this selected item. Applicable
2792
2809
  * fields are any inputs, textareas or selects.
@@ -2867,6 +2884,10 @@
2867
2884
  var guardFormErrorPrevented = guard.sendEvent("guardFormError", this, true).isDefaultPrevented();
2868
2885
 
2869
2886
  if (guardErrorPrevented || guardFormErrorPrevented) {
2887
+ if (arguments.length === 2 && arguments[1].constructor === NotUsedExternally) {
2888
+ arguments[1].defaultPrevented = true;
2889
+ }
2890
+
2870
2891
  return this;
2871
2892
  }
2872
2893
 
@@ -2897,6 +2918,7 @@
2897
2918
  * target.
2898
2919
  */
2899
2920
  $.fn.addError = function(guard) {
2921
+ var check = arguments[1] || new NotUsedExternally();
2900
2922
  var radiosAdded = {};
2901
2923
 
2902
2924
  return this.each(function() {
@@ -2912,9 +2934,9 @@
2912
2934
  radiosAdded[name] = true;
2913
2935
  var context = guard._guards.parentContext($this);
2914
2936
  var radios = $("input[name='" + name + "']:radio", context);
2915
- radios.addSingleError(guard);
2937
+ radios.addSingleError(guard, check);
2916
2938
  } else {
2917
- $this.addSingleError(guard);
2939
+ $this.addSingleError(guard, check);
2918
2940
  }
2919
2941
  });
2920
2942
  };
@@ -1,5 +1,5 @@
1
1
  module GuardsJS
2
2
  module Rails
3
- VERSION = "1.4.1"
3
+ VERSION = "1.4.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guardsjs-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Virata-Stone
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-13 00:00:00.000000000 Z
11
+ date: 2014-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties