diff options
| author | Aymeric Augustin | 2013-11-14 21:51:23 +0100 | 
|---|---|---|
| committer | Aymeric Augustin | 2013-11-14 21:51:23 +0100 | 
| commit | d4c340c857a09341595598a54c6bc7112a60be47 (patch) | |
| tree | 42bfc64a6cb9924296502a40b954a0e3899ae95e | |
| parent | 97090c32941784d28818721f37eee69e21e2d74e (diff) | |
| download | django-debug-toolbar-d4c340c857a09341595598a54c6bc7112a60be47.tar.bz2 | |
Improve code that ensure panels are loaded only once.
| -rw-r--r-- | debug_toolbar/static/debug_toolbar/js/toolbar.js | 5 | 
1 files changed, 2 insertions, 3 deletions
diff --git a/debug_toolbar/static/debug_toolbar/js/toolbar.js b/debug_toolbar/static/debug_toolbar/js/toolbar.js index e2e4c7d..e062f9e 100644 --- a/debug_toolbar/static/debug_toolbar/js/toolbar.js +++ b/debug_toolbar/static/debug_toolbar/js/toolbar.js @@ -27,10 +27,10 @@                      $(this).parent().removeClass('active');                  } else {                      $('.panelContent').hide(); // Hide any that are already open -                    var inner = current.find('.djDebugPanelContent .scroll').first(), +                    var inner = current.find('.djDebugPanelContent .scroll'),                          storage_id = $('#djDebug').data('storage-id'),                          render_panel_url = $('#djDebug').data('render-panel-url'); -                    if (storage_id !== '' && inner.data('loaded') !== 'true') { +                    if (storage_id !== '' && inner.children().length === 0) {                          var ajax_data = {                              data: {                                  storage_id: storage_id, @@ -40,7 +40,6 @@                              url: render_panel_url                          };                          $.ajax(ajax_data).done(function(data){ -                            inner.data('loaded', 'true');                              inner.html(data);                          }).fail(function(xhr){                              var message = '<div class="djDebugPanelTitle"><a class="djDebugClose djDebugBack" href="">Back</a><h3>'+xhr.status+': '+xhr.statusText+'</h3></div>';  | 
