client_side_validations 19.0.0 → 19.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 519cbe68a2ab8902fda80886a2e802995699c9ffe177ff065bb84625c445cadf
4
- data.tar.gz: be55ec78e3fc953df50882bcc6a068025136c28b15231f08afdac2308d92dcfd
3
+ metadata.gz: 4e5904433f3b766e4544605c251a50c28349fbad906456b4823e19ea2700aef1
4
+ data.tar.gz: 0d3fe57c177d373237ce63c2f905fd2c907579c268e550134f3d954a2b72df61
5
5
  SHA512:
6
- metadata.gz: ad7a540ddcc1d61b6197789a4f1b16cba3c9d3ebe1aa512536b60996df4bf154fc8cb7cab5ac9aa29615adbe08af56890b95626e321fce068d083d8ba22dd764
7
- data.tar.gz: 7c13e4d20cb92ac469781d13e1395fe14b6cb69d8e3dfee0f20bdbd6f65ffa343e3d3d6de01f4b13c7af2ac0b70e44bdbd77737e7db9ee493b3223f769e2dcc4
6
+ metadata.gz: 51f6b2a441831cb479f267a04627badde3d6478f733b7a66792ca9df0e3f4eb403fed52210a7c2001c855b697d9cfeb14f51eb222aadc21b392bebf71d4ad903
7
+ data.tar.gz: bf6196647cba2846209dd206e2e3bc1eec79f4e07f66720996c1761670288cd8496fcef2a5e620faea34cf8225dfc2856f9eb480773755c9b28dc6acb4ab03e4
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 19.1.0 / 2021-10-05
4
+
5
+ * [FEATURE] Add Turbo compatibility ([#849](https://github.com/DavyJonesLocker/client_side_validations/pull/849))
6
+
3
7
  ## 19.0.0 / 2021-10-01
4
8
 
5
9
  * [FEATURE] Add support to `other_than` numericality validator
data/README.md CHANGED
@@ -85,9 +85,9 @@ use the require syntax and make sure that `@client-side-validations/client-side-
85
85
  is required after`Turbolinks.start()`, so ClientSideValidations can properly
86
86
  attach its event handlers.
87
87
 
88
- Turbolinks 5.3 automatically calls `start()`, so you can use the `import` syntax.
89
- Just make sure that `@client-side-validations/client-side-validations` is imported
90
- **after** `turbolinks`, so ClientSideValidations can properly
88
+ [Turbo](https://github.com/hotwired/turbo-rails) automatically calls `start()`,
89
+ so you can use the `import` syntax. Just make sure that `@client-side-validations/client-side-validations/src`
90
+ is imported **after** `turbo`, so ClientSideValidations can properly
91
91
  attach its event handlers.
92
92
 
93
93
  #### When using Sprockets ####
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ClientSideValidations
4
- VERSION = '19.0.0'
4
+ VERSION = '19.1.0'
5
5
  end
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Client Side Validations JS - v0.2.0 (https://github.com/DavyJonesLocker/client_side_validations)
2
+ * Client Side Validations JS - v0.3.0 (https://github.com/DavyJonesLocker/client_side_validations)
3
3
  * Copyright (c) 2021 Geremia Taglialatela, Brian Cardarella
4
4
  * Licensed under MIT (https://opensource.org/licenses/mit-license.php)
5
5
  */
@@ -252,9 +252,17 @@
252
252
 
253
253
  ClientSideValidations.enablers.form(form);
254
254
  },
255
+ initializeOnEvent: function initializeOnEvent() {
256
+ if (window.Turbo != null) {
257
+ return 'turbo:load';
258
+ } else if (window.Turbolinks != null && window.Turbolinks.supported) {
259
+ return window.Turbolinks.EVENTS != null ? 'page:change' : 'turbolinks:load';
260
+ }
261
+ },
255
262
  start: function start() {
256
- if (window.Turbolinks != null && window.Turbolinks.supported) {
257
- var initializeOnEvent = window.Turbolinks.EVENTS != null ? 'page:change' : 'turbolinks:load';
263
+ var initializeOnEvent = ClientSideValidations.initializeOnEvent();
264
+
265
+ if (initializeOnEvent != null) {
258
266
  jQuery__default["default"](document).on(initializeOnEvent, function () {
259
267
  return jQuery__default["default"](ClientSideValidations.selectors.forms).validate();
260
268
  });
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: client_side_validations
3
3
  version: !ruby/object:Gem::Version
4
- version: 19.0.0
4
+ version: 19.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geremia Taglialatela
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-10-01 00:00:00.000000000 Z
12
+ date: 2021-10-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails