File tree Expand file tree Collapse file tree 4 files changed +13
-6
lines changed
static/rest_framework/docs/js
templates/rest_framework/docs Expand file tree Collapse file tree 4 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,14 @@ var responseDisplay = 'data'
2
2
var coreapi = window . coreapi
3
3
var schema = window . schema
4
4
5
+ function normalizeKeys ( arr ) {
6
+ var _normarr = [ ] ;
7
+ for ( var i = 0 ; i < arr . length ; i ++ ) {
8
+ _normarr = _normarr . concat ( arr [ i ] . split ( ' > ' ) ) ;
9
+ }
10
+ return _normarr ;
11
+ }
12
+
5
13
function normalizeHTTPHeader ( str ) {
6
14
// Capitalize HTTP headers for display.
7
15
return ( str . charAt ( 0 ) . toUpperCase ( ) + str . substring ( 1 ) )
@@ -94,7 +102,7 @@ $(function () {
94
102
var $requestAwaiting = $form . find ( '.request-awaiting' )
95
103
var $responseRaw = $form . find ( '.response-raw' )
96
104
var $responseData = $form . find ( '.response-data' )
97
- var key = $form . data ( 'key' )
105
+ var key = normalizeKeys ( $form . data ( 'key' ) )
98
106
var params = { }
99
107
var entries = formEntries ( $form . get ( ) [ 0 ] )
100
108
@@ -212,7 +220,6 @@ $(function () {
212
220
}
213
221
214
222
var client = new coreapi . Client ( options )
215
-
216
223
client . action ( schema , key , params ) . then ( function ( data ) {
217
224
var response = JSON . stringify ( data , null , 2 )
218
225
$requestAwaiting . addClass ( 'hide' )
Original file line number Diff line number Diff line change 1
1
{% load rest_framework %}
2
2
3
3
<!-- Modal -->
4
- < div class ="modal fade api-modal " id ="{{ section_key }}_{{ link_key }}_modal " tabindex ="-1 " role ="dialog " aria-labelledby ="api explorer modal ">
4
+ < div class ="modal fade api-modal " id ="{{ section_key }}_{{ link_key|slugify }}_modal " tabindex ="-1 " role ="dialog " aria-labelledby ="api explorer modal ">
5
5
< div class ="modal-dialog modal-lg " role ="document ">
6
6
< div class ="modal-content ">
7
7
< div class ="modal-header ">
Original file line number Diff line number Diff line change 6
6
class ="btn btn-sm btn-success "
7
7
style ="float: right; margin-top: 20px "
8
8
data-toggle ="modal "
9
- data-target ="#{{ section_key }}_{{ link_key }}_modal ">
9
+ data-target ="#{{ section_key }}_{{ link_key|slugify }}_modal ">
10
10
< i class ="fa fa-exchange "> </ i > Interact
11
11
</ button >
12
12
13
- < h3 id ="{{ section_key }}-{{ link_key }} " class ="coredocs-link-title "> {{ link.title|default:link_key }} < a href ="#{{ section_key }}-{{ link_key }} "> < i class ="fa fa-link " aria-hidden ="true "> </ i >
13
+ < h3 id ="{{ section_key }}-{{ link_key|slugify }} " class ="coredocs-link-title "> {{ link.title|default:link_key }} < a href ="#{{ section_key }}-{{ link_key|slugify }} "> < i class ="fa fa-link " aria-hidden ="true "> </ i >
14
14
</ a > </ h3 >
15
15
16
16
< div class ="meta ">
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ <h3 class="brand"><a href="#">{{ document.title }}</a></h3>
11
11
< a > < i class ="fa fa-dot-circle-o fa-lg "> </ i > {% if section_key %}{{ section_key }}{% else %}API Endpoints{% endif %} < span class ="arrow "> </ span > </ a >
12
12
< ul class ="sub-menu {% if section_key %}collapse{% endif %} " id ="{{ section_key }}-dropdown ">
13
13
{% for link_key, link in section|schema_links|items %}
14
- < li > < a href ="#{{ section_key }}-{{ link_key }} "> {{ link.title|default:link_key }}</ a > </ li >
14
+ < li > < a href ="#{{ section_key }}-{{ link_key|slugify }} "> {{ link.title|default:link_key }}</ a > </ li >
15
15
{% endfor %}
16
16
</ ul >
17
17
</ li >
You can’t perform that action at this time.
0 commit comments