Commit cab8d024 authored by Phil Hughes's avatar Phil Hughes

Fixed up JS to match CE implementation

parent e888c935
...@@ -43,16 +43,15 @@ ...@@ -43,16 +43,15 @@
return $el.text(); return $el.text();
}, },
clicked: (selected, $el) => { clicked: (selected, $link) => {
const $link = $($el);
const { $memberListItem, $toggle, $dateInput } = this.getMemberListItems($link); const { $memberListItem, $toggle, $dateInput } = this.getMemberListItems($link);
$toggle.attr('disabled', true);
$dateInput.attr('disabled', true);
if (!$link.data('revert')) { if (!$link.data('revert')) {
$btn.closest('form').trigger('submit.rails'); this.formSubmit(null, $link);
} else { } else {
$toggle.disable();
$dateInput.disable();
this.overrideLdap($memberListItem, $link.data('endpoint'), false); this.overrideLdap($memberListItem, $link.data('endpoint'), false);
} }
}, },
...@@ -71,21 +70,21 @@ ...@@ -71,21 +70,21 @@
} }
} }
formSubmit(e) { formSubmit(e, $el = null) {
const $this = $(e.currentTarget); const $this = e? $(e.currentTarget) : $el;
const { $toggle, $dateInput } = this.getMemberListItems($this); const { $toggle, $dateInput } = this.getMemberListItems($this);
$this.closest('form').trigger('submit.rails'); $this.closest('form').trigger('submit.rails');
$toggle.attr('disabled', true); $toggle.disable();
$dateInput.attr('disabled', true); $dateInput.disable();
} }
formSuccess(e) { formSuccess(e) {
const { $toggle, $dateInput } = this.getMemberListItems($(e.currentTarget).closest('.member')); const { $toggle, $dateInput } = this.getMemberListItems($(e.currentTarget).closest('.member'));
$toggle.removeAttr('disabled'); $toggle.enable();
$dateInput.removeAttr('disabled'); $dateInput.enable();
} }
showLDAPPermissionsWarning(e) { showLDAPPermissionsWarning(e) {
...@@ -110,13 +109,13 @@ ...@@ -110,13 +109,13 @@
const $btn = $(e.currentTarget); const $btn = $(e.currentTarget);
const { $memberListItem, $toggle, $dateInput } = this.getMemberListItems($btn); const { $memberListItem, $toggle, $dateInput } = this.getMemberListItems($btn);
$btn.attr('disabled', true).disable(); $btn.disable();
this.overrideLdap($memberListItem, $btn.data('endpoint'), true).then(() => { this.overrideLdap($memberListItem, $btn.data('endpoint'), true).then(() => {
this.showLDAPPermissionsWarning(e); this.showLDAPPermissionsWarning(e);
$toggle.removeAttr('disabled'); $toggle.enable();
$dateInput.removeAttr('disabled'); $dateInput.enable();
$btn.removeAttr('disabled').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