This commit is contained in:
Ayush Gupta
2012-11-06 11:03:38 +05:30
parent 8d3a5010b4
commit b743c0f3db
11 changed files with 227 additions and 18 deletions

View File

@@ -54,7 +54,7 @@ class SwaggerUi extends Backbone.Router
switch @options.docExpansion
when "full" then Docs.expandOperationsForResource('')
when "list" then Docs.collapseOperationsForResource('')
@options.onComplete() if @options.onComplete
@options.onComplete(@api, @) if @options.onComplete
setTimeout(
=>
Docs.shebang()

View File

@@ -6,6 +6,7 @@ class ParameterView extends Backbone.View
template = @template()
$(@el).html(template(@model))
@
# Return an appropriate template based on if the parameter is a list, readonly, required

View File

@@ -1502,3 +1502,16 @@ body ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operatio
max-height: 400px;
overflow-y: auto;
}
.model-signature {
font-family: "Droid Sans", sans-serif;
font-size: 1em;
line-height: 1.5em;
}
.model-signature span {
font-size: 0.9em;
line-height: 1.5em;
}
.model-signature span:nth-child(odd) { color:#333; }
.model-signature span:nth-child(even) { color:#C5862B; }

View File

@@ -47,8 +47,12 @@
dom_id:"swagger-ui-container",
supportHeaderParams: false,
supportedSubmitMethods: ['get', 'post', 'put'],
onComplete: function(){
if(console) console.log("Loaded SwaggerUI")
onComplete: function(swaggerApi, swaggerUi){
if(console) {
console.log("Loaded SwaggerUI")
console.log(swaggerApi);
console.log(swaggerUi);
}
},
onFailure: function(data) {
if(console) {
@@ -56,7 +60,7 @@
console.log(data);
}
},
docExpansion: "list"
docExpansion: "none"
});
window.swaggerUi.load();

View File

@@ -21,15 +21,24 @@
<h4>Implementation Notes</h4>
<p>{{{notes}}}</p>
{{/if}}
{{#if responseClass}}
<h4>Response Class</h4>
{{#if responseClassSignature}}
<p><span class="model-signature">{{{responseClassSignature}}}</span></p>
{{else}}
<p>{{{responseClass}}}</p>
{{/if}}
{{/if}}
<form accept-charset='UTF-8' class='sandbox'>
<div style='margin:0;padding:0;display:inline'></div>
<h4>Parameters</h4>
<table class='fullwidth'>
<thead>
<tr>
<th>Parameter</th>
<th>Value</th>
<th>Description</th>
<th style="width: 100px; max-width: 100px" >Parameter</th>
<th style="width: 310px; max-width: 310px">Value</th>
<th style="width: 200px; max-width: 200px">Description</th>
<th style="width: 320px; max-width: 330px">Data Type</th>
</tr>
</thead>
<tbody class="operation-params">

View File

@@ -17,5 +17,8 @@
{{/if}}
</td>
<td width='500'>{{{description}}}</td>
<td>{{{description}}}</td>
<td>
<span class="model-signature">{{{signature}}}</span>
</td>

View File

@@ -17,5 +17,5 @@
{{/each}}
</select>
</td>
<td width='500'>{{{description}}}</td>
<td>{{{description}}}</td>
<td><span class="model-signature">{{{signature}}}</span></td>

View File

@@ -6,5 +6,5 @@
{{defaultValue}}
{{/if}}
</td>
<td width='500'>{{{description}}}</td>
<td>{{{description}}}</td>
<td><span class="model-signature">{{{signature}}}</span></td>

View File

@@ -6,4 +6,5 @@
{{defaultValue}}
{{/if}}
</td>
<td width='500'>{{{description}}}</td>
<td>{{{description}}}</td>
<td><span class="model-signature">{{{signature}}}</span></td>

View File

@@ -15,6 +15,7 @@
{{/if}}
{{/if}}
</td>
<td width='500'>
<td>
<strong>{{{description}}}</strong>
</td>
<td><span class="model-signature">{{{signature}}}</span></td>