Commit 093a7745 authored by Filipa Lacerda's avatar Filipa Lacerda

Fix conflicts for app/assets/javascripts/members.js

parent 066eed4f
<<<<<<< HEAD
/* eslint-disable class-methods-use-this, promise/catch-or-return */
/* eslint-disable no-new */
import Flash from './flash'; import Flash from './flash';
(() => { export default class Members {
window.gl = window.gl || {};
class Members {
constructor() { constructor() {
this.addListeners(); this.addListeners();
this.initGLDropdown(); this.initGLDropdown();
...@@ -20,26 +14,11 @@ import Flash from './flash'; ...@@ -20,26 +14,11 @@ import Flash from './flash';
$('.js-edit-member-form').off('ajax:success').on('ajax:success', this.formSuccess.bind(this)); $('.js-edit-member-form').off('ajax:success').on('ajax:success', this.formSuccess.bind(this));
gl.utils.disableButtonIfEmptyField('#user_ids', 'input[name=commit]', 'change'); gl.utils.disableButtonIfEmptyField('#user_ids', 'input[name=commit]', 'change');
} }
=======
export default class Members {
constructor() {
this.addListeners();
this.initGLDropdown();
}
addListeners() {
$('.project_member, .group_member').off('ajax:success').on('ajax:success', this.removeRow);
$('.js-member-update-control').off('change').on('change', this.formSubmit.bind(this));
$('.js-edit-member-form').off('ajax:success').on('ajax:success', this.formSuccess.bind(this));
gl.utils.disableButtonIfEmptyField('#user_ids', 'input[name=commit]', 'change');
}
>>>>>>> upstream/master
initGLDropdown() { initGLDropdown() {
$('.js-member-permissions-dropdown').each((i, btn) => { $('.js-member-permissions-dropdown').each((i, btn) => {
const $btn = $(btn); const $btn = $(btn);
<<<<<<< HEAD
$btn.glDropdown({ $btn.glDropdown({
selectable: true, selectable: true,
isSelectable(selected, $el) { isSelectable(selected, $el) {
...@@ -78,24 +57,6 @@ export default class Members { ...@@ -78,24 +57,6 @@ export default class Members {
} }
}, },
}); });
=======
$btn.glDropdown({
selectable: true,
isSelectable(selected, $el) {
return !$el.hasClass('is-active');
},
fieldName: $btn.data('field-name'),
id(selected, $el) {
return $el.data('id');
},
toggleLabel(selected, $el) {
return $el.text();
},
clicked: (options) => {
this.formSubmit(null, options.$el);
},
>>>>>>> upstream/master
});
}); });
} }
// eslint-disable-next-line class-methods-use-this // eslint-disable-next-line class-methods-use-this
...@@ -120,7 +81,13 @@ export default class Members { ...@@ -120,7 +81,13 @@ export default class Members {
$dateInput.disable(); $dateInput.disable();
} }
<<<<<<< HEAD formSuccess(e) {
const { $toggle, $dateInput } = this.getMemberListItems($(e.currentTarget).closest('.member'));
$toggle.enable();
$dateInput.enable();
}
showLDAPPermissionsWarning(e) { showLDAPPermissionsWarning(e) {
const $btn = $(e.currentTarget); const $btn = $(e.currentTarget);
const { $memberListItem } = this.getMemberListItems($btn); const { $memberListItem } = this.getMemberListItems($btn);
...@@ -128,7 +95,7 @@ export default class Members { ...@@ -128,7 +95,7 @@ export default class Members {
$ldapPermissionsElement.toggle(); $ldapPermissionsElement.toggle();
} }
// eslint-disable-next-line class-methods-use-this
getMemberListItems($el) { getMemberListItems($el) {
const $memberListItem = $el.is('.member') ? $el : $(`#${$el.data('el-id')}`); const $memberListItem = $el.is('.member') ? $el : $(`#${$el.data('el-id')}`);
...@@ -144,7 +111,7 @@ export default class Members { ...@@ -144,7 +111,7 @@ export default class Members {
const { $memberListItem, $toggle, $dateInput } = this.getMemberListItems($btn); const { $memberListItem, $toggle, $dateInput } = this.getMemberListItems($btn);
$btn.disable(); $btn.disable();
// eslint-disable-next-line promise/catch-or-return
this.overrideLdap($memberListItem, $btn.data('endpoint'), true).then(() => { this.overrideLdap($memberListItem, $btn.data('endpoint'), true).then(() => {
this.showLDAPPermissionsWarning(e); this.showLDAPPermissionsWarning(e);
...@@ -154,13 +121,13 @@ export default class Members { ...@@ -154,13 +121,13 @@ export default class Members {
$btn.enable(); $btn.enable();
if (xhr.status === 403) { if (xhr.status === 403) {
new Flash('You do not have the correct permissions to override the settings from the LDAP group sync.', 'alert'); Flash('You do not have the correct permissions to override the settings from the LDAP group sync.', 'alert');
} else { } else {
new Flash('An error occured whilst saving LDAP override status. Please try again.', 'alert'); Flash('An error occured whilst saving LDAP override status. Please try again.', 'alert');
} }
}); });
} }
// eslint-disable-next-line class-methods-use-this
overrideLdap($memberListitem, endpoint, override) { overrideLdap($memberListitem, endpoint, override) {
return $.ajax({ return $.ajax({
url: endpoint, url: endpoint,
...@@ -174,22 +141,4 @@ export default class Members { ...@@ -174,22 +141,4 @@ export default class Members {
$memberListitem.toggleClass('is-overriden', override); $memberListitem.toggleClass('is-overriden', override);
}); });
} }
=======
formSuccess(e) {
const { $toggle, $dateInput } = this.getMemberListItems($(e.currentTarget).closest('.member'));
$toggle.enable();
$dateInput.enable();
>>>>>>> upstream/master
}
// eslint-disable-next-line class-methods-use-this
getMemberListItems($el) {
const $memberListItem = $el.is('.member') ? $el : $(`#${$el.data('el-id')}`);
return {
$memberListItem,
$toggle: $memberListItem.find('.dropdown-menu-toggle'),
$dateInput: $memberListItem.find('.js-access-expiration-date'),
};
}
} }
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