diff --git a/rest_framework/static/rest_framework/docs/css/base.css b/rest_framework/static/rest_framework/docs/css/base.css index b7ae6375e2..259af31f51 100644 --- a/rest_framework/static/rest_framework/docs/css/base.css +++ b/rest_framework/static/rest_framework/docs/css/base.css @@ -115,6 +115,13 @@ pre.highlight code { background-color: #020203; } +.sidebar .menu-list li.collapsed + ul.menu-content { + height: 0; +} + +.sidebar .menu-list li.collapsed + ul.menu-content li { + display: none; +} .sidebar .menu-list ul .sub-menu li a, .sidebar .menu-list li .sub-menu li a { diff --git a/rest_framework/templates/rest_framework/docs/_recursive_document.html b/rest_framework/templates/rest_framework/docs/_recursive_document.html new file mode 100644 index 0000000000..b001193a4d --- /dev/null +++ b/rest_framework/templates/rest_framework/docs/_recursive_document.html @@ -0,0 +1,16 @@ +{% load rest_framework %} +{% for section_key, section in items %} + {% if section_key %} + + {{ section_key }} + + + {% endif %} + + {% if section.links|items %} + {% for link_key, link in section.links|items %} + {% include "rest_framework/docs/link.html" with path=path %} + {% endfor %} + {% endif %} + {% include 'rest_framework/docs/_recursive_document.html' with items=section.data|items path=path|list_add:section_key level=level|add:1 %} +{% endfor %} diff --git a/rest_framework/templates/rest_framework/docs/_recursive_menu.html b/rest_framework/templates/rest_framework/docs/_recursive_menu.html new file mode 100644 index 0000000000..cebf307170 --- /dev/null +++ b/rest_framework/templates/rest_framework/docs/_recursive_menu.html @@ -0,0 +1,18 @@ +{% load rest_framework %} +{% if items %} + +{% endif %} diff --git a/rest_framework/templates/rest_framework/docs/document.html b/rest_framework/templates/rest_framework/docs/document.html index ef5f5966b9..2faf375e2a 100644 --- a/rest_framework/templates/rest_framework/docs/document.html +++ b/rest_framework/templates/rest_framework/docs/document.html @@ -14,17 +14,8 @@

{{ document.title }}

-{% for section_key, section in document.data|items %} -{% if section_key %} -

{{ section_key }} -

-{% endif %} - - {% for link_key, link in section.links|items %} - {% include "rest_framework/docs/link.html" %} - {% endfor %} -{% endfor %} +{% include "rest_framework/docs/_recursive_document.html" with items=document.data|items path=""|make_list level=2 %} {% for link_key, link in document.links|items %} - {% include "rest_framework/docs/link.html" %} + {% include "rest_framework/docs/link.html" with path=""|make_list %} {% endfor %} diff --git a/rest_framework/templates/rest_framework/docs/interact.html b/rest_framework/templates/rest_framework/docs/interact.html index 3703301c2c..c7211c6c99 100644 --- a/rest_framework/templates/rest_framework/docs/interact.html +++ b/rest_framework/templates/rest_framework/docs/interact.html @@ -16,7 +16,7 @@