Sha256: 3e2e3edc63cc90de384d62431e88cbf20de89f52235250b49bf15fd57f67bfe5

Contents?: true

Size: 722 Bytes

Versions: 13

Compression:

Stored size: 722 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

13 entries across 13 versions & 1 rubygems

Version Path
effective_bootstrap-0.12.7 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.12.6 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.12.5 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.12.4 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.12.3 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.12.2 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.12.1 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.12.0 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.11.22 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.11.21 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.11.20 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.11.19 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.11.18 app/assets/javascripts/effective_bootstrap/tabs.js