This commit is contained in:
Tony Tam
2015-01-29 23:56:04 -08:00
3 changed files with 16 additions and 16 deletions

View File

@@ -16,7 +16,7 @@ class OperationView extends Backbone.View
@
mouseEnter: (e) ->
elem = $(e.currentTarget.parentNode).find('#api_information_panel')
elem = $(@el).find '.content'
x = e.pageX
y = e.pageY
scX = $(window).scrollLeft()
@@ -98,7 +98,7 @@ class OperationView extends Backbone.View
sampleJSON: @model.responseSampleJSON
isParam: false
signature: @model.responseClassSignature
responseSignatureView = new SignatureView({model: signatureModel, tagName: 'div'})
$('.model-signature', $(@el)).append responseSignatureView.render().el
else
@@ -147,7 +147,7 @@ class OperationView extends Backbone.View
# Render status codes
statusCodeView = new StatusCodeView({model: statusCode, tagName: 'tr'})
$('.operation-status', $(@el)).append statusCodeView.render().el
submitOperation: (e) ->
e?.preventDefault()
# Check for errors
@@ -185,7 +185,7 @@ class OperationView extends Backbone.View
if(o.value? && jQuery.trim(o.value).length > 0)
map[o.name] = o.value
for o in form.find("select")
for o in form.find("select")
val = this.getSelectedValue o
if(val? && jQuery.trim(val).length > 0)
map[o.name] = val
@@ -229,7 +229,7 @@ class OperationView extends Backbone.View
bodyParam.append($(el).attr('name'), el.files[0])
params += 1
@invocationUrl =
@invocationUrl =
if @model.supportHeaderParams()
headerParams = @model.getHeaderParams(map)
delete headerParams['Content-Type']
@@ -237,10 +237,10 @@ class OperationView extends Backbone.View
else
@model.urlify(map, true)
$(".request_url", $(@el)).html("<pre></pre>")
$(".request_url", $(@el)).html("<pre></pre>")
$(".request_url pre", $(@el)).text(@invocationUrl);
obj =
obj =
type: @model.method
url: @invocationUrl
headers: headerParams
@@ -286,12 +286,12 @@ class OperationView extends Backbone.View
o
getSelectedValue: (select) ->
if !select.multiple
if !select.multiple
select.value
else
options = []
options.push opt.value for opt in select.options when opt.selected
if options.length > 0
if options.length > 0
options
else
null
@@ -327,7 +327,7 @@ class OperationView extends Backbone.View
lines = xml.split('\n')
indent = 0
lastType = 'other'
# 4 types of tags - single, closing, opening, other (text, doctype, comment) - 4*4 = 16 transitions
# 4 types of tags - single, closing, opening, other (text, doctype, comment) - 4*4 = 16 transitions
transitions =
'single->single': 0
'single->closing': -1
@@ -371,9 +371,9 @@ class OperationView extends Backbone.View
formatted = formatted.substr(0, formatted.length - 1) + ln + '\n'
else
formatted += padding + ln + '\n'
formatted
# puts the response data in UI
showStatus: (response) ->
@@ -420,7 +420,7 @@ class OperationView extends Backbone.View
pre = $('<pre class="json" />').append(code)
response_body = pre
$(".request_url", $(@el)).html("<pre></pre>")
$(".request_url", $(@el)).html("<pre></pre>")
$(".request_url pre", $(@el)).text(url);
$(".response_code", $(@el)).html "<pre>" + response.status + "</pre>"
$(".response_body", $(@el)).html response_body