templates adjustments

This commit is contained in:
Emmanuelle Delescolle 2017-03-10 21:23:16 +01:00 committed by Aleksey Zhukov
parent 0ccbe4aca9
commit f98c88c498
6 changed files with 11 additions and 7 deletions

View File

@ -1,6 +1,6 @@
{% for section_key, section in items %}
{% if section_key %}
<h{{level}} id="{{prefix}}-{{ section_key }}" class="coredocs-section-title">{{ section_key }} <a href="#{{ section_key }}"><i class="fa fa-link" aria-hidden="true"></i>
<h{{level}} id="{{prefix}}{{ section_key }}" class="coredocs-section-title">{{ section_key }} <a href="#{{ section_key }}"><i class="fa fa-link" aria-hidden="true"></i>
</a></h{{level}}>
{% endif %}

View File

@ -6,11 +6,15 @@
{% if section.links.items %}
<ul class="sub-menu {% if section_key %}collapse{% endif %}" id="{{prefix}}{{ section_key }}-dropdown">
{% for link_key, link in section.links.items %}
<li><a href="#{{prefix}}-{{ section_key }}-{{ link_key }}">{{ link.title|default:link_key }}</a></li>
<li><a href="#{% if prefix %}{{prefix}}/{% endif %}{{ section_key }}-{{ link_key }}">{{ link.title|default:link_key }}</a></li>
{% endfor %}
</ul>
{% 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 %}
</ul>

View File

@ -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 %}}

View File

@ -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 %}}

View File

@ -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 %}</code></pre>
$ coreapi action {{ prefix|split_keys:'cmd' }}{% if section_key %}{{ section_key }} {% endif %}{{ link_key }}{% for field in link.fields %} -p {{ field.name }}=...{% endfor %}{% endcode %}</code></pre>

View File

@ -10,7 +10,7 @@
<i class="fa fa-exchange"></i> Interact
</button>
<h3 id="{{prefix}}-{{ section_key }}-{{ link_key }}" class="coredocs-link-title">{{ link.title|default:link_key }} <a href="#{{prefix}}-{{ section_key }}-{{ link_key }}"><i class="fa fa-link" aria-hidden="true"></i>
<h3 id="{{prefix}}{{ section_key }}-{{ link_key }}" class="coredocs-link-title">{{ link.title|default:link_key }} <a href="#{{prefix}}{{ section_key }}-{{ link_key }}"><i class="fa fa-link" aria-hidden="true"></i>
</a></h3>
<div class="meta">