Commit 273b116c authored by Phil Hughes's avatar Phil Hughes

Merge branch '38869-members' into 'master'

Removes Members, memberExpiration from window object

See merge request gitlab-org/gitlab-ce!14808
parents fe3ec2d9 697967c1
......@@ -83,6 +83,8 @@ import AjaxLoadingSpinner from './ajax_loading_spinner';
import GlFieldErrors from './gl_field_errors';
import GLForm from './gl_form';
import U2FAuthenticate from './u2f/authenticate';
import Members from './members';
import memberExpirationDate from './member_expiration_date';
(function() {
var Dispatcher;
......@@ -399,15 +401,15 @@ import U2FAuthenticate from './u2f/authenticate';
new ProjectsList();
break;
case 'groups:group_members:index':
new gl.MemberExpirationDate();
new gl.Members();
memberExpirationDate();
new Members();
new UsersSelect();
break;
case 'projects:project_members:index':
new gl.MemberExpirationDate('.js-access-expiration-date-groups');
memberExpirationDate('.js-access-expiration-date-groups');
new GroupsSelect();
new gl.MemberExpirationDate();
new gl.Members();
memberExpirationDate();
new Members();
new UsersSelect();
break;
case 'groups:new':
......
......@@ -84,8 +84,6 @@ import './layout_nav';
import LazyLoader from './lazy_loader';
import './line_highlighter';
import './logo';
import './member_expiration_date';
import './members';
import './merge_request';
import './merge_request_tabs';
import './milestone';
......
......@@ -2,14 +2,12 @@
import Pikaday from 'pikaday';
(() => {
// Add datepickers to all `js-access-expiration-date` elements. If those elements are
// children of an element with the `clearable-input` class, and have a sibling
// `js-clear-input` element, then show that element when there is a value in the
// datepicker, and make clicking on that element clear the field.
//
window.gl = window.gl || {};
gl.MemberExpirationDate = (selector = '.js-access-expiration-date') => {
// Add datepickers to all `js-access-expiration-date` elements. If those elements are
// children of an element with the `clearable-input` class, and have a sibling
// `js-clear-input` element, then show that element when there is a value in the
// datepicker, and make clicking on that element clear the field.
//
export default function memberExpirationDate(selector = '.js-access-expiration-date') {
function toggleClearInput() {
$(this).closest('.clearable-input').toggleClass('has-value', $(this).val() !== '');
}
......@@ -51,5 +49,4 @@ import Pikaday from 'pikaday';
inputs.on('blur', toggleClearInput);
inputs.each(toggleClearInput);
};
}).call(window);
}
/* eslint-disable class-methods-use-this */
(() => {
window.gl = window.gl || {};
class Members {
export default class Members {
constructor() {
this.addListeners();
this.initGLDropdown();
......@@ -37,7 +33,7 @@
});
});
}
// eslint-disable-next-line class-methods-use-this
removeRow(e) {
const $target = $(e.target);
......@@ -65,7 +61,7 @@
$toggle.enable();
$dateInput.enable();
}
// eslint-disable-next-line class-methods-use-this
getMemberListItems($el) {
const $memberListItem = $el.is('.member') ? $el : $(`#${$el.data('el-id')}`);
......@@ -75,7 +71,4 @@
$dateInput: $memberListItem.find('.js-access-expiration-date'),
};
}
}
gl.Members = Members;
})();
}
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