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.10.15 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.10.14 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.10.13 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.10.12 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.10.11 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.10.10 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.10.9 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.10.8 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.10.7 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.10.6 app/assets/javascripts/effective_bootstrap/tabs.js