Fixed removing groups

This commit is contained in:
Phil Hughes 2016-09-06 16:20:20 +01:00
parent 11c0c65092
commit 73c4da1780
3 changed files with 17 additions and 2 deletions

View file

@ -29,7 +29,12 @@ class Projects::GroupLinksController < Projects::ApplicationController
def destroy
project.project_group_links.find(params[:id]).destroy
redirect_to namespace_project_group_links_path(project.namespace, project)
respond_to do |format|
format.html do
redirect_to namespace_project_group_links_path(project.namespace, project)
end
format.js { head :ok }
end
end
protected

View file

@ -1,6 +1,6 @@
- group = local_assigns[:group]
- group_link = local_assigns[:group_link]
%li.member{ class: dom_class(group), id: dom_id(group) }
%li.member.group_member{ id: "group_member_#{group_link.id}" }
%span{ class: "list-item-name" }
= image_tag group_icon(group), class: "avatar s40", alt: ''
%strong
@ -21,6 +21,7 @@
= link_to namespace_project_group_link_path(@project.namespace, @project, group_link),
remote: true,
method: :delete,
data: { confirm: "Are you sure you want to remove #{group.name}?" },
class: 'btn btn-remove prepend-left-10' do
%span.visible-xs-block
Delete

View file

@ -34,4 +34,13 @@ feature 'Projects > Members > Anonymous user sees members', feature: true, js: t
expect(page).to have_content('Expires in')
end
end
it 'deletes group link' do
page.within(first('.group_member')) do
find('.btn-remove').click
end
wait_for_ajax
expect(page).not_to have_selector('.group_member')
end
end