diff options
Diffstat (limited to 'server/sonar-web/src/main/js/apps/users')
13 files changed, 39 insertions, 30 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 9fa9df3759a..575f2afc320 100644 --- a/server/sonar-web/src/main/js/apps/users/app.js +++ b/server/sonar-web/src/main/js/apps/users/app.js @@ -1,11 +1,12 @@ define([ + 'backbone.marionette', './layout', './users', './header-view', './search-view', './list-view', './list-footer-view' -], function (Layout, Users, HeaderView, SearchView, ListView, ListFooterView) { +], function (Marionette, Layout, Users, HeaderView, SearchView, ListView, ListFooterView) { var App = new Marionette.Application(), init = function (options) { @@ -37,9 +38,7 @@ define([ }; App.on('start', function (options) { - window.requestMessages().done(function () { - init.call(App, options); - }); + 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 659d3012a79..edda928fb99 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 (e) { - this._super(e); + onFormSubmit: function () { + ModalForm.prototype.onFormSubmit.apply(this, arguments); 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 000a350ea57..26143c09b2e 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 (e) { - this._super(e); + onFormSubmit: function () { + ModalForm.prototype.onFormSubmit.apply(this, arguments); 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 50b18c1d237..c05f57afc09 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(this._super(), { + return _.extend(ModalForm.prototype.events.apply(this, arguments), { 'click #create-user-add-scm-account': 'onAddScmAccountClick' }); }, onRender: function () { - this._super(); + ModalForm.prototype.onRender.apply(this, arguments); this.$('[data-toggle="tooltip"]').tooltip({ container: 'body', placement: 'bottom' }); }, onDestroy: function () { - this._super(); + ModalForm.prototype.onDestroy.apply(this, arguments); this.$('[data-toggle="tooltip"]').tooltip('destroy'); }, - onFormSubmit: function (e) { - this._super(e); + onFormSubmit: function () { + ModalForm.prototype.onFormSubmit.apply(this, arguments); 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 09a127fc6fd..2949f0acee6 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,7 +9,8 @@ define([ itemTemplate: Templates['users-group'], onRender: function () { - this._super(); + Modal.prototype.onRender.apply(this, arguments); + //noinspection Eslint new window.SelectList({ el: this.$('#users-groups'), width: '100%', @@ -19,9 +20,9 @@ define([ return item.name + '<br><span class="note">' + item.description + '</span>'; }, queryParam: 'q', - searchUrl: baseUrl + '/api/users/groups?ps=100&login=' + this.model.id, - selectUrl: baseUrl + '/api/usergroups/add_user', - deselectUrl: baseUrl + '/api/usergroups/remove_user', + 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', 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 c8b76193b4c..a07bd44e6e0 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,7 +1,8 @@ define([ + 'backbone.marionette', './create-view', './templates' -], function (CreateView) { +], function (Marionette, 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 9acb054bdad..3fb4ee142bb 100644 --- a/server/sonar-web/src/main/js/apps/users/layout.js +++ b/server/sonar-web/src/main/js/apps/users/layout.js @@ -1,6 +1,7 @@ define([ + 'backbone.marionette', './templates' -], function () { +], function (Marionette) { 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 cf802586354..7758d24d75b 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,6 +1,7 @@ define([ + 'backbone.marionette', './templates' -], function () { +], function (Marionette) { return Marionette.ItemView.extend({ template: Templates['users-list-footer'], @@ -23,7 +24,7 @@ define([ }, serializeData: function () { - return _.extend(this._super(), { + return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), { 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 b11e39e2766..b123e560225 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,10 +1,11 @@ define([ + 'backbone.marionette', './update-view', './change-password-view', './deactivate-view', './groups-view', './templates' -], function (UpdateView, ChangePasswordView, DeactivateView, GroupsView) { +], function (Marionette, UpdateView, ChangePasswordView, DeactivateView, GroupsView) { return Marionette.ItemView.extend({ tagName: 'li', @@ -101,7 +102,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(this._super(), { + return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), { 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 24878864d30..b56e64f951d 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,7 +1,8 @@ define([ + 'backbone.marionette', './list-item-view', './templates' -], function (ListItemView) { +], function (Marionette, 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 5129bf5a253..295f50b0b4b 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,6 +1,7 @@ define([ + 'backbone.marionette', './templates' -], function () { +], function (Marionette) { 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 746ffe8bdd7..e438a4b5f22 100644 --- a/server/sonar-web/src/main/js/apps/users/user.js +++ b/server/sonar-web/src/main/js/apps/users/user.js @@ -1,10 +1,12 @@ -define(function () { +define([ + 'backbone' +], function (Backbone) { return Backbone.Model.extend({ idAttribute: 'login', urlRoot: function () { - return baseUrl + '/api/users'; + return window.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 9c45979a9fe..1c199d05ace 100644 --- a/server/sonar-web/src/main/js/apps/users/users.js +++ b/server/sonar-web/src/main/js/apps/users/users.js @@ -1,12 +1,13 @@ define([ + 'backbone', './user' -], function (User) { +], function (Backbone, User) { return Backbone.Collection.extend({ model: User, url: function () { - return baseUrl + '/api/users/search'; + return window.baseUrl + '/api/users/search'; }, parse: function (r) { @@ -19,7 +20,7 @@ define([ fetch: function (options) { var d = (options && options.data) || {}; this.q = d.q; - return this._super(options); + return Backbone.Collection.prototype.fetch.apply(this, arguments); }, fetchMore: function () { |