JSONEditor enable/disable flag

This commit is contained in:
laurent lepinay
2015-03-12 07:12:07 -07:00
parent bfca6020d2
commit 447b905132
12 changed files with 1181 additions and 20 deletions

View File

@@ -175,7 +175,7 @@ class OperationView extends Backbone.View
# will replace it with the text "root" which won't look good on screen
param.schema.title = " "
paramView = new ParameterView({model: param, tagName: 'tr', readOnly: @model.isReadOnly})
paramView = new ParameterView({model: param, tagName: 'tr', readOnly: @model.isReadOnly, swaggerOptions: @options.swaggerOptions})
$('.operation-params', $(@el)).append paramView.render().el
addStatusCode: (statusCode) ->

View File

@@ -44,7 +44,7 @@ class ParameterView extends Backbone.View
isParam = false
if @model.isBody && @model.schema
if @options.swaggerOptions.jsonEditor && @model.isBody && @model.schema
$self = $(@el)
@model.jsonEditor =
new JSONEditor($('.editor_holder', $self)[0],
@@ -52,6 +52,8 @@ class ParameterView extends Backbone.View
# 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
$('.body-textarea', $self).hide()
$('.editor_holder', $self).show()
$('.parameter-content-type', $self)
.change(
(e) ->
@@ -63,8 +65,6 @@ class ParameterView extends Backbone.View
$('.body-textarea', $self).hide()
$('.editor_holder', $self).show()
@model.jsonEditor.enable())
isParam = true
if @model.isBody
isParam = true

1155
src/main/html/css/print.css Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -433,7 +433,6 @@
width: 300px;
height: 100px;
border: 1px solid #aaa;
display: none;
}
.swagger-section .swagger-ui-wrap .markdown p code,
.swagger-section .swagger-ui-wrap .markdown li code {

View File

@@ -53,7 +53,8 @@
log("Unable to Load SwaggerUI");
},
docExpansion: "none",
sorter : "alpha"
sorter : "alpha",
jsonEditor:true
});
function addApiKeyAuthorization() {

View File

@@ -330,7 +330,6 @@
width: 300px;
height: 100px;
border: 1px solid #aaa;
display: none;
}
.markdown p code, .markdown li code {

View File

@@ -8,11 +8,12 @@
{{else}}
{{#if default}}
<div class="editor_holder"></div>
<textarea class='body-textarea' name='{{name}}'>{{default}}</textarea>
<br />
<div class="parameter-content-type" />
{{else}}
<textarea class='body-textarea' name='{{name}}'></textarea>
<div class="editor_holder"></div>
<div class="editor_holder"></div>
<br />
<div class="parameter-content-type" />
{{/if}}