Commit cab8d024 authored by Phil Hughes's avatar Phil Hughes

Fixed up JS to match CE implementation

parent e888c935
......@@ -43,16 +43,15 @@
return $el.text();
},
clicked: (selected, $el) => {
const $link = $($el);
clicked: (selected, $link) => {
const { $memberListItem, $toggle, $dateInput } = this.getMemberListItems($link);
$toggle.attr('disabled', true);
$dateInput.attr('disabled', true);
if (!$link.data('revert')) {
$btn.closest('form').trigger('submit.rails');
this.formSubmit(null, $link);
} else {
$toggle.disable();
$dateInput.disable();
this.overrideLdap($memberListItem, $link.data('endpoint'), false);
}
},
......@@ -71,21 +70,21 @@
}
}
formSubmit(e) {
const $this = $(e.currentTarget);
formSubmit(e, $el = null) {
const $this = e? $(e.currentTarget) : $el;
const { $toggle, $dateInput } = this.getMemberListItems($this);
$this.closest('form').trigger('submit.rails');
$toggle.attr('disabled', true);
$dateInput.attr('disabled', true);
$toggle.disable();
$dateInput.disable();
}
formSuccess(e) {
const { $toggle, $dateInput } = this.getMemberListItems($(e.currentTarget).closest('.member'));
$toggle.removeAttr('disabled');
$dateInput.removeAttr('disabled');
$toggle.enable();
$dateInput.enable();
}
showLDAPPermissionsWarning(e) {
......@@ -110,13 +109,13 @@
const $btn = $(e.currentTarget);
const { $memberListItem, $toggle, $dateInput } = this.getMemberListItems($btn);
$btn.attr('disabled', true).disable();
$btn.disable();
this.overrideLdap($memberListItem, $btn.data('endpoint'), true).then(() => {
this.showLDAPPermissionsWarning(e);
$toggle.removeAttr('disabled');
$dateInput.removeAttr('disabled');
$btn.removeAttr('disabled').enable();
$toggle.enable();
$dateInput.enable();
$btn.enable();
});
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment