updated from master
This commit is contained in:
@@ -16,6 +16,9 @@ class SwaggerUi extends Backbone.Router
|
||||
@dom_id = options.dom_id
|
||||
delete options.dom_id
|
||||
|
||||
if not options.supportedSubmitMethods?
|
||||
options.supportedSubmitMethods = ['get','put','post','delete','head','options','patch']
|
||||
|
||||
# Create an empty div which contains the dom_id
|
||||
$('body').append('<div id="' + @dom_id + '"></div>') if not $('#' + @dom_id)?
|
||||
|
||||
@@ -59,7 +62,6 @@ class SwaggerUi extends Backbone.Router
|
||||
@headerView.update(url)
|
||||
|
||||
@api = new SwaggerClient(@options)
|
||||
@api.build()
|
||||
|
||||
# collapse all sections
|
||||
collapseAll:() ->
|
||||
@@ -87,7 +89,7 @@ class SwaggerUi extends Backbone.Router
|
||||
setTimeout(
|
||||
=>
|
||||
Docs.shebang()
|
||||
400
|
||||
100
|
||||
)
|
||||
|
||||
buildUrl: (base, url) ->
|
||||
|
||||
@@ -12,7 +12,8 @@ class OperationView extends Backbone.View
|
||||
|
||||
initialize: (opts={}) ->
|
||||
@auths = opts.auths
|
||||
|
||||
@parentId = @model.parentId
|
||||
@nickname = @model.nickname
|
||||
@
|
||||
|
||||
mouseEnter: (e) ->
|
||||
@@ -44,7 +45,7 @@ class OperationView extends Backbone.View
|
||||
$(e.currentTarget.parentNode).find('#api_information_panel').hide()
|
||||
|
||||
render: ->
|
||||
isMethodSubmissionSupported = true #jQuery.inArray(@model.method, @model.supportedSubmitMethods) >= 0
|
||||
isMethodSubmissionSupported = jQuery.inArray(@model.method, @model.supportedSubmitMethods()) >= 0
|
||||
@model.isReadOnly = true unless isMethodSubmissionSupported
|
||||
|
||||
# 1.2 syntax for description was `notes`
|
||||
@@ -452,5 +453,5 @@ class OperationView extends Backbone.View
|
||||
if opts.highlightSizeThreshold && response.data.length > opts.highlightSizeThreshold then response_body_el else hljs.highlightBlock(response_body_el)
|
||||
|
||||
toggleOperationContent: ->
|
||||
elem = $('#' + Docs.escapeResourceName(@model.parentId + "_" + @model.nickname + "_content"))
|
||||
elem = $('#' + Docs.escapeResourceName(@parentId + "_" + @nickname + "_content"))
|
||||
if elem.is(':visible') then Docs.collapseOperation(elem) else Docs.expandOperation(elem)
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
class ResourceView extends Backbone.View
|
||||
initialize: (opts={}) ->
|
||||
@auths = opts.auths
|
||||
if "" is @model.description
|
||||
if "" is @model.description
|
||||
@model.description = null
|
||||
if @model.description?
|
||||
@model.summary = @model.description
|
||||
|
||||
render: ->
|
||||
$(@el).html(Handlebars.templates.resource(@model))
|
||||
|
||||
methods = {}
|
||||
|
||||
if @model.description
|
||||
@model.summary = @model.description
|
||||
|
||||
$(@el).html(Handlebars.templates.resource(@model))
|
||||
|
||||
# Render each operation
|
||||
for operation in @model.operationsArray
|
||||
counter = 0
|
||||
|
||||
@@ -28,12 +28,12 @@
|
||||
if (url && url.length > 1) {
|
||||
url = decodeURIComponent(url[1]);
|
||||
} else {
|
||||
url = "http://petstore.swagger.wordnik.com/v2/swagger.json";
|
||||
url = "http://petstore.swagger.io/v2/swagger.json";
|
||||
}
|
||||
window.swaggerUi = new SwaggerUi({
|
||||
url: url,
|
||||
dom_id: "swagger-ui-container",
|
||||
supportedSubmitMethods: ['get', 'post', 'put', 'delete'],
|
||||
supportedSubmitMethods: ['get', 'post', 'put', 'delete', 'patch'],
|
||||
onComplete: function(swaggerApi, swaggerUi){
|
||||
if(typeof initOAuth == "function") {
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user