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

fix[#48620] Use simple names for slot collection vs singular component methods

Kabiru Mwenja95056f98c5a7
diff --git a/app/components/attribute_groups/attribute_group_component.html.erb b/app/components/attribute_groups/attribute_group_component.html.erb
index e943a4a779d..40c0704fc17 100644
--- a/app/components/attribute_groups/attribute_group_component.html.erb
+++ b/app/components/attribute_groups/attribute_group_component.html.erb
@@ -28,11 +28,11 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
<div class="attributes-group">
- <%= group_header %>
+ <%= header %>
<div class="attributes-key-value">
- <% attributes_key_value.each do |attribute_key_value| %>
- <%= attribute_key_value %>
+ <% attributes.each do |attribute| %>
+ <%= attribute %>
<% end %>
</div>
diff --git a/app/components/attribute_groups/attribute_group_component.rb b/app/components/attribute_groups/attribute_group_component.rb
index fdecc977edc..fce96688dbc 100644
--- a/app/components/attribute_groups/attribute_group_component.rb
+++ b/app/components/attribute_groups/attribute_group_component.rb
@@ -30,7 +30,7 @@
module AttributeGroups
class AttributeGroupComponent < ::RailsComponent
- renders_one :group_header, AttributeGroups::AttributeGroupHeaderComponent
- renders_many :attributes_key_value, AttributeGroups::AttributeKeyValueComponent
+ renders_one :header, AttributeGroups::AttributeGroupHeaderComponent
+ renders_many :attributes, AttributeGroups::AttributeKeyValueComponent
end
end
diff --git a/modules/storages/app/views/storages/admin/storages/edit.html.erb b/modules/storages/app/views/storages/admin/storages/edit.html.erb
index c9653623070..28c932a02c8 100644
--- a/modules/storages/app/views/storages/admin/storages/edit.html.erb
+++ b/modules/storages/app/views/storages/admin/storages/edit.html.erb
@@ -12,9 +12,9 @@
<% if @object.oauth_application %>
<%= render(AttributeGroups::AttributeGroupComponent.new) do |component| %>
- <% component.with_group_header(title: "OpenProject #{t(:'storages.label_oauth_application_details')}") %>
+ <% component.with_header(title: "OpenProject #{t(:'storages.label_oauth_application_details')}") %>
- <% component.with_attributes_key_value([
+ <% component.with_attributes([
{ key: "OpenProject #{Storages::Admin::LABEL_OAUTH_CLIENT_ID}", value: @object.oauth_application.uid },
{ key: "OpenProject #{Storages::Admin::LABEL_OAUTH_CLIENT_SECRET}", value: "●●●●●●●●●●●●●●●●" },
]) %>
@@ -28,10 +28,10 @@
<% end %>
<%= render(AttributeGroups::AttributeGroupComponent.new) do |component| %>
- <% component.with_group_header(title: "#{t("storages.provider_types.#{@object.short_provider_type}.name")} #{t(:'storages.label_oauth_client_details')}") %>
+ <% component.with_header(title: "#{t("storages.provider_types.#{@object.short_provider_type}.name")} #{t(:'storages.label_oauth_client_details')}") %>
<% if @object.oauth_client %>
- <% component.with_attributes_key_value([
+ <% component.with_attributes([
{ key: "#{t("storages.provider_types.#{@object.short_provider_type}.name")} #{Storages::Admin::LABEL_OAUTH_CLIENT_ID}",
value: @object.oauth_client.client_id },
{ key: "#{t("storages.provider_types.#{@object.short_provider_type}.name")} #{Storages::Admin::LABEL_OAUTH_CLIENT_SECRET}",
diff --git a/modules/storages/app/views/storages/admin/storages/show.html.erb b/modules/storages/app/views/storages/admin/storages/show.html.erb
index e87c62a137c..6ec1830fe43 100644
--- a/modules/storages/app/views/storages/admin/storages/show.html.erb
+++ b/modules/storages/app/views/storages/admin/storages/show.html.erb
@@ -61,9 +61,9 @@ See COPYRIGHT and LICENSE files for more details.
<% end %>
<%= render(AttributeGroups::AttributeGroupComponent.new) do |component| %>
- <% component.with_group_header(title: t(:label_general)) %>
+ <% component.with_header(title: t(:label_general)) %>
- <% component.with_attributes_key_value([
+ <% component.with_attributes([
{ key: t(:'storages.label_name'), value: @object.name },
{ key: t(:'storages.label_provider_type'), value: t(:"storages.provider_types.#{@object.short_provider_type}.name") },
{ key: t(:'storages.label_host'), value: link_to(@object.host, @object.host) },
@@ -74,9 +74,9 @@ See COPYRIGHT and LICENSE files for more details.
<% if @object.oauth_application %>
<%= render(AttributeGroups::AttributeGroupComponent.new) do |component| %>
- <% component.with_group_header(title: "OpenProject #{t(:'storages.label_oauth_application_details')}") %>
+ <% component.with_header(title: "OpenProject #{t(:'storages.label_oauth_application_details')}") %>
- <% component.with_attributes_key_value([
+ <% component.with_attributes([
{ key: "OpenProject #{Storages::Admin::LABEL_OAUTH_CLIENT_ID}", value: @object.oauth_application.uid },
{ key: "OpenProject #{Storages::Admin::LABEL_OAUTH_CLIENT_SECRET}", value: "●●●●●●●●●●●●●●●●" },
]) %>
@@ -84,10 +84,10 @@ See COPYRIGHT and LICENSE files for more details.
<% end %>
<%= render(AttributeGroups::AttributeGroupComponent.new) do |component| %>
- <% component.with_group_header(title: "#{t("storages.provider_types.#{@object.short_provider_type}.name")} #{t(:'storages.label_oauth_client_details')}") %>
+ <% component.with_header(title: "#{t("storages.provider_types.#{@object.short_provider_type}.name")} #{t(:'storages.label_oauth_client_details')}") %>
<% if @object.oauth_client %>
- <% component.with_attributes_key_value([
+ <% component.with_attributes([
{ key: "#{t("storages.provider_types.#{@object.short_provider_type}.name")} #{Storages::Admin::LABEL_OAUTH_CLIENT_ID}",
value: @object.oauth_client.client_id },
{ key: "#{t("storages.provider_types.#{@object.short_provider_type}.name")} #{Storages::Admin::LABEL_OAUTH_CLIENT_SECRET}",
diff --git a/spec/components/attribute_groups/attribute_group_component_spec.rb b/spec/components/attribute_groups/attribute_group_component_spec.rb
index 83f5aadd8a8..23bf64c8435 100644
--- a/spec/components/attribute_groups/attribute_group_component_spec.rb
+++ b/spec/components/attribute_groups/attribute_group_component_spec.rb
@@ -33,9 +33,9 @@ require "rails_helper"
RSpec.describe AttributeGroups::AttributeGroupComponent, type: :component do
it 'renders the title' do
render_inline(described_class.new) do |component|
- component.with_group_header(title: "A Title")
+ component.with_header(title: "A Title")
- component.with_attributes_key_value(
+ component.with_attributes(
[{ key: "Attribute Key 1", value: "Attribute Value 1" },
{ key: "Attribute Key 2", value: "Attribute Value 2" }]
)
@@ -57,7 +57,7 @@ RSpec.describe AttributeGroups::AttributeGroupComponent, type: :component do
it 'renders content when provided' do
render_inline(described_class.new) do |component|
- component.with_group_header(title: "A Title")
+ component.with_header(title: "A Title")
"Raw Content"
end