File tree Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ class SwaggerUi extends Backbone.Router
55
55
# so it gets called when SwaggerApi completes loading
56
56
render : () ->
57
57
@ showMessage (' Finished Loading Resource Information. Rendering Swagger UI...' )
58
- @mainView = new MainView ({model : @api , el : $ (' #' + @dom_id )}).render ()
58
+ @mainView = new MainView ({model : @api , el : $ (' #' + @dom_id ), swaggerOptions : @options }).render ()
59
59
@ showMessage ()
60
60
switch @options .docExpansion
61
61
when " full" then Docs .expandOperationsForResource (' ' )
Original file line number Diff line number Diff line change 1
1
class MainView extends Backbone.View
2
- initialize : ->
2
+ initialize : (opts = {}) ->
3
+ if opts .swaggerOptions .sortAlphabetically == true
4
+ pathSorter = (a ,b ) -> return a .path .localeCompare (b .path )
5
+ # sort apis
6
+ @model .apisArray .sort pathSorter
7
+ # sort operations
8
+ for route in @model .apisArray
9
+ route .operationsArray .sort pathSorter
3
10
4
11
render : ->
5
12
# Render the outer container for resources
@@ -10,6 +17,7 @@ class MainView extends Backbone.View
10
17
resources = {}
11
18
counter = 0
12
19
for resource in @model .apisArray
20
+ console .info (resource);
13
21
id = resource .name
14
22
while typeof resources[id] isnt ' undefined'
15
23
id = id + " _" + counter
@@ -25,4 +33,4 @@ class MainView extends Backbone.View
25
33
$ (' #resources' ).append resourceView .render ().el
26
34
27
35
clear : ->
28
- $ (@el ).html ' '
36
+ $ (@el ).html ' '
Original file line number Diff line number Diff line change 47
47
onFailure : function ( data ) {
48
48
log ( "Unable to Load SwaggerUI" ) ;
49
49
} ,
50
- docExpansion : "none"
50
+ docExpansion : "none" ,
51
+ sortAlphabetically : true
51
52
} ) ;
52
53
53
54
$ ( '#input_apiKey' ) . change ( function ( ) {
You can’t perform that action at this time.
0 commit comments