Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

WIP[Op#54456]: fix turbo stream delete link

Kabiru Mwenjaf9fd5517a0cf
diff --git a/app/components/projects/row_component.html.erb b/app/components/projects/row_component.html.erb
index 62d5bdb79e1..8ed51f18924 100644
--- a/app/components/projects/row_component.html.erb
+++ b/app/components/projects/row_component.html.erb
@@ -27,7 +27,10 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
-<%= component_wrapper(tag: "tr", class: row_css_class, data: { turbo: true }) do %>
+<tr
+ <%= "id=\"#{row_css_id}\"".html_safe if row_css_id %>
+ <%= "class=\"#{row_css_class}\"".html_safe if row_css_class %>
+>
<% columns.each do |column| %>
<td class="<%= column_css_class(column) %>">
<%= column_value(column) %>
@@ -38,4 +41,4 @@ See COPYRIGHT and LICENSE files for more details.
<%= link %>
<% end %>
</td>
-<% end %>
+</tr>
diff --git a/app/components/projects/row_component.rb b/app/components/projects/row_component.rb
index 09b1b658a90..6dd80c99c2c 100644
--- a/app/components/projects/row_component.rb
+++ b/app/components/projects/row_component.rb
@@ -29,8 +29,6 @@
#++
module Projects
class RowComponent < ::RowComponent
- include OpTurbo::Streamable
-
delegate :favored_project_ids, to: :table
def project
@@ -170,7 +168,7 @@ module Projects
classes.join(" ")
end
- def wrapper_uniq_by
+ def row_css_id
"project-#{project.id}"
end
diff --git a/app/components/settings/project_custom_fields/project_custom_field_mapping/row_component.html.erb b/app/components/settings/project_custom_fields/project_custom_field_mapping/row_component.html.erb
new file mode 100644
index 00000000000..097b38764a0
--- /dev/null
+++ b/app/components/settings/project_custom_fields/project_custom_field_mapping/row_component.html.erb
@@ -0,0 +1,42 @@
+<%#-- copyright
+OpenProject is an open source project management software.
+Copyright (C) 2012-2024 the OpenProject GmbH
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License version 3.
+
+OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+Copyright (C) 2006-2013 Jean-Philippe Lang
+Copyright (C) 2010-2013 the ChiliProject Team
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+See COPYRIGHT and LICENSE files for more details.
+
+++#%>
+
+<%= component_wrapper(tag: "tr", class: row_css_class, data: { turbo: true }) do %>
+ <% columns.each do |column| %>
+ <td class="<%= column_css_class(column) %>">
+ <%= column_value(column) %>
+ </td>
+ <% end %>
+
+ <td class="buttons">
+ <% button_links.each do |link| %>
+ <%= link %>
+ <% end %>
+ </td>
+<% end %>
diff --git a/app/components/settings/project_custom_fields/project_custom_field_mapping/row_component.rb b/app/components/settings/project_custom_fields/project_custom_field_mapping/row_component.rb
index bb0c47418ef..9507231aaee 100644
--- a/app/components/settings/project_custom_fields/project_custom_field_mapping/row_component.rb
+++ b/app/components/settings/project_custom_fields/project_custom_field_mapping/row_component.rb
@@ -30,12 +30,18 @@ module Settings
module ProjectCustomFields
module ProjectCustomFieldMapping
class RowComponent < Projects::RowComponent
- private
+ include OpTurbo::Streamable
+
+ def wrapper_uniq_by
+ "project-#{project.id}"
+ end
def more_menu_items
@more_menu_items ||= [more_menu_detach_project].compact
end
+ private
+
def more_menu_detach_project
if User.current.admin
{
@@ -47,9 +53,8 @@ module Settings
project_custom_field_project_mapping: { project_id: model.first.id }
),
data: {
- method: :delete,
- turbo: true,
- 'turbo-stream': true
+ turbo_confirm: t("project.archive.are_you_sure", name: project.name),
+ turbo_method: :delete
}
}
end