Feature #3058 » 0006-load-remote-tab-only-once.patch
| public/javascripts/application.js | ||
|---|---|---|
| 385 | 385 |
return false; |
| 386 | 386 |
} |
| 387 | 387 | |
| 388 |
function getRemoteTab(name, remote_url, url) {
|
|
| 389 |
$('#tab-content-' + name).parent().find('.tab-content').hide();
|
|
| 390 |
$('#tab-content-' + name).parent().find('div.tabs a').removeClass('selected');
|
|
| 391 |
$('#tab-' + name).addClass('selected')
|
|
| 388 |
function getRemoteTab(name, remote_url, url, load_always = false) {
|
|
| 389 |
var tab_content = $('#tab-content-' + name);
|
|
| 392 | 390 | |
| 393 |
replaceInHistory(url) |
|
| 391 |
tab_content.parent().find('.tab-content').hide();
|
|
| 392 |
tab_content.parent().find('div.tabs a').removeClass('selected');
|
|
| 393 |
$('#tab-' + name).addClass('selected');
|
|
| 394 | 394 | |
| 395 |
$.ajax({
|
|
| 396 |
url: remote_url, |
|
| 397 |
type: 'get', |
|
| 398 |
success: function(data){
|
|
| 399 |
$('#tab-content-' + name).html(data).show();
|
|
| 400 |
} |
|
| 401 |
}); |
|
| 395 |
replaceInHistory(url); |
|
| 402 | 396 | |
| 397 |
if (tab_content.children().length == 0 && load_always == false) {
|
|
| 398 |
$.ajax({
|
|
| 399 |
url: remote_url, |
|
| 400 |
type: 'get', |
|
| 401 |
success: function(data){
|
|
| 402 |
tab_content.html(data) |
|
| 403 |
} |
|
| 404 |
}); |
|
| 405 |
} |
|
| 406 | ||
| 407 |
tab_content.show(); |
|
| 403 | 408 |
return false; |
| 404 | 409 |
} |
| 405 | 410 | |