aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAymeric Augustin2013-11-16 21:46:38 +0100
committerAymeric Augustin2013-11-16 21:46:38 +0100
commit80ac168eeff4bdce0764c25c2bd3da1f37cbda28 (patch)
tree9ed6b351aeb792dad2a658f89d5e674cae07b674
parentdbded64743247b18d0f4811dad45739029ae86f3 (diff)
downloaddjango-debug-toolbar-80ac168eeff4bdce0764c25c2bd3da1f37cbda28.tar.bz2
Move JS specific to the SQL panel to its own file.
-rw-r--r--debug_toolbar/static/debug_toolbar/js/toolbar.js7
-rw-r--r--debug_toolbar/static/debug_toolbar/js/toolbar.sql.js13
-rw-r--r--debug_toolbar/templates/debug_toolbar/panels/sql.html2
3 files changed, 15 insertions, 7 deletions
diff --git a/debug_toolbar/static/debug_toolbar/js/toolbar.js b/debug_toolbar/static/debug_toolbar/js/toolbar.js
index c5afb31..1185ef7 100644
--- a/debug_toolbar/static/debug_toolbar/js/toolbar.js
+++ b/debug_toolbar/static/debug_toolbar/js/toolbar.js
@@ -98,13 +98,6 @@
return false;
});
- // Used by the SQL panel -- in HTML generated by Python code
- $('#djDebug a.djDebugToggle').live('click', function(e) {
- e.preventDefault();
- $(this).parent().find('.djDebugCollapsed').toggle();
- $(this).parent().find('.djDebugUncollapsed').toggle();
- });
-
// Used by the cache, profiling and SQL panels
$('#djDebug a.djToggleSwitch').live('click', function(e) {
e.preventDefault();
diff --git a/debug_toolbar/static/debug_toolbar/js/toolbar.sql.js b/debug_toolbar/static/debug_toolbar/js/toolbar.sql.js
new file mode 100644
index 0000000..c554bce
--- /dev/null
+++ b/debug_toolbar/static/debug_toolbar/js/toolbar.sql.js
@@ -0,0 +1,13 @@
+(function (factory) {
+ if (typeof define === 'function' && define.amd) {
+ define(['jquery'], factory);
+ } else {
+ factory(jQuery);
+ }
+}(function ($) {
+ $('#djDebug a.djDebugToggle').on('click', function(e) {
+ e.preventDefault();
+ $(this).parent().find('.djDebugCollapsed').toggle();
+ $(this).parent().find('.djDebugUncollapsed').toggle();
+ });
+}));
diff --git a/debug_toolbar/templates/debug_toolbar/panels/sql.html b/debug_toolbar/templates/debug_toolbar/panels/sql.html
index 54babfc..d454d61 100644
--- a/debug_toolbar/templates/debug_toolbar/panels/sql.html
+++ b/debug_toolbar/templates/debug_toolbar/panels/sql.html
@@ -92,3 +92,5 @@
{% else %}
<p>{% trans "No SQL queries were recorded during this request." %}</p>
{% endif %}
+
+<script src="{{ STATIC_URL }}debug_toolbar/js/toolbar.sql.js"></script>