Remove group modal like remove project modal. Closes #33130
This commit is contained in:
parent
016b9f2565
commit
2210a71b17
4 changed files with 27 additions and 9 deletions
|
@ -58,6 +58,11 @@ module GroupsHelper
|
|||
IssuesFinder.new(current_user, group_id: group.id).execute
|
||||
end
|
||||
|
||||
def remove_group_message(group)
|
||||
_("You are going to remove %{group_name}.\nRemoved groups CANNOT be restored!\nAre you ABSOLUTELY sure?") %
|
||||
{ group_name: group.name }
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def group_title_link(group, hidable: false)
|
||||
|
|
|
@ -45,10 +45,13 @@
|
|||
.panel.panel-danger
|
||||
.panel-heading Remove group
|
||||
.panel-body
|
||||
%p
|
||||
Removing group will cause all child projects and resources to be removed.
|
||||
%br
|
||||
%strong Removed group can not be restored!
|
||||
= form_tag(@group, method: :delete) do
|
||||
%p
|
||||
Removing group will cause all child projects and resources to be removed.
|
||||
%br
|
||||
%strong Removed group can not be restored!
|
||||
|
||||
.form-actions
|
||||
= link_to 'Remove group', @group, data: {confirm: 'Removed group can not be restored! Are you sure?'}, method: :delete, class: "btn btn-remove"
|
||||
.form-actions
|
||||
= button_to 'Remove group', '#', class: "btn btn-remove js-confirm-danger", data: { "confirm-danger-message" => remove_group_message(@group) }
|
||||
|
||||
= render 'shared/confirm_modal', phrase: @group.path
|
||||
|
|
4
changelogs/unreleased/33130-remove-group-modal.yml
Normal file
4
changelogs/unreleased/33130-remove-group-modal.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
title: "Remove group modal like remove project modal (requires typing + confirmation)"
|
||||
merge_request: 12569
|
||||
author: Diego Souza
|
|
@ -135,7 +135,7 @@ feature 'Group', feature: true do
|
|||
expect(page).not_to have_content('secret-group')
|
||||
end
|
||||
|
||||
describe 'group edit' do
|
||||
describe 'group edit', js: true do
|
||||
let(:group) { create(:group) }
|
||||
let(:path) { edit_group_path(group) }
|
||||
let(:new_name) { 'new-name' }
|
||||
|
@ -157,8 +157,8 @@ feature 'Group', feature: true do
|
|||
end
|
||||
|
||||
it 'removes group' do
|
||||
click_link 'Remove group'
|
||||
|
||||
expect { remove_with_confirm('Remove group', group.path) }.to change {Group.count}.by(-1)
|
||||
expect(group.members.all.count).to be_zero
|
||||
expect(page).to have_content "scheduled for deletion"
|
||||
end
|
||||
end
|
||||
|
@ -212,4 +212,10 @@ feature 'Group', feature: true do
|
|||
expect(page).to have_content(nested_group.name)
|
||||
end
|
||||
end
|
||||
|
||||
def remove_with_confirm(button_text, confirm_with)
|
||||
click_button button_text
|
||||
fill_in 'confirm_name_input', with: confirm_with
|
||||
click_button 'Confirm'
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue