added api info

This commit is contained in:
Tony Tam
2013-07-11 00:26:05 -07:00
parent 187d245047
commit e980cca6b4
10 changed files with 189 additions and 10 deletions

View File

@@ -50,6 +50,8 @@ class SwaggerUi extends Backbone.Router
# so it gets called when SwaggerApi completes loading
render:() ->
@showMessage('Finished Loading Resource Information. Rendering Swagger UI...')
console.log "here it comes!"
console.log @api
@mainView = new MainView({model: @api, el: $('#' + @dom_id)}).render()
@showMessage()
switch @options.docExpansion

View File

@@ -1756,4 +1756,32 @@ pre code {
.message-fail {
color: #cc0000;
}
.info_title {
padding-left: 25px;
padding-bottom: 10px;
font-weight: bold;
font-size: 25px;
}
.info_description {
padding-left: 25px;
padding-bottom: 10px;
font-size: 15px;
}
.info_tos {
padding-left: 25px;
padding-bottom: 5px;
}
.info_license {
padding-left: 25px;
padding-bottom: 5px;
}
.info_contact {
padding-left: 25px;
padding-bottom: 5px;
}

View File

@@ -20,9 +20,8 @@
<script type="text/javascript">
$(function () {
window.swaggerUi = new SwaggerUi({
url:"http://petstore.swagger.wordnik.com/api/api-docs.json",
dom_id:"swagger-ui-container",
supportHeaderParams: false,
url: "http://localhost:8002/api/api-docs",
dom_id: "swagger-ui-container",
supportedSubmitMethods: ['get', 'post', 'put', 'delete'],
onComplete: function(swaggerApi, swaggerUi){
if(console) {

View File

@@ -1,4 +1,12 @@
<div class='info' id='api_info'>
{{#if info}}
<div class="info_title">{{info.title}}</div>
<div class="info_description">{{{info.description}}}</div>
{{#if info.termsOfServiceUrl}}<div class="info_tos"><a href="{{info.termsOfServiceUrl}}">Terms of service</a></div>{{/if}}
{{#if info.contact}}<div class='info_contact'><a href="mailto:{{info.contact}}">Contact the developer</a></div>{{/if}}
{{#if info.license}}<div class='info_license'><a href='{{info.licenseUrl}}'>{{info.license}}</a></div>{{/if}}
{{/if}}
</div>
<div class='container' id='resources_container'>
<ul id='resources'>
</ul>