Render externalDocs when it's available

This commit is contained in:
Mohsen Azimi
2015-03-05 13:51:16 -08:00
parent eeb83a40bd
commit 3e9ef059ec
4 changed files with 39 additions and 22 deletions

View File

@@ -21,7 +21,7 @@ class MainView extends Backbone.View
else
# Default validator
@model.validatorUrl = "http://online.swagger.io/validator"
render: ->
if @model.securityDefinitions
for name of @model.securityDefinitions
@@ -61,10 +61,10 @@ class MainView extends Backbone.View
# Render a resource and add it to resources li
resource.id = resource.id.replace(/\s/g, '_')
resourceView = new ResourceView({
model: resource,
tagName: 'li',
id: 'resource_' + resource.id,
className: 'resource',
model: resource,
tagName: 'li',
id: 'resource_' + resource.id,
className: 'resource',
auths: auths,
swaggerOptions: @options.swaggerOptions
})

View File

@@ -2,6 +2,11 @@
{{#if info}}
<div class="info_title">{{info.title}}</div>
<div class="info_description markdown">{{{info.description}}}</div>
{{#if externalDocs}}
<h5>More documentations</h5>
<p>{{externalDocs.description}}</p>
<a href="{{externalDocs.url}}" target="_blank">{{externalDocs.url}}</a>
{{/if}}
{{#if info.termsOfServiceUrl}}<div class="info_tos"><a href="{{info.termsOfServiceUrl}}">Terms of service</a></div>{{/if}}
{{#if info.contact.name}}<div class='info_name'>Created by {{info.contact.name}}</div>{{/if}}
{{#if info.contact.url}}<div class='info_url'>See more at <a href="{{info.contact.url}}">{{info.contact.url}}</a></div>{{/if}}