06_load-remote-tab-only-once_r16963.patch

Marius BALTEANU, 2017-09-10 14:18

Download (1.24 KB)

View differences:

public/javascripts/application.js
370 370
  return false;
371 371
}
372 372

  
373
function getRemoteTab(name, remote_url, url) {
374
  $('#tab-content-' + name).parent().find('.tab-content').hide();
375
  $('#tab-content-' + name).parent().find('div.tabs a').removeClass('selected');
376
  $('#tab-' + name).addClass('selected')
373
function getRemoteTab(name, remote_url, url, load_always = false) {
374
  var tab_content = $('#tab-content-' + name);
377 375

  
378
  replaceInHistory(url)
376
  tab_content.parent().find('.tab-content').hide();
377
  tab_content.parent().find('div.tabs a').removeClass('selected');
378
  $('#tab-' + name).addClass('selected');
379 379

  
380
  $.ajax({
381
    url: remote_url,
382
    type: 'get',
383
    success: function(data){
384
      $('#tab-content-' + name).html(data).show();
385
    }
386
  });
380
  replaceInHistory(url);
381

  
382
  if (tab_content.children().length == 0 && load_always == false) {
383
    $.ajax({
384
      url: remote_url,
385
      type: 'get',
386
      success: function(data){
387
        tab_content.html(data)
388
      }
389
    });
390
  }
387 391

  
392
  tab_content.show();
388 393
  return false;
389 394
}
390 395