Skip to content

Commit

Permalink
Added - Deep linking in Bootstrap tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
snipe committed Feb 14, 2018
1 parent f144d67 commit 9f3116e
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 5 deletions.
2 changes: 1 addition & 1 deletion public/js/build/all.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/js/dist/all.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions public/mix-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"/css/app.css.map": "/css/app.css.map?id=bdbe05e6ecd70ccfac72",
"/css/overrides.css.map": "/css/overrides.css.map?id=898c91d4a425b01b589b",
"/css/dist/all.css": "/css/dist/all.css?id=3a8aa974e7b09b52b18c",
"/js/dist/all.js": "/js/dist/all.js?id=722d1692756a30dc1ece",
"/js/dist/all.js": "/js/dist/all.js?id=4e5e7295e9a59e718567",
"/css/build/all.css": "/css/build/all.css?id=3a8aa974e7b09b52b18c",
"/js/build/all.js": "/js/build/all.js?id=722d1692756a30dc1ece"
"/js/build/all.js": "/js/build/all.js?id=4e5e7295e9a59e718567"
}
36 changes: 35 additions & 1 deletion resources/assets/js/snipeit.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,41 @@ $(document).ready(function () {
}
});
});



// ------------------------------------------------
// Deep linking for Bootstrap tabs
// ------------------------------------------------
var taburl = document.location.toString();

// Allow full page URL to activate a tab's ID
// ------------------------------------------------
// This allows linking to a tab on page load via the address bar.
// So a URL such as, http://snipe-it.local/hardware/2/#my_tab will
// cause the tab on that page with an ID of “my_tab” to be active.
if (taburl.match('#') ) {
$('.nav-tabs a[href="#'+taburl.split('#')[1]+'"]').tab('show');
}

// Allow internal page links to activate a tab's ID.
// ------------------------------------------------
// This allows you to link to a tab from anywhere on the page
// including from within another tab. Also note that internal page
// links either inside or out of the tabs need to include data-toggle="tab"
// Ex: <a href="#my_tab" data-toggle="tab">Click me</a>
$('a[data-toggle="tab"]').click(function (e) {
var href = $(this).attr("href");
history.pushState(null, null, href);
e.preventDefault();
$('a[href="' + $(this).attr('href') + '"]').tab('show');
});

// ------------------------------------------------
// End Deep Linking for Bootstrap tabs
// ------------------------------------------------





});

0 comments on commit 9f3116e

Please sign in to comment.