summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/project_edit.js
diff options
context:
space:
mode:
authorJose Ivan Vargas <jvargas@gitlab.com>2017-05-16 11:41:50 -0500
committerJose Ivan Vargas <jvargas@gitlab.com>2017-05-22 12:55:01 -0500
commitfbde5e33134df144208840f977a74f346acf450a (patch)
tree7759498243e66c878cc4f8a8c15cb1f93ccc3300 /app/assets/javascripts/project_edit.js
parent42604d4c33e6098ba696d464c9a7b3d16656bf54 (diff)
downloadgitlab-ce-fbde5e33134df144208840f977a74f346acf450a.tar.gz
Renamed some messages and refactored the project_edit class to a function
Diffstat (limited to 'app/assets/javascripts/project_edit.js')
-rw-r--r--app/assets/javascripts/project_edit.js21
1 files changed, 7 insertions, 14 deletions
diff --git a/app/assets/javascripts/project_edit.js b/app/assets/javascripts/project_edit.js
index 042ec8e4494..d7d284b6c86 100644
--- a/app/assets/javascripts/project_edit.js
+++ b/app/assets/javascripts/project_edit.js
@@ -1,16 +1,9 @@
-export default class ProjectEdit {
- constructor() {
- this.transferForm = $('.js-project-transfer-form');
- this.selectNamespace = $('.js-project-transfer-form').find('.select2');
+export default function setupProjectEdit() {
+ const $transferForm = $('.js-project-transfer-form');
+ const $selectNamespace = $transferForm.find('.select2');
- this.selectNamespaceChangedWrapper = this.selectNamespaceChanged.bind(this);
- this.selectNamespace.on('change', this.selectNamespaceChangedWrapper);
- this.selectNamespaceChanged();
- }
-
- selectNamespaceChanged() {
- const selectedNamespaceValue = this.selectNamespace.val();
-
- this.transferForm.find(':submit').prop('disabled', !selectedNamespaceValue);
- }
+ $selectNamespace.on('change', () => {
+ $transferForm.find(':submit').prop('disabled', !$selectNamespace.val());
+ });
+ $selectNamespace.trigger('change');
}