forked from lix-project/hydra
Load a tab only once
This commit is contained in:
parent
410060ec8a
commit
11acf0be28
1 changed files with 3 additions and 1 deletions
|
@ -458,10 +458,12 @@ BLOCK makeLazyTab %]
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
$(function() {
|
$(function() {
|
||||||
|
var tabsLoaded = {};
|
||||||
$('.nav-tabs').bind('show', function(e) {
|
$('.nav-tabs').bind('show', function(e) {
|
||||||
var pattern = /#.+/gi;
|
var pattern = /#.+/gi;
|
||||||
var id = e.target.toString().match(pattern)[0];
|
var id = e.target.toString().match(pattern)[0];
|
||||||
if (id == "#[% tabName %]") {
|
if (id == "#[% tabName %]" && !tabsLoaded[id]) {
|
||||||
|
tabsLoaded[id] = 1;
|
||||||
$('#[% tabName %]').load("[% uri %]", function(response, status, xhr) {
|
$('#[% tabName %]').load("[% uri %]", function(response, status, xhr) {
|
||||||
if (status == "error") {
|
if (status == "error") {
|
||||||
$('#[% tabName %]').html("<div class='alert alert-error'>Error loading tab: " + xhr.status + " " + xhr.statusText + "</div>");
|
$('#[% tabName %]').html("<div class='alert alert-error'>Error loading tab: " + xhr.status + " " + xhr.statusText + "</div>");
|
||||||
|
|
Loading…
Reference in a new issue