JSON Editor feature

This commit is contained in:
laurent lepinay
2015-03-09 07:06:24 -07:00
parent 5eaea861a0
commit eb390ffca2
16 changed files with 174 additions and 29 deletions
@@ -44,6 +44,28 @@ class ParameterView extends Backbone.View
isParam = false
if @model.isBody && @model.schema
$self = $(@el)
@model.jsonEditor =
new JSONEditor($('.editor_holder', $self)[0],
{schema: @model.schema, startval : @model.default, ajax:true })
# This is so that the signature can send back the sample to the json editor
# TODO: SignatureView should expose an event "onSampleClicked" instead
signatureModel.jsonEditor = @model.jsonEditor
$('.parameter-content-type', $self)
.change(
(e) ->
if e.target.value == "application/xml"
$('.body-textarea', $self).show()
$('.editor_holder', $self).hide()
@model.jsonEditor.disable()
else
$('.body-textarea', $self).hide()
$('.editor_holder', $self).show()
@model.jsonEditor.enable())
isParam = true
if @model.isBody
isParam = true