effective_bootstrap 0.12.7 → 0.13.0

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
  SHA256:
3
- metadata.gz: caf072e51e23f572c945c0d6a96bfe6409e7858663c7f381f26b2182b63f48e2
4
- data.tar.gz: 6e24ba3f3a68fb5d75b464ded353bbfab42f7c6712643f146ee344bb9f9b1f40
3
+ metadata.gz: 32a2c9eaed6f8b91548c0b6b418c37e1385ea9f7323b429725849a72c7aa00a4
4
+ data.tar.gz: 59f3fc9353fa3630a6dc3e0b5f1e31e75b4e1b9bae511c8ad563d96ebc11f80f
5
5
  SHA512:
6
- metadata.gz: 8b5b92e6c0ed5fa76633e0f514dd151978aaca1c5a92ce88c86201363334c45e13f96380c796e2e2ab06eaf8f7afcbbce6bd9c59ee4b0d484ccd8a4d908c1f14
7
- data.tar.gz: 05db676088a579d304260b324a3c48114aca3f76f9382d05bc0a048fd87a155fb1297706af728b7b731912e1d9fce277de0166634e895dbf506dc360a10c16e1
6
+ metadata.gz: 3eb4e59a05641ce7b555a8265e5d61189235b60bd2200842860c9bd8077c89dd2e500424a89007f07fae42170e1fd9116c89439509061812e2d7d917a3614019
7
+ data.tar.gz: 150b453174902f53b00e99fc751220ce583016e9de0a2ce2bb9a7d10a880420045d4d656d3b8967b606b5edcb626b7b8cf0f28e4f369ec6c1472d436f7d5be0c
@@ -1,18 +1,37 @@
1
+ // Set the document hash to the tab href
2
+ $(document).on('show.bs.tab', function (e) {
3
+ history.replaceState(null, null, '#' + e.target.getAttribute('id'));
4
+ });
5
+
6
+ // Display the tab based on form errors, the document hash, or ?tab= params
1
7
  $(document).ready(function() {
2
- var $tab_with_error = $(".form-control.is-invalid").first().closest('.tab-pane');
8
+ var href = '';
3
9
 
4
- if ($tab_with_error.length > 0) {
5
- $(".nav.nav-tabs").find("a[href^='#" + $tab_with_error.attr('id') + "']").tab('show');
6
- return true;
10
+ var $tab_with_error = $(".form-control.is-invalid").first().closest('.tab-pane')
7
11
 
12
+ if ($tab_with_error.length > 0) {
13
+ href = $tab_with_error.attr('id')
14
+ } else if (document.location.hash.length > 0) {
15
+ var hash = document.location.hash
16
+ if(hash.startsWith('#tab-')) { href = hash.replace('#tab-', '') }
8
17
  } else if (document.location.search.length > 0) {
9
- var tab = new URLSearchParams(document.location.search).get('tab');
10
- if((tab || '').length == 0) { return false; }
18
+ var param = new URLSearchParams(document.location.search).get('tab') || ''
19
+ if(param.length > 0) { href = param }
20
+ }
21
+
22
+ if (href.length > 0) {
23
+ var $tab = $(".nav.nav-tabs").find("a[href^='#" + href + "']")
11
24
 
12
- $('.nav.nav-tabs').find("a[href^='#" + tab + "']").tab('show');
25
+ $tab.parents('.tab-pane').each (function() {
26
+ $('.nav.nav-tabs').find("a[href^='#" + $(this).attr('id') + "']").tab('show')
27
+ })
28
+
29
+ $tab.tab('show')
13
30
  }
14
31
  });
15
32
 
33
+
34
+ // Click tab button
16
35
  $(document).on('click', '[data-click-tab]', function(event) {
17
36
  event.preventDefault();
18
37
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveBootstrap
2
- VERSION = '0.12.7'.freeze
2
+ VERSION = '0.13.0'.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: 0.12.7
4
+ version: 0.13.0
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: 2023-03-20 00:00:00.000000000 Z
11
+ date: 2023-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails