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

Replace opce-attribute-help-text: Project overview

Alexander Brandon Coles3de4532da41a
diff --git a/modules/overviews/app/components/overviews/project_custom_fields/item_component.html.erb b/modules/overviews/app/components/overviews/project_custom_fields/item_component.html.erb
index 16ef2cd67d8..382842ee8f0 100644
--- a/modules/overviews/app/components/overviews/project_custom_fields/item_component.html.erb
+++ b/modules/overviews/app/components/overviews/project_custom_fields/item_component.html.erb
@@ -8,18 +8,12 @@
}
) do |custom_field_value_container|
# temporarily using inline styles in order to align the content as desired
- custom_field_value_container.with_row(mb: 1) do
- render(Primer::Beta::Text.new(font_weight: :bold)) do
- concat(@project_custom_field.name + " ")
- concat(
- helpers.angular_component_tag(
- "opce-attribute-help-text",
- inputs: {
- attribute: @project_custom_field.attribute_name(:camel_case),
- attributeScope: "Project"
- }
- )
- )
+ custom_field_value_container.with_row(mb: 1) do |attribute_name|
+ render OpenProject::Common::AttributeLabelComponent.new(
+ attribute: @project_custom_field.attribute_name,
+ model: @project
+ ) do
+ render(Primer::Beta::Text.new(font_weight: :bold)) { @project_custom_field.name }
end
end
diff --git a/modules/overviews/app/components/overviews/project_custom_fields/item_component.rb b/modules/overviews/app/components/overviews/project_custom_fields/item_component.rb
index 954fecc3a3b..c91f41e5ed6 100644
--- a/modules/overviews/app/components/overviews/project_custom_fields/item_component.rb
+++ b/modules/overviews/app/components/overviews/project_custom_fields/item_component.rb
@@ -35,11 +35,12 @@ module Overviews
include CustomFieldsHelper
include OpPrimer::ComponentHelpers
- def initialize(project_custom_field:, project_custom_field_values:)
+ def initialize(project_custom_field:, project_custom_field_values:, project:)
super
@project_custom_field = project_custom_field
@project_custom_field_values = project_custom_field_values
+ @project = project
end
private
diff --git a/modules/overviews/app/components/overviews/project_custom_fields/show_component.html.erb b/modules/overviews/app/components/overviews/project_custom_fields/show_component.html.erb
index bdcaadcbde3..7fa043fd75c 100644
--- a/modules/overviews/app/components/overviews/project_custom_fields/show_component.html.erb
+++ b/modules/overviews/app/components/overviews/project_custom_fields/show_component.html.erb
@@ -28,7 +28,8 @@
render(
Overviews::ProjectCustomFields::ItemComponent.new(
project_custom_field:,
- project_custom_field_values: get_eager_loaded_project_custom_field_values_for(project_custom_field.id)
+ project_custom_field_values: get_eager_loaded_project_custom_field_values_for(project_custom_field.id),
+ project: @project
)
)
end
diff --git a/spec/features/projects/project_custom_fields/overview_page/sidebar_spec.rb b/spec/features/projects/project_custom_fields/overview_page/sidebar_spec.rb
index d6a42512735..f4d80a851b5 100644
--- a/spec/features/projects/project_custom_fields/overview_page/sidebar_spec.rb
+++ b/spec/features/projects/project_custom_fields/overview_page/sidebar_spec.rb
@@ -850,14 +850,23 @@ RSpec.describe "Show project custom fields on project overview page", :js do
create :project_help_text,
attribute_name: boolean_project_custom_field.attribute_name
end
- let(:modal) { Components::AttributeHelpTextModal.new(instance) }
it "displays when active" do
overview_page.visit_page
+
# Open help text modal
- modal.open!
- expect(modal.modal_container).to have_text "Attribute help text"
- modal.expect_edit(editable: true)
+ page.find("[data-qa-help-text-for='#{instance.attribute_name.camelize(:lower)}']").click
+
+ within_modal "Boolean field" do
+ expect(page).to have_text "Attribute help text"
+
+ expect(page).to have_button "Close"
+ expect(page).to have_link "Edit"
+
+ click_on "Close"
+ end
+
+ expect(page).to have_no_modal "Boolean field"
end
end
end