aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/issues/app.js
blob: 12e5671c5c31e88b8b5e9f9d9c9d1ab5507e6c80 (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
define([
  './models/state',
  './layout',
  './models/issues',
  'components/navigator/models/facets',
  './models/filters',
  './controller',
  './router',
  './workspace-list-view',
  './workspace-header-view',
  './facets-view',
  './filters-view',
  './helpers/format-facet-value'
], function (State, Layout, Issues, Facets, Filters, Controller, Router, WorkspaceListView, WorkspaceHeaderView,
             FacetsView, FiltersView) {

  var $ = jQuery,
      App = new Marionette.Application(),
      init = function (options) {
        this.state = new State();
        this.list = new Issues();
        this.facets = new Facets();
        this.filters = new Filters();

        this.layout = new Layout({ app: this, el: options.el });
        this.layout.render();
        $('#footer').addClass('search-navigator-footer');

        this.controller = new Controller({ app: this });

        this.issuesView = new WorkspaceListView({
          app: this,
          collection: this.list
        });
        this.layout.workspaceListRegion.show(this.issuesView);
        this.issuesView.bindScrollEvents();

        this.workspaceHeaderView = new WorkspaceHeaderView({
          app: this,
          collection: this.list
        });
        this.layout.workspaceHeaderRegion.show(this.workspaceHeaderView);

        this.facetsView = new FacetsView({
          app: this,
          collection: this.facets
        });
        this.layout.facetsRegion.show(this.facetsView);

        this.filtersView = new FiltersView({
          app: this,
          collection: this.filters
        });
        this.layout.filtersRegion.show(this.filtersView);

        this.controller.fetchFilters().done(function () {
          key.setScope('list');
          App.router = new Router({ app: App });
          Backbone.history.start();
        });
      };

  App.on('start', function (options) {
    $.when(window.requestMessages()).done(function () {
      init.call(App, options);
    });
  });

  return App;

});