From f98c88c498ddfc00e3da78857ccf0fee943ef694 Mon Sep 17 00:00:00 2001 From: Emmanuelle Delescolle Date: Fri, 10 Mar 2017 21:23:16 +0100 Subject: [PATCH] templates adjustments --- .../rest_framework/docs/_recursive_document.html | 2 +- .../templates/rest_framework/docs/_recursive_menu.html | 8 ++++++-- .../templates/rest_framework/docs/langs/javascript.html | 2 +- .../templates/rest_framework/docs/langs/python.html | 2 +- .../templates/rest_framework/docs/langs/shell.html | 2 +- rest_framework/templates/rest_framework/docs/link.html | 2 +- 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/rest_framework/templates/rest_framework/docs/_recursive_document.html b/rest_framework/templates/rest_framework/docs/_recursive_document.html index d0f904aa3..b3aea14aa 100644 --- a/rest_framework/templates/rest_framework/docs/_recursive_document.html +++ b/rest_framework/templates/rest_framework/docs/_recursive_document.html @@ -1,6 +1,6 @@ {% for section_key, section in items %} {% if section_key %} - {{ section_key }} + {{ section_key }} {% endif %} diff --git a/rest_framework/templates/rest_framework/docs/_recursive_menu.html b/rest_framework/templates/rest_framework/docs/_recursive_menu.html index d00a16747..555d547d1 100644 --- a/rest_framework/templates/rest_framework/docs/_recursive_menu.html +++ b/rest_framework/templates/rest_framework/docs/_recursive_menu.html @@ -6,11 +6,15 @@ {% if section.links.items %} {% else %} - {% include 'rest_framework/docs/_recursive_menu.html' with items=section.items prefix=prefix|add:section_key %} + {% if prefix %} + {% include 'rest_framework/docs/_recursive_menu.html' with items=section.items prefix=prefix|add:'/'|add:section_key %} + {% else %} + {% include 'rest_framework/docs/_recursive_menu.html' with items=section.items prefix=section_key %} + {% endif %} {% endif %} {% endfor %} diff --git a/rest_framework/templates/rest_framework/docs/langs/javascript.html b/rest_framework/templates/rest_framework/docs/langs/javascript.html index d419a6017..a5d33d589 100644 --- a/rest_framework/templates/rest_framework/docs/langs/javascript.html +++ b/rest_framework/templates/rest_framework/docs/langs/javascript.html @@ -6,7 +6,7 @@ var schema = window.schema // Loaded by `schema.js` var client = new coreapi.Client() // Interact with the API endpoint -var action = [{% if prefix %}{{ prefix|split_keys }} {% endif %}{% if section_key %}"{{ section_key }}", {% endif %}"{{ link_key }}"] +var action = [{{ prefix|split_keys }}{% if section_key %}"{{ section_key }}", {% endif %}"{{ link_key }}"] {% if link.fields %}var params = { {% for field in link.fields %} {{ field.name }}: ...{% if not loop.last %},{% endif %} {% endfor %}} diff --git a/rest_framework/templates/rest_framework/docs/langs/python.html b/rest_framework/templates/rest_framework/docs/langs/python.html index c9d572b86..0951c0fb4 100644 --- a/rest_framework/templates/rest_framework/docs/langs/python.html +++ b/rest_framework/templates/rest_framework/docs/langs/python.html @@ -6,7 +6,7 @@ client = coreapi.Client() schema = client.get("{{ document.url }}"{% if schema_format %}, format="{{ schema_format }}"{% endif %}) # Interact with the API endpoint -action = [{% if prefix %}{{ prefix|split_keys }} {% endif %}{% if section_key %}"{{ section_key }}", {% endif %}"{{ link_key }}"] +action = [{{ prefix|split_keys }}{% if section_key %}"{{ section_key }}", {% endif %}"{{ link_key }}"] {% if link.fields %}params = { {% for field in link.fields %} "{{ field.name }}": ...{% if not loop.last %},{% endif %} {% endfor %}} diff --git a/rest_framework/templates/rest_framework/docs/langs/shell.html b/rest_framework/templates/rest_framework/docs/langs/shell.html index 9ccaaaa16..37f26ee02 100644 --- a/rest_framework/templates/rest_framework/docs/langs/shell.html +++ b/rest_framework/templates/rest_framework/docs/langs/shell.html @@ -3,4 +3,4 @@ $ coreapi get {{ document.url }}{% if schema_format %} --format {{ schema_format }}{% endif %} # Interact with the API endpoint -$ coreapi action {% if prefix %}{{ prefix|split_keys:'cmd' }} {% endif %}{% if section_key %}{{ section_key }} {% endif %}{{ link_key }}{% for field in link.fields %} -p {{ field.name }}=...{% endfor %}{% endcode %} +$ coreapi action {{ prefix|split_keys:'cmd' }}{% if section_key %}{{ section_key }} {% endif %}{{ link_key }}{% for field in link.fields %} -p {{ field.name }}=...{% endfor %}{% endcode %} diff --git a/rest_framework/templates/rest_framework/docs/link.html b/rest_framework/templates/rest_framework/docs/link.html index 0f199f440..993d9e3d9 100644 --- a/rest_framework/templates/rest_framework/docs/link.html +++ b/rest_framework/templates/rest_framework/docs/link.html @@ -10,7 +10,7 @@ Interact -