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/users/form-view.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/users/form-view.js')
-rw-r--r-- | server/sonar-web/src/main/js/apps/users/form-view.js | 100 |
1 files changed, 49 insertions, 51 deletions
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..71bd7716038 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 @@ -1,52 +1,50 @@ -define([ - 'components/common/modal-form', - './templates' -], function (ModalForm) { - - var $ = jQuery; - - return ModalForm.extend({ - template: Templates['users-form'], - - events: function () { - return _.extend(this._super(), { - 'click #create-user-add-scm-account': 'onAddScmAccountClick' - }); - }, - - onRender: function () { - this._super(); - this.$('[data-toggle="tooltip"]').tooltip({ container: 'body', placement: 'bottom' }); - }, - - onDestroy: function () { - this._super(); - this.$('[data-toggle="tooltip"]').tooltip('destroy'); - }, - - onFormSubmit: function (e) { - this._super(e); - this.sendRequest(); - }, - - onAddScmAccountClick: function (e) { - e.preventDefault(); - this.addScmAccount(); - }, - - getScmAccounts: function () { - var scmAccounts = this.$('[name="scmAccounts"]').map(function () { - return $(this).val(); - }).toArray(); - return scmAccounts.filter(function (value) { - return !!value; - }); - }, - - addScmAccount: function () { - var fields = this.$('[name="scmAccounts"]'); - fields.first().clone().val('').insertAfter(fields.last()); - } - }); - +import $ from 'jquery'; +import _ from 'underscore'; +import ModalForm from 'components/common/modal-form'; +import './templates'; + +export default ModalForm.extend({ + template: Templates['users-form'], + + events: function () { + return _.extend(this._super(), { + 'click #create-user-add-scm-account': 'onAddScmAccountClick' + }); + }, + + onRender: function () { + this._super(); + this.$('[data-toggle="tooltip"]').tooltip({ container: 'body', placement: 'bottom' }); + }, + + onDestroy: function () { + this._super(); + this.$('[data-toggle="tooltip"]').tooltip('destroy'); + }, + + onFormSubmit: function (e) { + this._super(e); + this.sendRequest(); + }, + + onAddScmAccountClick: function (e) { + e.preventDefault(); + this.addScmAccount(); + }, + + getScmAccounts: function () { + var scmAccounts = this.$('[name="scmAccounts"]').map(function () { + return $(this).val(); + }).toArray(); + return scmAccounts.filter(function (value) { + return !!value; + }); + }, + + addScmAccount: function () { + var fields = this.$('[name="scmAccounts"]'); + fields.first().clone().val('').insertAfter(fields.last()); + } }); + + |