Commit e33cda96 authored by Phil Hughes's avatar Phil Hughes

Fixed group members not deleting

Combine both group members & project members in project members list
parent 23993147
...@@ -8,12 +8,12 @@ ...@@ -8,12 +8,12 @@
} }
removeListeners() { removeListeners() {
$('.project_member').off('ajax:success'); $('.project_member, .group_member').off('ajax:success');
$('.js-member-update-control').off('change'); $('.js-member-update-control').off('change');
} }
addListeners() { addListeners() {
$('.project_member').on('ajax:success', this.removeRow); $('.project_member, .group_member').on('ajax:success', this.removeRow);
$('.js-member-update-control').on('change', function () { $('.js-member-update-control').on('change', function () {
$(this).closest('form') $(this).closest('form')
.trigger("submit.rails"); .trigger("submit.rails");
...@@ -24,7 +24,8 @@ ...@@ -24,7 +24,8 @@
const $target = $(e.target); const $target = $(e.target);
if ($target.hasClass('btn-remove')) { if ($target.hasClass('btn-remove')) {
$target.fadeOut(); console.log('a');
$target.closest('.member').fadeOut();
} }
} }
......
...@@ -6,15 +6,16 @@ class Projects::ProjectMembersController < Projects::ApplicationController ...@@ -6,15 +6,16 @@ class Projects::ProjectMembersController < Projects::ApplicationController
def index def index
@groups = @project.project_group_links.all @groups = @project.project_group_links.all
@project_members = @project.project_members @project_members = @project.team.members.all
@project_members_size = @project_members.size
@group_members = @project.group.group_members
@project_members = @project_members.non_invite unless can?(current_user, :admin_project, @project) @project_members = @project_members.non_invite unless can?(current_user, :admin_project, @project)
if params[:search].present? if params[:search].present?
users = @project.users.search(params[:search]).to_a @project_members = @project_members.search(params[:search])
@project_members = @project_members.where(user_id: users)
end end
@project_members = @project_members.order('access_level DESC') @project_members = @project_members.page(params[:page])
@requesters = @project.requesters if can?(current_user, :admin_project, @project) @requesters = @project.requesters if can?(current_user, :admin_project, @project)
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
.panel-heading .panel-heading
Users with access to Users with access to
%strong #{@project.name} %strong #{@project.name}
%span.badge= members.size %span.badge= @project_members_size
%ul.content-list %ul.content-list
= render partial: 'shared/members/member', collection: members, as: :member - members.each do |user|
- member = @project.team.find_member(user.id)
= render 'shared/members/member', member: member
...@@ -25,3 +25,4 @@ ...@@ -25,3 +25,4 @@
= render 'groups', groups: @groups = render 'groups', groups: @groups
= render 'team', members: @project_members = render 'team', members: @project_members
= paginate @project_members, theme: "gitlab"
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