effective_bootstrap 0.12.6 → 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: 5057fc2e6d9bc2551fbb8fadbe71c02c4820eeba89e94e9fc4c9fdaacaad1c4d
4
- data.tar.gz: c96c4f16ccc862615b682cef25cd70ddb2828dd86662439512b8a95d9a03d780
3
+ metadata.gz: 32a2c9eaed6f8b91548c0b6b418c37e1385ea9f7323b429725849a72c7aa00a4
4
+ data.tar.gz: 59f3fc9353fa3630a6dc3e0b5f1e31e75b4e1b9bae511c8ad563d96ebc11f80f
5
5
  SHA512:
6
- metadata.gz: 3402af914d4bff7469ac90d4c29bfb2f291455f79c1cf1d3ef094d800ee852951de7a90bb1ddeee47e42c0b640db3912b9ae2ebf9a3fca1d4a4828d81640559d
7
- data.tar.gz: f1c0aad75a47698dcedec4fdb48d1c3454fbb32f476fc50b08aa21306210a132c8e076e614bc4ac52b01de00405d973c7d3ca367fe12b7cacb004f30cdea2f16
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
 
@@ -5,7 +5,13 @@ module Effective
5
5
  class UrlField < Effective::FormInput
6
6
 
7
7
  def input_html_options
8
- { class: 'form-control', placeholder: 'https://www.example.com', id: tag_id }
8
+ {
9
+ class: 'form-control',
10
+ placeholder: 'https://www.example.com',
11
+ id: tag_id,
12
+ pattern: '(http:\/|https:\/)?\/[^\/+].+',
13
+ type: 'text'
14
+ }
9
15
  end
10
16
 
11
17
  def input_group_options
@@ -1,3 +1,3 @@
1
1
  module EffectiveBootstrap
2
- VERSION = '0.12.6'.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.6
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-14 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