|
3 | 3 | {% block apps_menu %}
|
4 | 4 | {% regroup endpoints by labels as endpoints_grouped %}
|
5 | 5 | {% if endpoints_grouped|length > 1 %}
|
6 |
| - <li class="dropdown"> |
7 |
| - <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Jump To <span class="caret"></span></a> |
| 6 | +<li class="dropdown"> |
| 7 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Jump |
| 8 | + To <span class="caret"></span></a> |
8 | 9 | <ul class="dropdown-menu">
|
9 |
| - {% for group in endpoints_grouped %} |
| 10 | + {% for group in endpoints_grouped %} |
10 | 11 | <li><a href="#{{ group.grouper.name|slugify }}-group">{{ group.grouper.name }}</a></li>
|
11 |
| - {% endfor %} |
| 12 | + {% endfor %} |
12 | 13 | </ul>
|
13 |
| - </li> |
| 14 | +</li> |
14 | 15 | {% endif %}
|
15 | 16 | {% endblock %}
|
16 | 17 |
|
17 | 18 |
|
18 | 19 | {% block content %}
|
19 |
| - {% regroup endpoints by labels as endpoints_grouped %} |
20 |
| - {% if endpoints_grouped %} |
21 |
| - {% for group in endpoints_grouped %} |
22 |
| - <h1 id="{{ group.grouper.name|slugify }}-group"> |
23 |
| - {% if group.grouper.parent %} |
24 |
| - <a href="{% url 'drfdocs-filter' group.grouper.parent %}">{{ group.grouper.name }}</a> |
25 |
| - {% endif %} |
26 |
| - </h1> |
| 20 | +{% regroup endpoints by labels as endpoints_grouped %} |
| 21 | +{% if endpoints_grouped %} |
| 22 | +{% for group in endpoints_grouped %} |
| 23 | +<h1 id="{{ group.grouper.name|slugify }}-group"> |
| 24 | + {% if group.grouper.parent %} |
| 25 | + <a href="{% url 'drfdocs-filter' group.grouper.parent %}">{{ group.grouper.name }}</a> |
| 26 | + {% endif %} |
| 27 | +</h1> |
27 | 28 |
|
28 |
| - <div class="panel-group" role="tablist"> |
| 29 | +<div class="panel-group" role="tablist"> |
29 | 30 |
|
30 | 31 | {% for endpoint in group.list %}
|
31 | 32 |
|
32 |
| - <div class="panel panel-default endpoint"> |
| 33 | + <div class="panel panel-default endpoint"> |
33 | 34 |
|
34 | 35 | <div class="panel-heading" role="tab" data-toggle="collapse" data-target="#{{ endpoint.path|slugify }}">
|
35 |
| - <div class="row"> |
36 |
| - <div class="col-md-7"> |
37 |
| - <h4 class="panel-title title"> |
38 |
| - <i class="fa fa-link"></i> {{ endpoint.path }} |
39 |
| - </h4> |
40 |
| - </div> |
| 36 | + <div class="row"> |
| 37 | + <div class="col-md-7"> |
| 38 | + <h4 class="panel-title title"> |
| 39 | + <i class="fa fa-link"></i> {{ endpoint.path }} |
| 40 | + </h4> |
| 41 | + </div> |
41 | 42 |
|
42 |
| - <div class="col-md-5"> |
43 |
| - <ul class="list-inline methods"> |
44 |
| - {% for method in endpoint.allowed_methods %} |
45 |
| - <li class="method {{ method|lower }}">{{ method }}</li> |
46 |
| - {% endfor %} |
47 |
| - <li class="method plug" |
48 |
| - data-toggle="modal" |
49 |
| - data-path="{{ endpoint.path }}" |
50 |
| - data-methods="{{ endpoint.allowed_methods }}" |
51 |
| - data-permissions="{{ endpoint.permissions }}" |
52 |
| - data-fields="{{ endpoint.fields_json }}"> |
53 |
| - <i class="fa fa-plug"></i></li> |
54 |
| - </ul> |
| 43 | + <div class="col-md-5"> |
| 44 | + <ul class="list-inline methods"> |
| 45 | + {% for method in endpoint.allowed_methods %} |
| 46 | + <li class="method {{ method|lower }}">{{ method }}</li> |
| 47 | + {% endfor %} |
| 48 | + <li class="method plug" |
| 49 | + data-toggle="modal" |
| 50 | + data-path="{{ endpoint.path }}" |
| 51 | + data-methods="{{ endpoint.allowed_methods }}" |
| 52 | + data-permissions="{{ endpoint.permissions }}" |
| 53 | + data-fields="{{ endpoint.fields_json }}"> |
| 54 | + <i class="fa fa-plug"></i></li> |
| 55 | + </ul> |
| 56 | + </div> |
55 | 57 | </div>
|
56 |
| - </div> |
57 | 58 | </div>
|
58 | 59 |
|
59 | 60 | <div id="{{ endpoint.path|slugify }}" class="panel-collapse collapse" role="tabpanel">
|
60 |
| - <div class="panel-body"> |
61 |
| - {% if endpoint.docstring %} |
62 |
| - <p class="lead">{{ endpoint.docstring }}</p> |
63 |
| - {% endif %} |
| 61 | + <div class="panel-body"> |
| 62 | + {% if endpoint.docstring %} |
| 63 | + <p class="lead">{{ endpoint.docstring }}</p> |
| 64 | + {% endif %} |
64 | 65 |
|
65 |
| - {% if endpoint.errors %} |
66 |
| - <div class="alert alert-danger" role="alert">Oops! There was something wrong with {{ endpoint.errors }}. Please check your code.</div> |
67 |
| - {% endif %} |
68 |
| - {% if endpoint.fields %} |
69 |
| - <p class="fields-desc">Fields:</p> |
70 |
| - {% with endpoint as item %} |
71 |
| - {% include 'rest_framework_docs/fields.html' %} |
72 |
| - {% endwith %} |
73 |
| - {% elif not endpoint.errors %} |
74 |
| - <p>No fields.</p> |
75 |
| - {% endif %} |
76 |
| - </div> |
| 66 | + {% if endpoint.errors %} |
| 67 | + <div class="alert alert-danger" role="alert">Oops! There was something wrong with {{ endpoint.errors }}. |
| 68 | + Please check your code. |
| 69 | + </div> |
| 70 | + {% endif %} |
| 71 | + {% if endpoint.fields %} |
| 72 | + <p class="fields-desc">Fields:</p> |
| 73 | + {% include 'rest_framework_docs/fields.html' with item=endpoint only %} |
| 74 | + {% elif not endpoint.errors %} |
| 75 | + <p>No fields.</p> |
| 76 | + {% endif %} |
| 77 | + </div> |
77 | 78 | </div>
|
78 |
| - </div> |
| 79 | + </div> |
79 | 80 | {% endfor %}
|
80 | 81 |
|
81 |
| - </div> |
| 82 | +</div> |
82 | 83 |
|
83 |
| - {% endfor %} |
84 |
| - {% elif not query %} |
85 |
| - <h2 class="text-center">There are currently no api endpoints to document.</h2> |
86 |
| - {% else %} |
87 |
| - <h2 class="text-center">No endpoints found for {{ query }}.</h2> |
88 |
| - {% endif %} |
| 84 | +{% endfor %} |
| 85 | +{% elif not query %} |
| 86 | +<h2 class="text-center">There are currently no api endpoints to document.</h2> |
| 87 | +{% else %} |
| 88 | +<h2 class="text-center">No endpoints found for {{ query }}.</h2> |
| 89 | +{% endif %} |
89 | 90 |
|
90 |
| - <!-- Modal --> |
91 |
| - <div class="modal fade api-modal" id="liveAPIModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> |
| 91 | +<!-- Modal --> |
| 92 | +<div class="modal fade api-modal" id="liveAPIModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> |
92 | 93 | <div class="modal-dialog modal-lg" role="document">
|
93 |
| - <div class="modal-content"> |
94 |
| - <div class="modal-header"> |
95 |
| - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> |
96 |
| - <h4 class="modal-title">Live API Endpoints <span class="label label-info">Beta</span></h4> |
97 |
| - </div> |
| 94 | + <div class="modal-content"> |
| 95 | + <div class="modal-header"> |
| 96 | + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span |
| 97 | + aria-hidden="true">×</span></button> |
| 98 | + <h4 class="modal-title">Live API Endpoints <span class="label label-info">Beta</span></h4> |
| 99 | + </div> |
98 | 100 |
|
99 |
| - <div id="liveAPIEndpoints"></div> |
100 |
| - </div> |
| 101 | + <div id="liveAPIEndpoints"></div> |
| 102 | + </div> |
101 | 103 | </div>
|
102 |
| - </div> |
| 104 | +</div> |
103 | 105 |
|
104 | 106 | {% endblock %}
|
0 commit comments