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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Add new child wp in relations tab
Oliver Günther2413b5def751
diff --git a/app/components/work_package_relations_tab/index_component.rb b/app/components/work_package_relations_tab/index_component.rbindex 247cc519594..65ff1b97213 100644--- a/app/components/work_package_relations_tab/index_component.rb+++ b/app/components/work_package_relations_tab/index_component.rb@@ -66,19 +66,58 @@ class WorkPackageRelationsTab::IndexComponent < ApplicationComponentpadding: :condensed,data: { test_selector: "op-relation-group-#{relation_type}" })) do |border_box|- render_header(border_box, title, items)+ if relation_type == :children && should_render_add_child?+ render_children_header(border_box, title, items)+ else+ render_header(border_box, title, items)+ end+render_items(border_box, items, &_block)endenddef render_header(border_box, title, items)border_box.with_header(py: 3) do- flex_layout(align_items: :center) do |flex|- flex.with_column(mr: 2) do- render(Primer::Beta::Text.new(font_size: :normal, font_weight: :bold)) { title }+ concat render(Primer::Beta::Text.new(mr: 2, font_size: :normal, font_weight: :bold)) { title }+ concat render(Primer::Beta::Counter.new(count: items.size, round: true, scheme: :primary))+ end+ end++ def render_children_header(border_box, title, items)+ border_box.with_header(py: 3) do+ flex_layout(justify_content: :space_between) do |header|+ header.with_column(mr: 2) do+ concat render(Primer::Beta::Text.new(mr: 2, font_size: :normal, font_weight: :bold)) { title }+ concat render(Primer::Beta::Counter.new(count: items.size, round: true, scheme: :primary))end- flex.with_column do- render(Primer::Beta::Counter.new(count: items.size, round: true, scheme: :primary))+ header.with_column do+ render(Primer::Alpha::ActionMenu.new(menu_id: "new-child-relation")) do |menu|+ menu.with_show_button do |button|+ button.with_leading_visual_icon(icon: :plus)+ button.with_trailing_action_icon(icon: :"triangle-down")+ t("work_package_relations_tab.label_add_child_button")+ end++ menu.with_item(+ label: t("work_package_relations_tab.relations.new_child"),+ href: "#",+ content_arguments: {+ data: { turbo_stream: true }+ }+ ) do |item|+ item.with_description.with_content(t("work_package_relations_tab.relations.new_child_text"))+ end++ menu.with_item(+ label: t("work_package_relations_tab.relations.existing_child"),+ href: "#",+ content_arguments: {+ data: { turbo_stream: true }+ }+ ) do |item|+ item.with_description.with_content(t("work_package_relations_tab.relations.child_description"))+ end+ endendendenddiff --git a/config/locales/en.yml b/config/locales/en.ymlindex ff3744163eb..e94cc9e0c4c 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -740,6 +740,7 @@ en:no_results_title_text: There are currently no relations available.blankslate_heading: "No relations"blankslate_description: "This work package does not have any relations yet."+ label_add_child_button: "Child"label_add_x: "Add %{x}"label_edit_x: "Edit %{x}"label_add_description: "Add description"@@ -762,6 +763,9 @@ en:follows_description: "The related work package necessarily needs to finish before this one can start"label_child_singular: "child"label_child_plural: "children"+ new_child: "New child"+ new_child_text: "Creates a related work package as a sub-item of the current (parent) work package"+ existing_child: "Existing child"child_description: "Makes the related work package a sub-item of the current (parent) work package"label_blocks_singular: "blocks"label_blocks_plural: "blocks"