aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorAymeric Augustin2014-07-18 08:13:39 +0200
committerAymeric Augustin2014-07-18 08:13:39 +0200
commite49340d2e763b04d0fd1f1505394de835992a4d0 (patch)
tree0d3b2521482140d117c9e7606b384e13c46ecd36 /docs
parentfbbbc1d49e5a8e8f50fb111b26ec481436c3a215 (diff)
parent4b960709e15455af09d5632f84b463dee268d8a8 (diff)
downloaddjango-debug-toolbar-e49340d2e763b04d0fd1f1505394de835992a4d0.tar.bz2
Merge pull request #619 from tim-schilling/javascript-api-484
Add a JavaScript API. Fix #484.
Diffstat (limited to 'docs')
-rw-r--r--docs/panels.rst42
1 files changed, 40 insertions, 2 deletions
diff --git a/docs/panels.rst b/docs/panels.rst
index 8941ed2..de6f16a 100644
--- a/docs/panels.rst
+++ b/docs/panels.rst
@@ -240,8 +240,7 @@ according to the public API described below. Unless noted otherwise, all
methods are optional.
Panels can ship their own templates, static files and views. They're no public
-CSS or JavaScript API at this time, but they can assume jQuery is available in
-``djdt.jQuery``.
+CSS API at this time.
.. autoclass:: debug_toolbar.panels.Panel(*args, **kwargs)
@@ -272,3 +271,42 @@ CSS or JavaScript API at this time, but they can assume jQuery is available in
.. automethod:: debug_toolbar.panels.Panel.process_view
.. automethod:: debug_toolbar.panels.Panel.process_response
+
+JavaScript API
+~~~~~~~~~~~~~~
+
+Panel templates should include any JavaScript files they need. There are a few
+common methods available, as well as the toolbar's version of jQuery.
+
+.. js:function:: djdt.close
+
+ Triggers the event to close any active panels.
+
+.. js:function:: djdt.cookie.get
+
+ This is a helper function to fetch values stored in the cookies.
+
+ :param string key: The key for the value to be fetched.
+
+.. js:function:: djdt.cookie.set
+
+ This is a helper function to set a value stored in the cookies.
+
+ :param string key: The key to be used.
+
+ :param string value: The value to be set.
+
+ :param Object options: The options for the value to be set. It should contain
+ the properties ``expires`` and ``path``.
+
+.. js:function:: djdt.hide_toolbar
+
+ Closes any panels and hides the toolbar.
+
+.. js:function:: djdt.jQuery
+
+ This is the toolbar's version of jQuery.
+
+.. js:function:: djdt.show_toolbar
+
+ Shows the toolbar.