templates: separate GET and POST params presentation (#39037)

This commit is contained in:
Serghei Mihai 2020-01-16 17:54:16 +01:00
parent ef461dcff6
commit 09fbf833e9
1 changed files with 21 additions and 23 deletions

View File

@ -63,31 +63,29 @@
<li class="{{ endpoint.http_method|default:"get" }}-method">{% if endpoint.description %}<span class="description">{{endpoint.description}}{% trans ':' %}</span>{% endif %}
<a href="{{endpoint.example_url}}" class="example-url">{{ site_base_uri }}{{endpoint.example_url_as_html}}</a>
<span class="method-name">{{endpoint.http_method|upper}}</span>
{% if endpoint.get_params %}
<ul class="params">
{% if endpoint.get_params %}
<li>{% trans "Query parameters" %}
<ul class="get-params">
{% for param in endpoint.get_params %}
<li><span class="param-name">{{param.name}}</span>
{% if param.optional %}<span class="param-optional">({% trans 'optional' %}{% if param.default_value %},
{% trans 'default value:' %} {{param.default_value}}{% endif %})</span>{% endif %}
{% if param.description %}{% trans ':' %} {{param.description}}{% endif %}
<span class="type">({% if param.type %}{{ param.type }}{% else %}string{% endif %})</span>
</li>
{% endfor %}
</ul>
</li>
{% endif %}
{% if endpoint.body_schemas %}
<li><span class="params-title">{% trans "Request body" %}</span>
<div class="body-schemas">
{% render_body_schemas body_schemas=endpoint.body_schemas %}
</div>
</li>
{% endif %}
</ul>
{% if endpoint.get_params %}
<li>{% trans "Query parameters" %}
<ul class="get-params">
{% for param in endpoint.get_params %}
<li><span class="param-name">{{param.name}}</span>
{% if param.optional %}<span class="param-optional">({% trans 'optional' %}{% if param.default_value %},
{% trans 'default value:' %} {{param.default_value}}{% endif %})</span>{% endif %}
{% if param.description %}{% trans ':' %} {{param.description}}{% endif %}
<span class="type">({% if param.type %}{{ param.type }}{% else %}string{% endif %})</span>
</li>
{% endfor %}
</ul>
</li>
{% endif %}
{% if endpoint.body_schemas %}
<li><span class="params-title">{% trans "Request body" %}</span>
<div class="body-schemas">
{% render_body_schemas body_schemas=endpoint.body_schemas %}
</div>
</li>
{% endif %}
</ul>
{% if endpoint.long_description %}
<div class="long-description">
{{ endpoint.long_description }}