Sha256: d69490530de1793e9e5356fca297261281b86002a465daf69fec7d94d8341ec9

Contents?: true

Size: 714 Bytes

Versions: 30

Compression:

Stored size: 714 Bytes

Contents

$(document).ready(function() {
  var $tab_with_error = $(".form-control.is-invalid").first().closest('.tab-pane');

  if ($tab_with_error.length > 0) {
    $(".nav.nav-tabs").find("a[href^='#" + $tab_with_error.attr('id') + "']").tab('show');
    return true;

  } else if (document.location.search.length > 0) {
    var tab = new URLSearchParams(document.location.search).get('tab');
    if(tab.length == 0) { return false; }

    $('.nav.nav-tabs').find("a[href^='#" + tab + "']").tab('show');
  }
});

$(document).on('click', '[data-click-tab]', function(event) {
  event.preventDefault();

  var href = $(event.currentTarget).attr('href');
  $('.nav.nav-tabs').find("a[href^='" + href + "']").tab('show');
});

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
effective_bootstrap-0.11.17 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.11.16 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.11.15 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.11.14 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.11.13 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.11.12 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.11.11 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.11.10 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.11.9 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.11.8 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.11.7 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.11.6 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.11.5 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.11.4 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.11.3 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.11.2 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.11.1 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.11.0 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.10.17 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.10.16 app/assets/javascripts/effective_bootstrap/tabs.js