diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2015-09-10 10:42:07 +0200 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2015-09-10 12:26:16 +0200 |
commit | e1b6cbcba2e342b4671a1bf88e1fd174b55b44cf (patch) | |
tree | 38069eebe3c0ccbcfc2e612f74dbd1dfd772c380 /server/sonar-web/src/main/js/apps/users | |
parent | 5981d630ff9637a78868d989f22a3f10f15306c5 (diff) | |
download | sonarqube-e1b6cbcba2e342b4671a1bf88e1fd174b55b44cf.tar.gz sonarqube-e1b6cbcba2e342b4671a1bf88e1fd174b55b44cf.zip |
Revert "use single web app"
Diffstat (limited to 'server/sonar-web/src/main/js/apps/users')
13 files changed, 30 insertions, 39 deletions
diff --git a/server/sonar-web/src/main/js/apps/users/app.js b/server/sonar-web/src/main/js/apps/users/app.js index 575f2afc320..9fa9df3759a 100644 --- a/server/sonar-web/src/main/js/apps/users/app.js +++ b/server/sonar-web/src/main/js/apps/users/app.js @@ -1,12 +1,11 @@ define([ - 'backbone.marionette', './layout', './users', './header-view', './search-view', './list-view', './list-footer-view' -], function (Marionette, Layout, Users, HeaderView, SearchView, ListView, ListFooterView) { +], function (Layout, Users, HeaderView, SearchView, ListView, ListFooterView) { var App = new Marionette.Application(), init = function (options) { @@ -38,7 +37,9 @@ define([ }; App.on('start', function (options) { - init.call(App, options); + window.requestMessages().done(function () { + init.call(App, options); + }); }); return App; diff --git a/server/sonar-web/src/main/js/apps/users/change-password-view.js b/server/sonar-web/src/main/js/apps/users/change-password-view.js index edda928fb99..659d3012a79 100644 --- a/server/sonar-web/src/main/js/apps/users/change-password-view.js +++ b/server/sonar-web/src/main/js/apps/users/change-password-view.js @@ -6,8 +6,8 @@ define([ return ModalForm.extend({ template: Templates['users-change-password'], - onFormSubmit: function () { - ModalForm.prototype.onFormSubmit.apply(this, arguments); + onFormSubmit: function (e) { + this._super(e); this.sendRequest(); }, diff --git a/server/sonar-web/src/main/js/apps/users/deactivate-view.js b/server/sonar-web/src/main/js/apps/users/deactivate-view.js index 26143c09b2e..000a350ea57 100644 --- a/server/sonar-web/src/main/js/apps/users/deactivate-view.js +++ b/server/sonar-web/src/main/js/apps/users/deactivate-view.js @@ -6,8 +6,8 @@ define([ return ModalForm.extend({ template: Templates['users-deactivate'], - onFormSubmit: function () { - ModalForm.prototype.onFormSubmit.apply(this, arguments); + onFormSubmit: function (e) { + this._super(e); this.sendRequest(); }, diff --git a/server/sonar-web/src/main/js/apps/users/form-view.js b/server/sonar-web/src/main/js/apps/users/form-view.js index c05f57afc09..50b18c1d237 100644 --- a/server/sonar-web/src/main/js/apps/users/form-view.js +++ b/server/sonar-web/src/main/js/apps/users/form-view.js @@ -9,23 +9,23 @@ define([ template: Templates['users-form'], events: function () { - return _.extend(ModalForm.prototype.events.apply(this, arguments), { + return _.extend(this._super(), { 'click #create-user-add-scm-account': 'onAddScmAccountClick' }); }, onRender: function () { - ModalForm.prototype.onRender.apply(this, arguments); + this._super(); this.$('[data-toggle="tooltip"]').tooltip({ container: 'body', placement: 'bottom' }); }, onDestroy: function () { - ModalForm.prototype.onDestroy.apply(this, arguments); + this._super(); this.$('[data-toggle="tooltip"]').tooltip('destroy'); }, - onFormSubmit: function () { - ModalForm.prototype.onFormSubmit.apply(this, arguments); + onFormSubmit: function (e) { + this._super(e); this.sendRequest(); }, diff --git a/server/sonar-web/src/main/js/apps/users/groups-view.js b/server/sonar-web/src/main/js/apps/users/groups-view.js index 2949f0acee6..09a127fc6fd 100644 --- a/server/sonar-web/src/main/js/apps/users/groups-view.js +++ b/server/sonar-web/src/main/js/apps/users/groups-view.js @@ -9,8 +9,7 @@ define([ itemTemplate: Templates['users-group'], onRender: function () { - Modal.prototype.onRender.apply(this, arguments); - //noinspection Eslint + this._super(); new window.SelectList({ el: this.$('#users-groups'), width: '100%', @@ -20,9 +19,9 @@ define([ return item.name + '<br><span class="note">' + item.description + '</span>'; }, queryParam: 'q', - searchUrl: window.baseUrl + '/api/users/groups?ps=100&login=' + this.model.id, - selectUrl: window.baseUrl + '/api/usergroups/add_user', - deselectUrl: window.baseUrl + '/api/usergroups/remove_user', + searchUrl: baseUrl + '/api/users/groups?ps=100&login=' + this.model.id, + selectUrl: baseUrl + '/api/usergroups/add_user', + deselectUrl: baseUrl + '/api/usergroups/remove_user', extra: { login: this.model.id }, diff --git a/server/sonar-web/src/main/js/apps/users/header-view.js b/server/sonar-web/src/main/js/apps/users/header-view.js index a07bd44e6e0..c8b76193b4c 100644 --- a/server/sonar-web/src/main/js/apps/users/header-view.js +++ b/server/sonar-web/src/main/js/apps/users/header-view.js @@ -1,8 +1,7 @@ define([ - 'backbone.marionette', './create-view', './templates' -], function (Marionette, CreateView) { +], function (CreateView) { return Marionette.ItemView.extend({ template: Templates['users-header'], diff --git a/server/sonar-web/src/main/js/apps/users/layout.js b/server/sonar-web/src/main/js/apps/users/layout.js index 3fb4ee142bb..9acb054bdad 100644 --- a/server/sonar-web/src/main/js/apps/users/layout.js +++ b/server/sonar-web/src/main/js/apps/users/layout.js @@ -1,7 +1,6 @@ define([ - 'backbone.marionette', './templates' -], function (Marionette) { +], function () { return Marionette.LayoutView.extend({ template: Templates['users-layout'], diff --git a/server/sonar-web/src/main/js/apps/users/list-footer-view.js b/server/sonar-web/src/main/js/apps/users/list-footer-view.js index 7758d24d75b..cf802586354 100644 --- a/server/sonar-web/src/main/js/apps/users/list-footer-view.js +++ b/server/sonar-web/src/main/js/apps/users/list-footer-view.js @@ -1,7 +1,6 @@ define([ - 'backbone.marionette', './templates' -], function (Marionette) { +], function () { return Marionette.ItemView.extend({ template: Templates['users-list-footer'], @@ -24,7 +23,7 @@ define([ }, serializeData: function () { - return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), { + return _.extend(this._super(), { total: this.collection.total, count: this.collection.length, more: this.collection.hasMore() diff --git a/server/sonar-web/src/main/js/apps/users/list-item-view.js b/server/sonar-web/src/main/js/apps/users/list-item-view.js index b123e560225..b11e39e2766 100644 --- a/server/sonar-web/src/main/js/apps/users/list-item-view.js +++ b/server/sonar-web/src/main/js/apps/users/list-item-view.js @@ -1,11 +1,10 @@ define([ - 'backbone.marionette', './update-view', './change-password-view', './deactivate-view', './groups-view', './templates' -], function (Marionette, UpdateView, ChangePasswordView, DeactivateView, GroupsView) { +], function (UpdateView, ChangePasswordView, DeactivateView, GroupsView) { return Marionette.ItemView.extend({ tagName: 'li', @@ -102,7 +101,7 @@ define([ scmAccountsLimit = scmAccounts.length > this.scmLimit ? this.scmLimit - 1 : this.scmLimit, groups = this.model.get('groups'), groupsLimit = groups.length > this.groupsLimit ? this.groupsLimit - 1 : this.groupsLimit; - return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), { + return _.extend(this._super(), { firstScmAccounts: _.first(scmAccounts, scmAccountsLimit), moreScmAccountsCount: scmAccounts.length - scmAccountsLimit, firstGroups: _.first(groups, groupsLimit), diff --git a/server/sonar-web/src/main/js/apps/users/list-view.js b/server/sonar-web/src/main/js/apps/users/list-view.js index b56e64f951d..24878864d30 100644 --- a/server/sonar-web/src/main/js/apps/users/list-view.js +++ b/server/sonar-web/src/main/js/apps/users/list-view.js @@ -1,8 +1,7 @@ define([ - 'backbone.marionette', './list-item-view', './templates' -], function (Marionette, ListItemView) { +], function (ListItemView) { return Marionette.CollectionView.extend({ tagName: 'ul', diff --git a/server/sonar-web/src/main/js/apps/users/search-view.js b/server/sonar-web/src/main/js/apps/users/search-view.js index 295f50b0b4b..5129bf5a253 100644 --- a/server/sonar-web/src/main/js/apps/users/search-view.js +++ b/server/sonar-web/src/main/js/apps/users/search-view.js @@ -1,7 +1,6 @@ define([ - 'backbone.marionette', './templates' -], function (Marionette) { +], function () { return Marionette.ItemView.extend({ template: Templates['users-search'], diff --git a/server/sonar-web/src/main/js/apps/users/user.js b/server/sonar-web/src/main/js/apps/users/user.js index e438a4b5f22..746ffe8bdd7 100644 --- a/server/sonar-web/src/main/js/apps/users/user.js +++ b/server/sonar-web/src/main/js/apps/users/user.js @@ -1,12 +1,10 @@ -define([ - 'backbone' -], function (Backbone) { +define(function () { return Backbone.Model.extend({ idAttribute: 'login', urlRoot: function () { - return window.baseUrl + '/api/users'; + return baseUrl + '/api/users'; }, defaults: function () { diff --git a/server/sonar-web/src/main/js/apps/users/users.js b/server/sonar-web/src/main/js/apps/users/users.js index 1c199d05ace..9c45979a9fe 100644 --- a/server/sonar-web/src/main/js/apps/users/users.js +++ b/server/sonar-web/src/main/js/apps/users/users.js @@ -1,13 +1,12 @@ define([ - 'backbone', './user' -], function (Backbone, User) { +], function (User) { return Backbone.Collection.extend({ model: User, url: function () { - return window.baseUrl + '/api/users/search'; + return baseUrl + '/api/users/search'; }, parse: function (r) { @@ -20,7 +19,7 @@ define([ fetch: function (options) { var d = (options && options.data) || {}; this.q = d.q; - return Backbone.Collection.prototype.fetch.apply(this, arguments); + return this._super(options); }, fetchMore: function () { |