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; var buffer = "", stack1;
buffer += "\n "; 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; } if(stack1 || stack1 === 0) { buffer += stack1; }
buffer += "\n "; buffer += "\n ";
return buffer; return buffer;
@@ -552,8 +552,8 @@ function program5(depth0,data) {
else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
buffer += escapeExpression(stack1) buffer += escapeExpression(stack1)
+ "'>"; + "'>";
if (stack1 = helpers.defaultValue) { stack1 = stack1.call(depth0, {hash:{},data:data}); } if (stack1 = helpers['default']) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
else { stack1 = depth0.defaultValue; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } else { stack1 = depth0['default']; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
buffer += escapeExpression(stack1) buffer += escapeExpression(stack1)
+ "</textarea>\n "; + "</textarea>\n ";
return buffer; return buffer;
@@ -583,7 +583,7 @@ function program10(depth0,data) {
var buffer = "", stack1; var buffer = "", stack1;
buffer += "\n "; 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; } if(stack1 || stack1 === 0) { buffer += stack1; }
buffer += "\n "; buffer += "\n ";
return buffer; return buffer;
@@ -596,8 +596,8 @@ function program11(depth0,data) {
else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
buffer += escapeExpression(stack1) buffer += escapeExpression(stack1)
+ "' placeholder='' type='text' value='"; + "' placeholder='' type='text' value='";
if (stack1 = helpers.defaultValue) { stack1 = stack1.call(depth0, {hash:{},data:data}); } if (stack1 = helpers['default']) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
else { stack1 = depth0.defaultValue; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } else { stack1 = depth0['default']; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
buffer += escapeExpression(stack1) buffer += escapeExpression(stack1)
+ "'/>\n "; + "'/>\n ";
return buffer; return buffer;
@@ -2226,6 +2226,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
if (type && type.toLowerCase() === 'file') { if (type && type.toLowerCase() === 'file') {
this.model.isFile = true; this.model.isFile = true;
} }
this.model["default"] = this.model["default"] || this.model.defaultValue;
template = this.template(); template = this.template();
$(this.el).html(template(this.model)); $(this.el).html(template(this.model));
signatureModel = { 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.paramType = @model.in || @model.paramType
@model.isBody = true if @model.paramType == 'body' @model.isBody = true if @model.paramType == 'body'
@model.isFile = true if type and type.toLowerCase() == 'file' @model.isFile = true if type and type.toLowerCase() == 'file'
#@model.signature = type @model.default = (@model.default || @model.defaultValue)
template = @template() template = @template()
$(@el).html(template(@model)) $(@el).html(template(@model))

View File

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