diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2015-09-17 16:15:28 +0200 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2015-09-18 10:47:27 +0200 |
commit | 890ab0b59cdb3902f4869eabf8ca534814f1b3dd (patch) | |
tree | 0ed74726957e590f6506e378366ea15bf21bfcbd /server/sonar-web/src/main/js/apps/api-documentation/app.js | |
parent | ce60ac8d2e137f33bb111668e54e78c195c73d79 (diff) | |
download | sonarqube-890ab0b59cdb3902f4869eabf8ca534814f1b3dd.tar.gz sonarqube-890ab0b59cdb3902f4869eabf8ca534814f1b3dd.zip |
migrate js apps to es2015 modules
Diffstat (limited to 'server/sonar-web/src/main/js/apps/api-documentation/app.js')
-rw-r--r-- | server/sonar-web/src/main/js/apps/api-documentation/app.js | 118 |
1 files changed, 58 insertions, 60 deletions
diff --git a/server/sonar-web/src/main/js/apps/api-documentation/app.js b/server/sonar-web/src/main/js/apps/api-documentation/app.js index 640cb0ede39..5451cde9da7 100644 --- a/server/sonar-web/src/main/js/apps/api-documentation/app.js +++ b/server/sonar-web/src/main/js/apps/api-documentation/app.js @@ -1,71 +1,69 @@ -define([ - './router', - './controller', - './layout', - './list', - './list-view', - './filters-view', - './search-view' -], function (Router, Controller, Layout, List, ListView, FiltersView, SearchView) { +import $ from 'jquery'; +import Backbone from 'backbone'; +import Marionette from 'backbone.marionette'; +import Router from './router'; +import Controller from './controller'; +import Layout from './layout'; +import List from './list'; +import ListView from './list-view'; +import FiltersView from './filters-view'; +import SearchView from './search-view'; - var $ = jQuery, - App = new Marionette.Application(), - init = function (options) { - // State - this.state = new Backbone.Model({ internal: false }); - this.state.match = function (test) { - var pattern = new RegExp(this.get('query'), 'i'); - return test.search(pattern) !== -1; - }; +var App = new Marionette.Application(), + init = function (options) { + // State + this.state = new Backbone.Model({ internal: false }); + this.state.match = function (test) { + var pattern = new RegExp(this.get('query'), 'i'); + return test.search(pattern) !== -1; + }; - // Layout - this.layout = new Layout({ el: options.el }); - this.layout.render(); - $('#footer').addClass('search-navigator-footer'); + // Layout + this.layout = new Layout({ el: options.el }); + this.layout.render(); + $('#footer').addClass('search-navigator-footer'); - // Web Services List - this.list = new List(); + // Web Services List + this.list = new List(); - // Controller - this.controller = new Controller({ - app: this, - state: this.state - }); + // Controller + this.controller = new Controller({ + app: this, + state: this.state + }); - // List View - this.listView = new ListView({ - collection: this.list, - state: this.state - }); - this.layout.resultsRegion.show(this.listView); + // List View + this.listView = new ListView({ + collection: this.list, + state: this.state + }); + this.layout.resultsRegion.show(this.listView); - // Filters View - this.filtersView = new FiltersView({ - collection: this.list, - state: this.state - }); - this.layout.actionsRegion.show(this.filtersView); + // Filters View + this.filtersView = new FiltersView({ + collection: this.list, + state: this.state + }); + this.layout.actionsRegion.show(this.filtersView); - // Search View - this.searchView = new SearchView({ - state: this.state - }); - this.layout.searchRegion.show(this.searchView); + // Search View + this.searchView = new SearchView({ + state: this.state + }); + this.layout.searchRegion.show(this.searchView); - // Router - this.router = new Router({ app: this }); - Backbone.history.start({ - pushState: true, - root: options.urlRoot - }); - }; + // Router + this.router = new Router({ app: this }); + Backbone.history.start({ + pushState: true, + root: options.urlRoot + }); + }; - App.on('start', function (options) { - window.requestMessages().done(function () { - init.call(App, options); - }); +App.on('start', function (options) { + window.requestMessages().done(function () { + init.call(App, options); }); - - return App; - }); + +export default App; |