fix for license structure change

This commit is contained in:
Tony Tam
2014-09-18 09:29:52 -07:00
parent ba14498fbd
commit 4ad4b499ee
4 changed files with 23 additions and 7 deletions

18
dist/swagger-ui.js vendored
View File

@@ -1,5 +1,5 @@
// swagger-ui.js // swagger-ui.js
// version 2.0.22 // version 2.0.25
$(function() { $(function() {
// Helper function for vertically aligning DOM elements // Helper function for vertically aligning DOM elements
@@ -275,9 +275,9 @@ function program6(depth0,data) {
var buffer = "", stack1; var buffer = "", stack1;
buffer += "<div class='info_license'><a href='" buffer += "<div class='info_license'><a href='"
+ escapeExpression(((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.licenseUrl)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + escapeExpression(((stack1 = ((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.license)),stack1 == null || stack1 === false ? stack1 : stack1.name)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
+ "'>" + "'>"
+ escapeExpression(((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.license)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) + escapeExpression(((stack1 = ((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.license)),stack1 == null || stack1 === false ? stack1 : stack1.url)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
+ "</a></div>"; + "</a></div>";
return buffer; return buffer;
} }
@@ -1465,7 +1465,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
}; };
MainView.prototype.initialize = function(opts) { MainView.prototype.initialize = function(opts) {
var route, sorter, sorterName, _i, _len, _ref3; var name, route, sorter, sorterName, url, _i, _len, _ref3;
if (opts == null) { if (opts == null) {
opts = {}; opts = {};
} }
@@ -1479,10 +1479,18 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
route.operationsArray.sort(sorter); route.operationsArray.sort(sorter);
} }
if (sorterName === "alpha") { if (sorterName === "alpha") {
return this.model.apisArray.sort(sorter); this.model.apisArray.sort(sorter);
} }
} }
} }
log(this.model);
if (this.model.info.license && typeof this.model.info.license === 'string') {
name = this.model.info.license;
url = this.model.info.licenseUrl;
this.model.info.license = {};
this.model.info.license.name = name;
return this.model.info.license.url = url;
}
}; };
MainView.prototype.render = function() { MainView.prototype.render = function() {

File diff suppressed because one or more lines are too long

View File

@@ -13,6 +13,14 @@ class MainView extends Backbone.View
route.operationsArray.sort sorter route.operationsArray.sort sorter
if (sorterName == "alpha") # sort top level paths if alpha if (sorterName == "alpha") # sort top level paths if alpha
@model.apisArray.sort sorter @model.apisArray.sort sorter
log @model
if @model.info.license and typeof @model.info.license is 'string'
name = @model.info.license
url = @model.info.licenseUrl
@model.info.license = {}
@model.info.license.name = name
@model.info.license.url = url
render: -> render: ->
# Render the outer container for resources # Render the outer container for resources

View File

@@ -4,7 +4,7 @@
<div class="info_description">{{{info.description}}}</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.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.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 info.license}}<div class='info_license'><a href='{{info.license.name}}'>{{info.license.url}}</a></div>{{/if}}
{{/if}} {{/if}}
</div> </div>
<div class='container' id='resources_container'> <div class='container' id='resources_container'>