aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/coffee/api-documentation/router.coffee
blob: 14a0cfc8b9865f95712531553080007fbb0ad86c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
define [
  'backbone',
  'api-documentation/collections/web-service-actions',
  'api-documentation/views/api-documentation-actions-list-view',
], (
  Backbone,
  WebServiceActions,
  ApiDocumentationActionsListView
) ->

  class ApiDocumentationRouter extends Backbone.Router

    routes:
      '*path': 'show'


    initialize: (options) ->
      @app = options.app


    show: (path) ->
      webService = @app.webServices.get path
      if webService
        @app.apiDocumentationListView.highlight path

        actions = new WebServiceActions webService.get('actions'), path: path
        actionsListView = new ApiDocumentationActionsListView
          app: @app
          collection: actions
          model: webService

        @app.layout.detailsRegion.show actionsListView