fix for #626, added support for (default || defaultValue)

This commit is contained in:
Tony Tam
2014-09-29 22:35:30 -07:00
parent a39ab425bf
commit 5823358e73
4 changed files with 13 additions and 12 deletions

13
dist/swagger-ui.js vendored
View File

@@ -539,7 +539,7 @@ function program4(depth0,data) {
var buffer = "", stack1;
buffer += "\n ";
stack1 = helpers['if'].call(depth0, depth0.defaultValue, {hash:{},inverse:self.program(7, program7, data),fn:self.program(5, program5, data),data:data});
stack1 = helpers['if'].call(depth0, depth0['default'], {hash:{},inverse:self.program(7, program7, data),fn:self.program(5, program5, data),data:data});
if(stack1 || stack1 === 0) { buffer += stack1; }
buffer += "\n ";
return buffer;
@@ -552,8 +552,8 @@ function program5(depth0,data) {
else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
buffer += escapeExpression(stack1)
+ "'>";
if (stack1 = helpers.defaultValue) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
else { stack1 = depth0.defaultValue; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
if (stack1 = helpers['default']) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
else { stack1 = depth0['default']; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
buffer += escapeExpression(stack1)
+ "</textarea>\n ";
return buffer;
@@ -583,7 +583,7 @@ function program10(depth0,data) {
var buffer = "", stack1;
buffer += "\n ";
stack1 = helpers['if'].call(depth0, depth0.defaultValue, {hash:{},inverse:self.program(13, program13, data),fn:self.program(11, program11, data),data:data});
stack1 = helpers['if'].call(depth0, depth0['default'], {hash:{},inverse:self.program(13, program13, data),fn:self.program(11, program11, data),data:data});
if(stack1 || stack1 === 0) { buffer += stack1; }
buffer += "\n ";
return buffer;
@@ -596,8 +596,8 @@ function program11(depth0,data) {
else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
buffer += escapeExpression(stack1)
+ "' placeholder='' type='text' value='";
if (stack1 = helpers.defaultValue) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
else { stack1 = depth0.defaultValue; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
if (stack1 = helpers['default']) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
else { stack1 = depth0['default']; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
buffer += escapeExpression(stack1)
+ "'/>\n ";
return buffer;
@@ -2226,6 +2226,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
if (type && type.toLowerCase() === 'file') {
this.model.isFile = true;
}
this.model["default"] = this.model["default"] || this.model.defaultValue;
template = this.template();
$(this.el).html(template(this.model));
signatureModel = {

File diff suppressed because one or more lines are too long

View File

@@ -23,7 +23,7 @@ class ParameterView extends Backbone.View
@model.paramType = @model.in || @model.paramType
@model.isBody = true if @model.paramType == 'body'
@model.isFile = true if type and type.toLowerCase() == 'file'
#@model.signature = type
@model.default = (@model.default || @model.defaultValue)
template = @template()
$(@el).html(template(@model))

View File

@@ -6,8 +6,8 @@
<input type="file" name='{{name}}'/>
<div class="parameter-content-type" />
{{else}}
{{#if defaultValue}}
<textarea class='body-textarea' name='{{name}}'>{{defaultValue}}</textarea>
{{#if default}}
<textarea class='body-textarea' name='{{name}}'>{{default}}</textarea>
{{else}}
<textarea class='body-textarea' name='{{name}}'></textarea>
<br />
@@ -19,8 +19,8 @@
<input type="file" name='{{name}}'/>
<div class="parameter-content-type" />
{{else}}
{{#if defaultValue}}
<input class='parameter' minlength='0' name='{{name}}' placeholder='' type='text' value='{{defaultValue}}'/>
{{#if default}}
<input class='parameter' minlength='0' name='{{name}}' placeholder='' type='text' value='{{default}}'/>
{{else}}
<input class='parameter' minlength='0' name='{{name}}' placeholder='' type='text' value=''/>
{{/if}}