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

fixing multi turbo-frame tags after stream update discovered while debugging specs

Jonas Jabari82cbacdf2851
diff --git a/modules/overviews/app/components/project_custom_fields/sidebar_component.html.erb b/modules/overviews/app/components/project_custom_fields/sidebar_component.html.erb
index dabcd20a885..de5672b3b16 100644
--- a/modules/overviews/app/components/project_custom_fields/sidebar_component.html.erb
+++ b/modules/overviews/app/components/project_custom_fields/sidebar_component.html.erb
@@ -1,16 +1,14 @@
<%=
- content_tag("turbo-frame", id: "project-custom-fields-sidebar") do
- component_wrapper do
- if available_project_custom_fields_grouped_by_section.any?
- flex_layout(data: { qa_selector: "project-custom-fields-sidebar-async-content" }) do |sections_container|
- available_project_custom_fields_grouped_by_section.each do |project_custom_field_section_id, project_custom_fields|
- sections_container.with_row(mb: 3) do
- render(ProjectCustomFields::Sections::ShowComponent.new(
- project: @project,
- project_custom_field_section: get_eager_loaded_project_custom_field_section(project_custom_field_section_id),
- project_custom_fields: project_custom_fields
- ))
- end
+ component_wrapper do
+ if available_project_custom_fields_grouped_by_section.any?
+ flex_layout(data: { qa_selector: "project-custom-fields-sidebar-async-content" }) do |sections_container|
+ available_project_custom_fields_grouped_by_section.each do |project_custom_field_section_id, project_custom_fields|
+ sections_container.with_row(mb: 3) do
+ render(ProjectCustomFields::Sections::ShowComponent.new(
+ project: @project,
+ project_custom_field_section: get_eager_loaded_project_custom_field_section(project_custom_field_section_id),
+ project_custom_fields: project_custom_fields
+ ))
end
end
end
diff --git a/modules/overviews/app/controllers/overviews/overviews_controller.rb b/modules/overviews/app/controllers/overviews/overviews_controller.rb
index 5e61a596d05..a4626350a2f 100644
--- a/modules/overviews/app/controllers/overviews/overviews_controller.rb
+++ b/modules/overviews/app/controllers/overviews/overviews_controller.rb
@@ -8,13 +8,7 @@ module ::Overviews
menu_item :overview
def project_custom_fields_sidebar
- render(
- ProjectCustomFields::SidebarComponent.new(
- project: @project,
- eager_loaded_project_custom_field_sections:
- ),
- layout: false
- )
+ @eager_loaded_project_custom_field_sections = eager_loaded_project_custom_field_sections
end
def project_custom_field_section_dialog
diff --git a/modules/overviews/app/views/overviews/overviews/project_custom_fields_sidebar.html.erb b/modules/overviews/app/views/overviews/overviews/project_custom_fields_sidebar.html.erb
new file mode 100644
index 00000000000..f156037180d
--- /dev/null
+++ b/modules/overviews/app/views/overviews/overviews/project_custom_fields_sidebar.html.erb
@@ -0,0 +1,34 @@
+<%#-- 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.
+
+++#%>
+<%= content_tag("turbo-frame", id: "project-custom-fields-sidebar") do %>
+ <%= render(ProjectCustomFields::SidebarComponent.new(
+ project: @project,
+ eager_loaded_project_custom_field_sections: @eager_loaded_project_custom_field_sections
+ )) %>
+<% end %>
\ No newline at end of file
diff --git a/spec/features/projects/project_custom_fields/overview_page/dialog/update_spec.rb b/spec/features/projects/project_custom_fields/overview_page/dialog/update_spec.rb
index 1de553dc71b..5da4693b013 100644
--- a/spec/features/projects/project_custom_fields/overview_page/dialog/update_spec.rb
+++ b/spec/features/projects/project_custom_fields/overview_page/dialog/update_spec.rb
@@ -527,10 +527,22 @@ RSpec.describe 'Edit project custom fields on project overview page', :js do
end
it 'adds values properly to init values' do
- custom_field.custom_values.last.destroy
+ custom_field.custom_values.destroy_all
overview_page.visit_page
+ overview_page.within_custom_field_container(custom_field) do
+ expect(page).to have_no_text first_option
+ expect(page).to have_no_text second_option
+ end
+
+ overview_page.open_edit_dialog_for_section(section)
+
+ field.select_option(first_option)
+
+ dialog.submit
+ dialog.expect_closed
+
overview_page.within_custom_field_container(custom_field) do
expect(page).to have_text first_option
expect(page).to have_no_text second_option