b1b51b774b
Moved most of the functions that contained "window.doSomething" that were located at: - app/assets/javascripts/application.js To the following file: - app/assets/javascripts/lib/utils/common_utils.js The functions listed here: - window.ajaxGet - window.split - window.extractLast - window.rstrip - window.disableButtonIfEmptyField - window.disableButtonIfAnyEmptyField - window.sanitize - window.unbindEvents - window.shiftWindow Now will be accessible from the "gl.utils" namespace
38 lines
958 B
JavaScript
38 lines
958 B
JavaScript
/* eslint-disable */
|
|
((w) => {
|
|
w.gl = w.gl || {};
|
|
|
|
class Members {
|
|
constructor() {
|
|
this.addListeners();
|
|
}
|
|
|
|
addListeners() {
|
|
$('.project_member, .group_member').off('ajax:success').on('ajax:success', this.removeRow);
|
|
$('.js-member-update-control').off('change').on('change', this.formSubmit);
|
|
$('.js-edit-member-form').off('ajax:success').on('ajax:success', this.formSuccess);
|
|
gl.utils.disableButtonIfEmptyField('#user_ids', 'input[name=commit]', 'change');
|
|
}
|
|
|
|
removeRow(e) {
|
|
const $target = $(e.target);
|
|
|
|
if ($target.hasClass('btn-remove')) {
|
|
$target.closest('.member')
|
|
.fadeOut(function () {
|
|
$(this).remove();
|
|
});
|
|
}
|
|
}
|
|
|
|
formSubmit() {
|
|
$(this).closest('form').trigger("submit.rails").end().disable();
|
|
}
|
|
|
|
formSuccess() {
|
|
$(this).find('.js-member-update-control').enable();
|
|
}
|
|
}
|
|
|
|
gl.Members = Members;
|
|
})(window);
|