JSONEditor enable/disable flag
This commit is contained in:
1
dist/css/print.css
vendored
1
dist/css/print.css
vendored
@@ -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 {
|
||||
|
||||
1
dist/css/screen.css
vendored
1
dist/css/screen.css
vendored
@@ -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 {
|
||||
|
||||
3
dist/index.html
vendored
3
dist/index.html
vendored
@@ -53,7 +53,8 @@
|
||||
log("Unable to Load SwaggerUI");
|
||||
},
|
||||
docExpansion: "none",
|
||||
sorter : "alpha"
|
||||
sorter : "alpha",
|
||||
jsonEditor:true
|
||||
});
|
||||
|
||||
function addApiKeyAuthorization() {
|
||||
|
||||
19
dist/swagger-ui.js
vendored
19
dist/swagger-ui.js
vendored
@@ -627,12 +627,17 @@ this["Handlebars"]["templates"]["param"] = Handlebars.template({"1":function(dep
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
return buffer;
|
||||
},"5":function(depth0,helpers,partials,data) {
|
||||
return " <div class=\"editor_holder\"></div>\n <br />\n <div class=\"parameter-content-type\" />\n";
|
||||
},"7":function(depth0,helpers,partials,data) {
|
||||
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
|
||||
return " <div class=\"editor_holder\"></div>\n <textarea class='body-textarea' name='"
|
||||
+ escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
|
||||
+ "'>"
|
||||
+ escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
|
||||
+ "</textarea>\n <br />\n <div class=\"parameter-content-type\" />\n";
|
||||
},"7":function(depth0,helpers,partials,data) {
|
||||
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
|
||||
return " <textarea class='body-textarea' name='"
|
||||
+ escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
|
||||
+ "'></textarea>\n <div class=\"editor_holder\"></div>\n <br />\n <div class=\"parameter-content-type\" />\n";
|
||||
+ "'></textarea>\n <div class=\"editor_holder\"></div>\n <br />\n <div class=\"parameter-content-type\" />\n";
|
||||
},"9":function(depth0,helpers,partials,data) {
|
||||
var stack1, buffer = "";
|
||||
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.program(10, data),"data":data});
|
||||
@@ -1527,7 +1532,8 @@ OperationView = (function(superClass) {
|
||||
paramView = new ParameterView({
|
||||
model: param,
|
||||
tagName: 'tr',
|
||||
readOnly: this.model.isReadOnly
|
||||
readOnly: this.model.isReadOnly,
|
||||
swaggerOptions: this.options.swaggerOptions
|
||||
});
|
||||
return $('.operation-params', $(this.el)).append(paramView.render().el);
|
||||
};
|
||||
@@ -2021,7 +2027,7 @@ ParameterView = (function(superClass) {
|
||||
$('.model-signature', $(this.el)).html(this.model.signature);
|
||||
}
|
||||
isParam = false;
|
||||
if (this.model.isBody && this.model.schema) {
|
||||
if (this.options.swaggerOptions.jsonEditor && this.model.isBody && this.model.schema) {
|
||||
$self = $(this.el);
|
||||
this.model.jsonEditor = new JSONEditor($('.editor_holder', $self)[0], {
|
||||
schema: this.model.schema,
|
||||
@@ -2029,6 +2035,8 @@ ParameterView = (function(superClass) {
|
||||
ajax: true
|
||||
});
|
||||
signatureModel.jsonEditor = this.model.jsonEditor;
|
||||
$('.body-textarea', $self).hide();
|
||||
$('.editor_holder', $self).show();
|
||||
$('.parameter-content-type', $self).change(function(e) {
|
||||
if (e.target.value === "application/xml") {
|
||||
$('.body-textarea', $self).show();
|
||||
@@ -2040,7 +2048,6 @@ ParameterView = (function(superClass) {
|
||||
return this.model.jsonEditor.enable();
|
||||
}
|
||||
});
|
||||
isParam = true;
|
||||
}
|
||||
if (this.model.isBody) {
|
||||
isParam = true;
|
||||
|
||||
6
dist/swagger-ui.min.js
vendored
6
dist/swagger-ui.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -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) ->
|
||||
|
||||
@@ -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
1155
src/main/html/css/print.css
Normal file
File diff suppressed because it is too large
Load Diff
@@ -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 {
|
||||
|
||||
@@ -53,7 +53,8 @@
|
||||
log("Unable to Load SwaggerUI");
|
||||
},
|
||||
docExpansion: "none",
|
||||
sorter : "alpha"
|
||||
sorter : "alpha",
|
||||
jsonEditor:true
|
||||
});
|
||||
|
||||
function addApiKeyAuthorization() {
|
||||
|
||||
@@ -330,7 +330,6 @@
|
||||
width: 300px;
|
||||
height: 100px;
|
||||
border: 1px solid #aaa;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.markdown p code, .markdown li code {
|
||||
|
||||
@@ -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}}
|
||||
|
||||
Reference in New Issue
Block a user