updated templates to support file as body or form params

This commit is contained in:
Tony Tam
2014-08-01 17:13:56 -07:00
parent fbe5278928
commit 2de104aac9
2 changed files with 9 additions and 6 deletions

View File

@@ -162,7 +162,7 @@ class OperationView extends Backbone.View
# add params # add params
for param in @model.parameters for param in @model.parameters
if param.paramType is 'form' if param.paramType is 'form'
if map[param.name] != undefined if param.type.toLowerCase() isnt 'file' and map[param.name] != undefined
bodyParam.append(param.name, map[param.name]) bodyParam.append(param.name, map[param.name])
# headers in operation # headers in operation
@@ -179,8 +179,6 @@ class OperationView extends Backbone.View
bodyParam.append($(el).attr('name'), el.files[0]) bodyParam.append($(el).attr('name'), el.files[0])
params += 1 params += 1
log(bodyParam)
@invocationUrl = @invocationUrl =
if @model.supportHeaderParams() if @model.supportHeaderParams()
headerParams = @model.getHeaderParams(map) headerParams = @model.getHeaderParams(map)

View File

@@ -14,6 +14,10 @@
<div class="parameter-content-type" /> <div class="parameter-content-type" />
{{/if}} {{/if}}
{{/if}} {{/if}}
{{else}}
{{#if isFile}}
<input type="file" name='{{name}}'/>
<div class="parameter-content-type" />
{{else}} {{else}}
{{#if defaultValue}} {{#if defaultValue}}
<input class='parameter' minlength='0' name='{{name}}' placeholder='' type='text' value='{{defaultValue}}'/> <input class='parameter' minlength='0' name='{{name}}' placeholder='' type='text' value='{{defaultValue}}'/>
@@ -21,6 +25,7 @@
<input class='parameter' minlength='0' name='{{name}}' placeholder='' type='text' value=''/> <input class='parameter' minlength='0' name='{{name}}' placeholder='' type='text' value=''/>
{{/if}} {{/if}}
{{/if}} {{/if}}
{{/if}}
</td> </td>
<td>{{{description}}}</td> <td>{{{description}}}</td>