From 2816c6fa2a1613e5eeb7967cde0793019ce62feb Mon Sep 17 00:00:00 2001 From: Aymeric Augustin Date: Sat, 9 Nov 2013 19:07:38 +0100 Subject: Load the content of panels dynamically. This should drastically reduce the overhead of the browser toolbar when a page has a complex template structure or many SQL queries. This change is backwards-incompatible for third-party panels because it changes the signature of __init__. The JavaScript could probably be improved; I'm outside my comfort zone. --- debug_toolbar/static/debug_toolbar/js/toolbar.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'debug_toolbar/static') diff --git a/debug_toolbar/static/debug_toolbar/js/toolbar.js b/debug_toolbar/static/debug_toolbar/js/toolbar.js index 094c3ac..0b7d1ec 100644 --- a/debug_toolbar/static/debug_toolbar/js/toolbar.js +++ b/debug_toolbar/static/debug_toolbar/js/toolbar.js @@ -28,6 +28,23 @@ $(this).parent().removeClass('active'); } else { $('.panelContent').hide(); // Hide any that are already open + var inner = current.find('.djDebugPanelContent .scroll').first(); + if ($(inner).empty()) { + var ajax_data = { + data: { + toolbar_id: $('#djDebug').data('toolbar-id'), + panel_id: this.className + }, + type: 'GET', + url: $('#djDebug').data('render-panel-url') + }; + $.ajax(ajax_data).done(function(data){ + inner.html(data); + }).fail(function(xhr){ + var message = '