Skip to content

Commit

Permalink
Update SwaggerUi.coffee
Browse files Browse the repository at this point in the history
add helpers for collapse/list/expand all operations.
  • Loading branch information
dnozay committed Dec 1, 2014
1 parent 855c015 commit 9b4f6f6
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/main/coffeescript/SwaggerUi.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,27 @@ class SwaggerUi extends Backbone.Router
@api = new SwaggerClient(@options)
@api.build()

# collapse all sections
collapseAll:() ->
Docs.collapseEndpointListForResource('')

# list operations for all sections
listAll:() ->
Docs.collapseOperationsForResource('')

# expand operations for all sections
expandAll:() ->
Docs.expandOperationsForResource('')

# This is bound to success handler for SwaggerApi
# so it gets called when SwaggerApi completes loading
render:() ->
@showMessage('Finished Loading Resource Information. Rendering Swagger UI...')
@mainView = new MainView({model: @api, el: $('#' + @dom_id), swaggerOptions: @options}).render()
@showMessage()
switch @options.docExpansion
when "full" then Docs.expandOperationsForResource('')
when "list" then Docs.collapseOperationsForResource('')
when "full" then @expandAll()
when "list" then @listAll()
@options.onComplete(@api, @) if @options.onComplete
setTimeout(
=>
Expand Down

0 comments on commit 9b4f6f6

Please sign in to comment.