diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2015-10-02 15:51:15 +0200 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2015-10-14 10:28:59 +0200 |
commit | 15b2160babc5c35ede960b7d0e133acbec8c6c51 (patch) | |
tree | 6475ad0602bbe4d6dae895aae43d331726ab8c33 /server/sonar-web/src/main/js/apps/update-center | |
parent | e51e9c9eb0145ea5e9d40453554c456585b79936 (diff) | |
download | sonarqube-15b2160babc5c35ede960b7d0e133acbec8c6c51.tar.gz sonarqube-15b2160babc5c35ede960b7d0e133acbec8c6c51.zip |
improve the web build system, introduce gulp and browserify
Diffstat (limited to 'server/sonar-web/src/main/js/apps/update-center')
8 files changed, 29 insertions, 20 deletions
diff --git a/server/sonar-web/src/main/js/apps/update-center/app.js b/server/sonar-web/src/main/js/apps/update-center/app.js index b667f6736b8..01d4c554cc6 100644 --- a/server/sonar-web/src/main/js/apps/update-center/app.js +++ b/server/sonar-web/src/main/js/apps/update-center/app.js @@ -8,9 +8,13 @@ import FooterView from './footer-view'; import Controller from './controller'; import Router from './router'; import Plugins from './plugins'; +import './partials'; +import '../../helpers/handlebars-helpers'; var App = new Marionette.Application(), - init = function (options) { + init = function () { + let options = window.sonarqube; + // State this.state = new Backbone.Model({ updateCenterActive: window.SS.updateCenterActive @@ -53,12 +57,10 @@ var App = new Marionette.Application(), }); }; -App.on('start', function (options) { - window.requestMessages().done(function () { - init.call(App, options); - }); +App.on('start', function () { + init.call(App); }); -export default App; +window.sonarqube.appStarted.then(options => App.start(options)); diff --git a/server/sonar-web/src/main/js/apps/update-center/footer-view.js b/server/sonar-web/src/main/js/apps/update-center/footer-view.js index 085dacf43c2..07f8e622124 100644 --- a/server/sonar-web/src/main/js/apps/update-center/footer-view.js +++ b/server/sonar-web/src/main/js/apps/update-center/footer-view.js @@ -1,9 +1,9 @@ import _ from 'underscore'; import Marionette from 'backbone.marionette'; -import './templates'; +import Template from './templates/update-center-footer.hbs'; export default Marionette.ItemView.extend({ - template: Templates['update-center-footer'], + template: Template, collectionEvents: { 'all': 'render' diff --git a/server/sonar-web/src/main/js/apps/update-center/header-view.js b/server/sonar-web/src/main/js/apps/update-center/header-view.js index 1a78ad8533b..c22354b1233 100644 --- a/server/sonar-web/src/main/js/apps/update-center/header-view.js +++ b/server/sonar-web/src/main/js/apps/update-center/header-view.js @@ -1,9 +1,9 @@ import _ from 'underscore'; import Marionette from 'backbone.marionette'; -import './templates'; +import Template from './templates/update-center-header.hbs'; export default Marionette.ItemView.extend({ - template: Templates['update-center-header'], + template: Template, collectionEvents: { all: 'render' diff --git a/server/sonar-web/src/main/js/apps/update-center/layout.js b/server/sonar-web/src/main/js/apps/update-center/layout.js index 2a8c5d7b4e8..16aad883f3a 100644 --- a/server/sonar-web/src/main/js/apps/update-center/layout.js +++ b/server/sonar-web/src/main/js/apps/update-center/layout.js @@ -1,8 +1,8 @@ import Marionette from 'backbone.marionette'; -import './templates'; +import Template from './templates/update-center-layout.hbs'; export default Marionette.LayoutView.extend({ - template: Templates['update-center-layout'], + template: Template, regions: { headerRegion: '#update-center-header', diff --git a/server/sonar-web/src/main/js/apps/update-center/list-item-view.js b/server/sonar-web/src/main/js/apps/update-center/list-item-view.js index 163d3c61fa0..695994f9e18 100644 --- a/server/sonar-web/src/main/js/apps/update-center/list-item-view.js +++ b/server/sonar-web/src/main/js/apps/update-center/list-item-view.js @@ -2,13 +2,14 @@ import $ from 'jquery'; import Backbone from 'backbone'; import Marionette from 'backbone.marionette'; import PluginChangelogView from './plugin-changelog-view'; -import './templates'; +import Template from './templates/update-center-plugin.hbs'; +import SystemTemplate from './templates/update-center-system-update.hbs'; export default Marionette.ItemView.extend({ tagName: 'li', className: 'panel panel-vertical', - template: Templates['update-center-plugin'], - systemTemplate: Templates['update-center-system-update'], + template: Template, + systemTemplate: SystemTemplate, modelEvents: { 'change:_hidden': 'toggleDisplay', diff --git a/server/sonar-web/src/main/js/apps/update-center/partials.js b/server/sonar-web/src/main/js/apps/update-center/partials.js new file mode 100644 index 00000000000..88483429742 --- /dev/null +++ b/server/sonar-web/src/main/js/apps/update-center/partials.js @@ -0,0 +1,6 @@ +import Handlebars from 'hbsfy/runtime'; +import ChangeEntryPartial from './templates/_update-center-plugin-changelog-entry.hbs'; +import ActionsPartial from './templates/_update-center-plugin-actions.hbs'; + +Handlebars.registerPartial('_update-center-plugin-changelog-entry', ChangeEntryPartial); +Handlebars.registerPartial('_update-center-plugin-actions', ActionsPartial); diff --git a/server/sonar-web/src/main/js/apps/update-center/plugin-changelog-view.js b/server/sonar-web/src/main/js/apps/update-center/plugin-changelog-view.js index 56ce094b922..c07b2d3c7ac 100644 --- a/server/sonar-web/src/main/js/apps/update-center/plugin-changelog-view.js +++ b/server/sonar-web/src/main/js/apps/update-center/plugin-changelog-view.js @@ -1,9 +1,9 @@ import _ from 'underscore'; -import Popup from 'components/common/popup'; -import './templates'; +import Popup from '../../components/common/popup'; +import Template from './templates/update-center-plugin-changelog.hbs'; export default Popup.extend({ - template: Templates['update-center-plugin-changelog'], + template: Template, onRender: function () { this._super(); diff --git a/server/sonar-web/src/main/js/apps/update-center/search-view.js b/server/sonar-web/src/main/js/apps/update-center/search-view.js index 739f11a2c96..c711e8a56af 100644 --- a/server/sonar-web/src/main/js/apps/update-center/search-view.js +++ b/server/sonar-web/src/main/js/apps/update-center/search-view.js @@ -1,9 +1,9 @@ import _ from 'underscore'; import Marionette from 'backbone.marionette'; -import './templates'; +import Template from './templates/update-center-search.hbs'; export default Marionette.ItemView.extend({ - template: Templates['update-center-search'], + template: Template, events: { 'change [name="update-center-filter"]': 'onFilterChange', |