effective_bootstrap 1.21.10 → 1.21.11

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: a467a4fe312e0651bc2409e811c5c269d8cd22b1e1a6d9e8da0276f869b7c0ac
4
- data.tar.gz: 6941de835560bd2da4c879ee49ef466e2cfb81beffead24208cd01aec390f17e
3
+ metadata.gz: 1f141c767d3fcfb7733b0eaf8732084b495addc48670baa6a283178e3198d73b
4
+ data.tar.gz: 52ed9ed9eff4ede9ca421246042930d59aa91b5c5ee1edff1309e9c395eddea6
5
5
  SHA512:
6
- metadata.gz: 151044a9c7dd52a14328dd559f7759c91087b21bb65e68be7178c3741ce8a46c81b845fc4899e6b1fe8f3ab83dc5b6feb396799f4b2761020f24798944f49777
7
- data.tar.gz: 977c6a1f0c3850c662003006822a71d8b86b28b4fda47f900eb6d8ab4444497208e3392b19552d54c2a1be384bb4e95e91f9d00961d28453aaad387fd87cf855
6
+ metadata.gz: 6950237a1bc9439bdcb37970e0fdfdb2207a231089ecf7509abe896b096dedf1c1bb926e5ae1c24a443856d1a5db154d436a988da20b23c6e957336b663218d6
7
+ data.tar.gz: 4979ccf520c5dc0bc29e637868c4013d9da5291cad31532ea2cd8d42f35e7932c0660f690f61fabf276a509bdfcc387766b5d38d4323c5cd3f6e3a39a189b494
@@ -7,8 +7,8 @@ this.EffectiveForm ||= new class
7
7
  remote_form_redirect: '' # String containing the redirect path (optional)
8
8
 
9
9
  validate: (form) ->
10
- valid = form.checkValidity()
11
10
  $form = $(form)
11
+ valid = form.checkValidity() && @allChecksValid($form)
12
12
 
13
13
  @clearFlash()
14
14
  @reset($form) if $form.hasClass('was-validated')
@@ -16,6 +16,14 @@ this.EffectiveForm ||= new class
16
16
  if valid then @submitting($form) else @invalidate($form)
17
17
  valid
18
18
 
19
+ allChecksValid: ($form) ->
20
+ valid = true
21
+
22
+ $form.find('.effective-checks-required').each ->
23
+ valid = false unless $(@).find('input:checked').length > 0
24
+
25
+ valid
26
+
19
27
  submitting: ($form) ->
20
28
  $form.addClass('form-is-valid').removeClass('form-is-invalid')
21
29
  @spin()
@@ -34,6 +42,12 @@ this.EffectiveForm ||= new class
34
42
  $form.find('.effective-radios:not(.no-feedback),.effective-checks:not(.no-feedback)').each ->
35
43
  $(@).addClass(if $(@).find('input:invalid').length > 0 then 'is-invalid' else 'is-valid')
36
44
 
45
+ $form.find('.effective-checks-required').each ->
46
+ if $(@).find('input:checked').length > 0
47
+ $(@).addClass('is-valid').removeClass('is-invalid')
48
+ else
49
+ $(@).addClass('is-invalid').removeClass('is-valid')
50
+
37
51
  @flash($form, 'danger')
38
52
 
39
53
  disable: ($form) ->
@@ -5,3 +5,9 @@ $(document).on 'click', '[data-effective-checks-all]', (event) ->
5
5
  $(document).on 'click', '[data-effective-checks-none]', (event) ->
6
6
  $(event.currentTarget).closest('.effective-checks').find('input:checkbox:enabled:not([readonly])').prop('checked', false)
7
7
  false
8
+
9
+ $(document).on 'change', '.was-validated .effective-checks-required', (event) ->
10
+ if $(@).find('input:checked').length > 0
11
+ $(@).addClass('is-valid').removeClass('is-invalid')
12
+ else
13
+ $(@).addClass('is-invalid').removeClass('is-valid')
@@ -6,3 +6,7 @@
6
6
 
7
7
  a { padding: 0.5rem 0; }
8
8
  }
9
+
10
+ .was-validated .effective-checks-required.is-invalid {
11
+ .custom-control-label { color: $danger !important; }
12
+ }
@@ -26,6 +26,7 @@ module Effective
26
26
  def wrapper_options
27
27
  { class: [
28
28
  'form-group effective-checks',
29
+ ('effective-checks-required' if required?(name) || options[:required]),
29
30
  ('no-feedback' unless feedback_options),
30
31
  tag_id,
31
32
  ('is-invalid' if feedback_options && has_error?(name)),
@@ -1,3 +1,3 @@
1
1
  module EffectiveBootstrap
2
- VERSION = '1.21.10'.freeze
2
+ VERSION = '1.21.11'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_bootstrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.21.10
4
+ version: 1.21.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-10-27 00:00:00.000000000 Z
11
+ date: 2026-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails