Update Delete Project Danger Dialog copy

Updates formatting of subprojects list.
Removes storage deletion warning.
This commit is contained in:
Alexander Brandon Coles
2025-08-27 19:34:55 +01:00
parent aa135e142f
commit ed2ce8f7a1
5 changed files with 52 additions and 33 deletions
@@ -31,34 +31,41 @@ See COPYRIGHT and LICENSE files for more details.
render(
Primer::OpenProject::DangerDialog.new(
id:,
title: t(:"project.destroy.title", name: @project),
title: t(:"project.destroy.title"),
form_arguments: {
action: project_path(@project),
action: project_path(project),
method: :delete,
data: { turbo: false }
}
)
) do |dialog|
dialog.with_confirmation_message do |message|
message.with_heading(tag: :h2) { t(:"project.destroy.heading", name: @project) }
message.with_heading(tag: :h2) { t(:"project.destroy.heading") }
message.with_description do
t("project.destroy.info")
t(
:"project.destroy.confirmation_message_for_subprojects_html",
name: project.name,
count: subprojects.size
)
end
end
dialog.with_confirmation_check_box_content(I18n.t(:text_permanent_delete_confirmation_checkbox_label))
dialog.with_additional_details(display: :block) do
%>
<p><%= t("project.destroy.confirmation", identifier: @project.identifier) %></p>
<ul class="mb-3">
<li><%= t("project.destroy.project_delete_result_1") %></li>
<% if has_managed_project_folders? %>
<li><%= t("project.destroy.project_delete_result_2") %></li>
<% end %>
</ul>
<% if subproject_names.any? %>
<%= t("project.destroy.subprojects_confirmation", value: subproject_names.to_sentence) %>
<% end %>
<%
if subprojects.any?
dialog.with_additional_details(display: :block) do
render(
Primer::Box.new(
mb: 3,
border: true,
border_radius: 2,
bg: :inset,
p: 3
)
) do
render_subproject_list
end
end
end
dialog.with_confirmation_check_box_content(I18n.t(:text_permanent_delete_confirmation_checkbox_label))
end
%>
@@ -33,6 +33,8 @@ module Projects
include ApplicationHelper
include OpTurbo::Streamable
attr_reader :project
def initialize(project:)
super
@@ -43,10 +45,18 @@ module Projects
def id = "delete-project-dialog"
def has_managed_project_folders? = @project.project_storages.any?(&:project_folder_automatic?)
def render_subproject_list(**options)
content_tag(:ul, options) do
safe_join(
subprojects.map do |subproject|
content_tag(:li, subproject.name)
end
)
end
end
def subproject_names
@project.descendants.map(&:to_s)
def subprojects
project.descendants
end
end
end
+9 -7
View File
@@ -3897,13 +3897,15 @@ en:
one: "1 project"
other: "%{count} projects"
destroy:
confirmation: "If you continue, the project %{identifier} will be permanently destroyed. You will:"
project_delete_result_1: "Delete all related data."
project_delete_result_2: "Delete all managed project folders in the attached storages."
info: "Deleting the project is an irreversible action. Please proceed with caution."
subprojects_confirmation: "Its subproject(s): %{value} will also be deleted."
title: "Delete project %{name}"
heading: "Permanently delete project %{name}?"
title: "Delete project"
heading: "Permanently delete this project?"
confirmation_message_for_subprojects_html:
zero: >
You are about to permanently delete all data relating to project <strong>%{name}</strong>.
one: >
You are about to permanently delete all data relating to project <strong>%{name}</strong> and this subproject:
other: >
You are about to permanently delete all data relating to project <strong>%{name}</strong> and these subprojects:
filters:
project_phase: "Project phase: %{phase}"
project_phase_any: "Project phase: Any"
@@ -55,11 +55,11 @@ RSpec.describe Projects::DeleteDialogComponent, type: :component do
describe "with a project" do
it "shows a heading" do
expect(subject).to have_text "Permanently delete project Top Secret Project?"
expect(subject).to have_text "Permanently delete this project?"
end
it "shows a simple info message" do
expect(subject).to have_text "Deleting the project is an irreversible action. Please proceed with caution."
expect(subject).to have_text "You are about to permanently delete all data relating to project Top Secret Project."
end
end
end
+3 -3
View File
@@ -42,9 +42,9 @@ RSpec.describe "Projects#destroy", :js do
end
it "destroys the project" do
expect(page).to have_modal "Delete project foo"
within_modal "Delete project foo" do
expect(page).to have_heading "Permanently delete project foo?"
expect(page).to have_modal "Delete project"
within_modal "Delete project" do
expect(page).to have_heading "Permanently delete this project?"
expect(page).to have_unchecked_field "I understand that this deletion cannot be reversed"