#254 alphabetical sort of apis and operations under apis
new option sortAlphabetical=true|false
This commit is contained in:
@@ -1,5 +1,12 @@
|
||||
class MainView extends Backbone.View
|
||||
initialize: ->
|
||||
initialize: (opts={}) ->
|
||||
if opts.swaggerOptions.sortAlphabetically == true
|
||||
pathSorter = (a,b) -> return a.path.localeCompare(b.path)
|
||||
# sort apis
|
||||
@model.apisArray.sort pathSorter
|
||||
# sort operations
|
||||
for route in @model.apisArray
|
||||
route.operationsArray.sort pathSorter
|
||||
|
||||
render: ->
|
||||
# Render the outer container for resources
|
||||
@@ -10,6 +17,7 @@ class MainView extends Backbone.View
|
||||
resources = {}
|
||||
counter = 0
|
||||
for resource in @model.apisArray
|
||||
console.info(resource);
|
||||
id = resource.name
|
||||
while typeof resources[id] isnt 'undefined'
|
||||
id = id + "_" + counter
|
||||
@@ -25,4 +33,4 @@ class MainView extends Backbone.View
|
||||
$('#resources').append resourceView.render().el
|
||||
|
||||
clear: ->
|
||||
$(@el).html ''
|
||||
$(@el).html ''
|
||||
|
||||
Reference in New Issue
Block a user