[#73968] Move card metrics to Backlogs

Remove the story-points display from the shared work package card and
expose a generic metric slot instead. Backlogs now opts into that slot
with a small story-points component when rendering sprint, bucket, and
inbox cards.

https://community.openproject.org/wp/73968
This commit is contained in:
Alexander Brandon Coles
2026-05-01 19:48:20 +02:00
parent 60bb8e1ea9
commit 35d3fc8e8b
19 changed files with 276 additions and 22 deletions
@@ -41,7 +41,9 @@ module OpenProject
work_packages = sprint.work_packages_for(project).limit(3)
render OpenProject::Common::WorkPackageCardBoxComponent.new(
work_packages:, project:, container: sprint
work_packages:,
project:,
container: sprint
) do |box|
box.with_header(title: sprint.name, count: work_packages.size) do |header|
points = work_packages.sum { |w| w.story_points || 0 }
@@ -41,6 +41,19 @@ module OpenProject
)
end
def with_metric
work_package = WorkPackage.first
return preview_message("No work packages in the database.") unless work_package
render OpenProject::Common::WorkPackageCardComponent.new(
work_package:
) do |card|
card.with_metric do
render Backlogs::StoryPointsComponent.new(work_package:)
end
end
end
private
def preview_message(text)