diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2019-02-27 18:18:58 +0000 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2019-02-27 18:18:58 +0000 |
commit | 543316bca9454b4c468004c4cebcb76558378b98 (patch) | |
tree | 2406a39745fc2cce43db211efad0c197c92ebd86 | |
parent | 9983ee55da8ce6dd11a6533ded3d0feda3810b8f (diff) | |
parent | e74e66bd21b4678b0f3e5ae14c18993431276229 (diff) | |
download | gitlab-ce-543316bca9454b4c468004c4cebcb76558378b98.tar.gz |
Merge branch 'members-ee-code-ce' into 'master'
CE backport of members-ee-code
See merge request gitlab-org/gitlab-ce!25593
-rw-r--r-- | app/assets/javascripts/members.js | 27 | ||||
-rw-r--r-- | app/assets/javascripts/pages/groups/group_members/index/index.js | 2 | ||||
-rw-r--r-- | app/assets/javascripts/pages/projects/project_members/index.js | 2 |
3 files changed, 20 insertions, 11 deletions
diff --git a/app/assets/javascripts/members.js b/app/assets/javascripts/members.js index bd263c75a3d..af2697444f2 100644 --- a/app/assets/javascripts/members.js +++ b/app/assets/javascripts/members.js @@ -16,25 +16,33 @@ export default class Members { gl.utils.disableButtonIfEmptyField('#user_ids', 'input[name=commit]', 'change'); } + dropdownClicked(options) { + this.formSubmit(null, options.$el); + } + + // eslint-disable-next-line class-methods-use-this + dropdownToggleLabel(selected, $el) { + return $el.text(); + } + + // eslint-disable-next-line class-methods-use-this + dropdownIsSelectable(selected, $el) { + return !$el.hasClass('is-active'); + } + initGLDropdown() { $('.js-member-permissions-dropdown').each((i, btn) => { const $btn = $(btn); $btn.glDropdown({ selectable: true, - isSelectable(selected, $el) { - return !$el.hasClass('is-active'); - }, + isSelectable: (selected, $el) => this.dropdownIsSelectable(selected, $el), fieldName: $btn.data('fieldName'), id(selected, $el) { return $el.data('id'); }, - toggleLabel(selected, $el) { - return $el.text(); - }, - clicked: options => { - this.formSubmit(null, options.$el); - }, + toggleLabel: (selected, $el) => this.dropdownToggleLabel(selected, $el, $btn), + clicked: options => this.dropdownClicked(options), }); }); } @@ -55,6 +63,7 @@ export default class Members { $toggle.enable(); $dateInput.enable(); } + // eslint-disable-next-line class-methods-use-this getMemberListItems($el) { const $memberListItem = $el.is('.member') ? $el : $(`#${$el.data('elId')}`); diff --git a/app/assets/javascripts/pages/groups/group_members/index/index.js b/app/assets/javascripts/pages/groups/group_members/index/index.js index c22a164cd4e..e4f4c3b574e 100644 --- a/app/assets/javascripts/pages/groups/group_members/index/index.js +++ b/app/assets/javascripts/pages/groups/group_members/index/index.js @@ -1,7 +1,7 @@ /* eslint-disable no-new */ import memberExpirationDate from '~/member_expiration_date'; -import Members from '~/members'; +import Members from 'ee_else_ce/members'; import UsersSelect from '~/users_select'; document.addEventListener('DOMContentLoaded', () => { diff --git a/app/assets/javascripts/pages/projects/project_members/index.js b/app/assets/javascripts/pages/projects/project_members/index.js index adbe744290a..f39765818e7 100644 --- a/app/assets/javascripts/pages/projects/project_members/index.js +++ b/app/assets/javascripts/pages/projects/project_members/index.js @@ -1,7 +1,7 @@ +import Members from 'ee_else_ce/members'; import memberExpirationDate from '../../../member_expiration_date'; import UsersSelect from '../../../users_select'; import groupsSelect from '../../../groups_select'; -import Members from '../../../members'; document.addEventListener('DOMContentLoaded', () => { memberExpirationDate('.js-access-expiration-date-groups'); |