File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
static/rest_framework_docs/js
templates/rest_framework_docs Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -137,6 +137,7 @@ $( document ).ready(function() {
137137 $ ( "#methods .method" ) . removeClass ( 'active' ) ;
138138 // Add 'active' to the clicked button
139139 $ ( this ) . addClass ( 'active' ) ;
140+ _toggleFields ( ) ;
140141 } ) ;
141142 } ;
142143
@@ -152,7 +153,21 @@ $( document ).ready(function() {
152153 }
153154 } ;
154155
156+ var _toggleFields = function ( ) {
157+ // Show/Hide Data depending on method type
158+ var method = $ ( "#methods" ) . find ( ".active" ) . text ( ) ;
159+ if ( method === 'GET' || method === 'OPTIONS' ) {
160+ $ ( '#headerData' ) . hide ( ) ;
161+ $ ( '#fields' ) . hide ( ) ;
162+ } else {
163+ $ ( '#headerData' ) . show ( ) ;
164+ $ ( '#fields' ) . show ( ) ;
165+ }
166+ } ;
167+
155168 var _setupFields = function ( fields ) {
169+ _toggleFields ( ) ;
170+
156171 $ . each ( fields , function ( i , field ) {
157172 var label = field . name . replace ( '_' , ' ' ) ;
158173 $ ( '#fields' ) . append ( "" +
Original file line number Diff line number Diff line change @@ -121,7 +121,7 @@ <h5 class="section-title"><span>Headers</span></h5>
121121 </ div >
122122 </ div >
123123
124- < h5 class ="section-title "> < span > Data</ span > </ h5 >
124+ < h5 class ="section-title " id =" headerData " > < span > Data</ span > </ h5 >
125125 < div id ="fields " class ="fields "> </ div >
126126
127127 < button type ="submit " class ="btn btn-default "> Send</ button >
You can’t perform that action at this time.
0 commit comments