2016-08-31 14:28:58 +00:00
|
|
|
((w) => {
|
|
|
|
window.gl = window.gl || {};
|
|
|
|
|
|
|
|
class ProjectMembers {
|
|
|
|
constructor() {
|
|
|
|
this.removeListeners();
|
|
|
|
this.addListeners();
|
|
|
|
}
|
|
|
|
|
|
|
|
removeListeners() {
|
2016-09-01 14:27:42 +00:00
|
|
|
$('.project_member, .group_member').off('ajax:success');
|
2016-08-31 14:28:58 +00:00
|
|
|
$('.js-member-update-control').off('change');
|
|
|
|
}
|
|
|
|
|
|
|
|
addListeners() {
|
2016-09-01 14:27:42 +00:00
|
|
|
$('.project_member, .group_member').on('ajax:success', this.removeRow);
|
2016-08-31 14:28:58 +00:00
|
|
|
$('.js-member-update-control').on('change', function () {
|
2016-09-01 10:56:21 +00:00
|
|
|
$(this).closest('form')
|
|
|
|
.trigger("submit.rails");
|
2016-08-31 14:28:58 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
removeRow(e) {
|
|
|
|
const $target = $(e.target);
|
|
|
|
|
|
|
|
if ($target.hasClass('btn-remove')) {
|
2016-09-01 14:27:42 +00:00
|
|
|
console.log('a');
|
|
|
|
$target.closest('.member').fadeOut();
|
2016-08-31 14:28:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
submitForm() {
|
2016-09-01 10:56:21 +00:00
|
|
|
|
2016-08-31 14:28:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gl.ProjectMembers = ProjectMembers;
|
|
|
|
})(window);
|