0006-load-remote-tab-only-once.patch

Marius BALTEANU, 2018-12-16 15:59

Download (1.57 KB)

View differences:

public/javascripts/application.js
377 377
  return false;
378 378
}
379 379

  
380
function getRemoteTab(name, remote_url, url) {
381
  $('#tab-content-' + name).parent().find('.tab-content').hide();
382
  $('#tab-content-' + name).parent().find('div.tabs a').removeClass('selected');
383
  $('#tab-' + name).addClass('selected')
380
function getRemoteTab(name, remote_url, url, load_always = false) {
381
  var tab_content = $('#tab-content-' + name);
384 382

  
385
  replaceInHistory(url)
383
  tab_content.parent().find('.tab-content').hide();
384
  tab_content.parent().find('div.tabs a').removeClass('selected');
385
  $('#tab-' + name).addClass('selected');
386 386

  
387
  $.ajax({
388
    url: remote_url,
389
    type: 'get',
390
    success: function(data){
391
      $('#tab-content-' + name).html(data).show();
392
    }
393
  });
387
  replaceInHistory(url);
394 388

  
389
  if (tab_content.children().length == 0 && load_always == false) {
390
    $.ajax({
391
      url: remote_url,
392
      type: 'get',
393
      success: function(data){
394
        tab_content.html(data)
395
      }
396
    });
397
  }
398

  
399
  tab_content.show();
395 400
  return false;
396 401
}
397 402

  
398
-