fixed version

This commit is contained in:
Tony Tam
2014-09-25 21:28:34 -07:00
parent 8918fa1c24
commit d3f373c188
4 changed files with 22 additions and 12 deletions

22
dist/swagger-ui.js vendored
View File

@@ -231,7 +231,7 @@ function program4(depth0,data) {
templates['main'] = template(function (Handlebars,depth0,helpers,partials,data) {
this.compilerInfo = [4,'>= 1.0.0'];
helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this;
var buffer = "", stack1, stack2, functionType="function", escapeExpression=this.escapeExpression, self=this;
function program1(depth0,data) {
@@ -285,10 +285,8 @@ function program6(depth0,data) {
function program8(depth0,data) {
var buffer = "", stack1;
buffer += "\n , <span style=\"font-variant: small-caps\">api version</span>: ";
if (stack1 = helpers.apiVersion) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
else { stack1 = depth0.apiVersion; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
buffer += escapeExpression(stack1)
buffer += "\n , <span style=\"font-variant: small-caps\">api version</span>: "
+ escapeExpression(((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.version)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
+ "\n ";
return buffer;
}
@@ -316,11 +314,11 @@ function program10(depth0,data) {
else { stack1 = depth0.basePath; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
buffer += escapeExpression(stack1)
+ "\n ";
stack1 = helpers['if'].call(depth0, depth0.apiVersion, {hash:{},inverse:self.noop,fn:self.program(8, program8, data),data:data});
if(stack1 || stack1 === 0) { buffer += stack1; }
stack2 = helpers['if'].call(depth0, ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.version), {hash:{},inverse:self.noop,fn:self.program(8, program8, data),data:data});
if(stack2 || stack2 === 0) { buffer += stack2; }
buffer += "]\n ";
stack1 = helpers['if'].call(depth0, depth0.validatorUrl, {hash:{},inverse:self.noop,fn:self.program(10, program10, data),data:data});
if(stack1 || stack1 === 0) { buffer += stack1; }
stack2 = helpers['if'].call(depth0, depth0.validatorUrl, {hash:{},inverse:self.noop,fn:self.program(10, program10, data),data:data});
if(stack2 || stack2 === 0) { buffer += stack2; }
buffer += "\n </h4>\n </div>\n</div>\n";
return buffer;
});
@@ -1508,6 +1506,12 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
this.model.info.license.name = name;
this.model.info.license.url = url;
}
if (!this.model.info) {
this.model.info = {};
}
if (!this.model.info.version) {
this.model.info.version = this.model.apiVersion;
}
if (this.model.url.indexOf('http://localhost') === -1 && this.model.swaggerVersion === 2) {
return this.model.validatorUrl = this.model.url;
}

File diff suppressed because one or more lines are too long

View File

@@ -21,6 +21,12 @@ class MainView extends Backbone.View
@model.info.license.name = name
@model.info.license.url = url
if !@model.info
@model.info = {}
if !@model.info.version
@model.info.version = @model.apiVersion
if @model.url.indexOf('http://localhost') is -1 and @model.swaggerVersion is 2
@model.validatorUrl = @model.url

View File

@@ -15,8 +15,8 @@
<br>
<br>
<h4 style="color: #999">[ <span style="font-variant: small-caps">base url</span>: {{basePath}}
{{#if apiVersion}}
, <span style="font-variant: small-caps">api version</span>: {{apiVersion}}
{{#if info.version}}
, <span style="font-variant: small-caps">api version</span>: {{info.version}}
{{/if}}]
{{#if validatorUrl}}
<span style="float:right"><a href="http://online.swagger.io/validator/debug?url={{url}}"><img id="foo" src="http://online.swagger.io/validator?url={{url}}"></a>