Sha256: 6abf4b40f1d1d96c4cf5fb943706a4b54b3fe2cfcfe55d41b096e71f610a847b

Contents?: true

Size: 589 Bytes

Versions: 10

Compression:

Stored size: 589 Bytes

Contents

let initTabs = function() {
  let $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');
  } else if (document.location.hash.length > 0) {
    let $tab_from_url = $(".nav.nav-tabs").find("a[href^='" + document.location.hash + "']");

    if ($tab_from_url.length > 0) {
      document.location.hash = ""; // This prevents scrolling to the wrong place in the page
      $tab_from_url.tab("show");
    }
  }
}

$(document).ready(initTabs);

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
effective_bootstrap-0.6.26 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.6.25 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.6.24 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.6.23 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.6.22 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.6.21 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.6.20 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.6.19 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.6.18 app/assets/javascripts/effective_bootstrap/tabs.js
effective_bootstrap-0.6.17 app/assets/javascripts/effective_bootstrap/tabs.js