Remove inline event handlers from resource template.
This allows us to use a strict CSP on explorer pages.
This commit is contained in:
@@ -20,7 +20,12 @@ class ResourceView extends Backbone.View
|
||||
operation.nickname = id
|
||||
operation.parentId = @model.id
|
||||
@addOperation operation
|
||||
@
|
||||
|
||||
$('.toggleEndpointList', @el).click(this.callDocs.bind(this, 'toggleEndpointListForResource'))
|
||||
$('.collapseResource', @el).click(this.callDocs.bind(this, 'collapseOperationsForResource'))
|
||||
$('.expandResource', @el).click(this.callDocs.bind(this, 'expandOperationsForResoruce'))
|
||||
|
||||
return @
|
||||
|
||||
addOperation: (operation) ->
|
||||
|
||||
@@ -30,4 +35,12 @@ class ResourceView extends Backbone.View
|
||||
operationView = new OperationView({model: operation, tagName: 'li', className: 'endpoint', swaggerOptions: @options.swaggerOptions})
|
||||
$('.endpoints', $(@el)).append operationView.render().el
|
||||
|
||||
@number++
|
||||
@number++
|
||||
|
||||
#
|
||||
# Generic Event handler (`Docs` is global)
|
||||
#
|
||||
|
||||
callDocs: (fnName, e) ->
|
||||
e.preventDefault()
|
||||
Docs[fnName](e.currentTarget.getAttribute('data-id'))
|
||||
|
||||
Reference in New Issue
Block a user