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';
(() => {
window.gl = window.gl || {};
class Members {
export default class Members {
constructor() {
this.addListeners();
this.initGLDropdown();
......@@ -20,26 +14,11 @@ import Flash from './flash';
$('.js-edit-member-form').off('ajax:success').on('ajax:success', this.formSuccess.bind(this));
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() {
$('.js-member-permissions-dropdown').each((i, btn) => {
const $btn = $(btn);
<<<<<<< HEAD
$btn.glDropdown({
selectable: true,
isSelectable(selected, $el) {
......@@ -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
......@@ -120,7 +81,13 @@ export default class Members {
$dateInput.disable();
}
<<<<<<< HEAD
formSuccess(e) {
const { $toggle, $dateInput } = this.getMemberListItems($(e.currentTarget).closest('.member'));
$toggle.enable();
$dateInput.enable();
}
showLDAPPermissionsWarning(e) {
const $btn = $(e.currentTarget);
const { $memberListItem } = this.getMemberListItems($btn);
......@@ -128,7 +95,7 @@ export default class Members {
$ldapPermissionsElement.toggle();
}
// eslint-disable-next-line class-methods-use-this
getMemberListItems($el) {
const $memberListItem = $el.is('.member') ? $el : $(`#${$el.data('el-id')}`);
......@@ -144,7 +111,7 @@ export default class Members {
const { $memberListItem, $toggle, $dateInput } = this.getMemberListItems($btn);
$btn.disable();
// eslint-disable-next-line promise/catch-or-return
this.overrideLdap($memberListItem, $btn.data('endpoint'), true).then(() => {
this.showLDAPPermissionsWarning(e);
......@@ -154,13 +121,13 @@ export default class Members {
$btn.enable();
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 {
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) {
return $.ajax({
url: endpoint,
......@@ -174,22 +141,4 @@ export default class Members {
$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