Skip to content

Commit 3987d57

Browse files
author
Emmanouil Konstantinidis
committed
Prepare Fields
1 parent 3a28cae commit 3987d57

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

rest_framework_docs/static/rest_framework_docs/js/index.js

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,8 @@ var jsonPP = {
2323
$( document ).ready(function() {
2424

2525
var setResponse = function (method, response) {
26-
27-
console.log(response);
28-
console.log(response.status);
29-
3026
if (method == 'OPTIONS') {
31-
$('#responseData').html(jsonPP.prettyPrint(response));
32-
return;
27+
return $('#responseData').html(jsonPP.prettyPrint(response));
3328
}
3429

3530
// Status Code
@@ -59,9 +54,6 @@ $( document ).ready(function() {
5954

6055
$('#responseStatusText').text(response.statusText.toLowerCase());
6156
$('#responseData').html(jsonPP.prettyPrint(response.responseJSON));
62-
63-
// console.log(response);
64-
// console.log(response.responseJSON);
6557
};
6658

6759
var makeRequest = function () {
@@ -81,12 +73,10 @@ $( document ).ready(function() {
8173
});
8274
};
8375

84-
var setupForm = function (data) {
85-
$('#urlInput').val(data.path);
86-
76+
var _setupMethods = function (methods) {
8777
// List Methods (Radio Buttons)
8878
// FIXME: Use regex - convert to JSON
89-
var methods = data.methods.replace("[", "").replace("]", "").replace(/'/g, "").replace(/\s/g, "").split(',');
79+
var methods = methods.replace("[", "").replace("]", "").replace(/'/g, "").replace(/\s/g, "").split(',');
9080
$.each( methods, function( i, method ) {
9181
var methodClass = "btn btn-sm method " + method.toLowerCase();
9282
$('#methods').append("<button type='button' class='" + methodClass + "'>" + method + "</button>");
@@ -101,6 +91,17 @@ $( document ).ready(function() {
10191
// Add 'active' to the clicked button
10292
$(this).addClass( 'active' );
10393
});
94+
};
95+
96+
var _setupFields = function (fields) {
97+
98+
};
99+
100+
var setupForm = function (data) {
101+
$('#urlInput').val(data.path);
102+
103+
_setupMethods(data.methods);
104+
_setupFields(data.fields);
104105

105106
$('#requestForm').submit(function (e) {
106107
// Prevent Submit

rest_framework_docs/static/rest_framework_docs/less/style.less

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,10 @@ body {
192192
&.options.active { background-color: @OptionsColor; }
193193
}
194194
}
195+
196+
.fields {
197+
198+
}
195199
}
196200

197201
.response {

rest_framework_docs/templates/rest_framework_docs/home.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ <h5>Headers</h5>
115115
</div>
116116

117117
<h5>Data</h5>
118+
<div id="fields" class="fields"></div>
118119
<div class="form-group">
119120
<label for="exampleInputPassword1">Password</label>
120121
<input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password">

0 commit comments

Comments
 (0)