Skip to content

Commit 5cec720

Browse files
committed
Use second-level navigation for the Relations create menu
1 parent f0466ac commit 5cec720

File tree

9 files changed

+39
-29
lines changed

9 files changed

+39
-29
lines changed

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,4 +417,4 @@ end
417417

418418
gem "openproject-octicons", "~>19.25.0"
419419
gem "openproject-octicons_helper", "~>19.25.0"
420-
gem "openproject-primer_view_components", "~>0.68.0"
420+
gem "openproject-primer_view_components", "~>0.69.1"

Gemfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,7 @@ GEM
856856
actionview
857857
openproject-octicons (= 19.25.0)
858858
railties
859-
openproject-primer_view_components (0.68.0)
859+
openproject-primer_view_components (0.69.1)
860860
actionview (>= 7.1.0)
861861
activesupport (>= 7.1.0)
862862
openproject-octicons (>= 19.25.0)
@@ -1445,7 +1445,7 @@ DEPENDENCIES
14451445
openproject-octicons (~> 19.25.0)
14461446
openproject-octicons_helper (~> 19.25.0)
14471447
openproject-openid_connect!
1448-
openproject-primer_view_components (~> 0.68.0)
1448+
openproject-primer_view_components (~> 0.69.1)
14491449
openproject-recaptcha!
14501450
openproject-reporting!
14511451
openproject-storages!
@@ -1817,7 +1817,7 @@ CHECKSUMS
18171817
openproject-octicons (19.25.0) sha256=16fc221375e693f0e893b1c208286f2d7719ae4dfe080c5415642b221f51f550
18181818
openproject-octicons_helper (19.25.0) sha256=9b1778a67b0015ebe84ca0471f74e31004b985a8dcaaa443f7a2ac365b0a4e2d
18191819
openproject-openid_connect (1.0.0)
1820-
openproject-primer_view_components (0.68.0) sha256=847cc5e0e2933e3c34f6106c6bb6b68d4563ef649401a59e794660b4aa50c47f
1820+
openproject-primer_view_components (0.69.1) sha256=34f127506d86e30cd8ce2bad74071d18aa22f0fe7935876bf5363e032084228a
18211821
openproject-recaptcha (1.0.0)
18221822
openproject-reporting (1.0.0)
18231823
openproject-storages (1.0.0)

app/components/work_package_relations_tab/index_component.html.erb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@
2222
t(:label_relation)
2323
end
2424

25-
render_add_relations_menu_items(menu, ADD_RELATION_MENU_TYPES)
25+
render_add_relations_menu_items(menu, FIRST_LEVEL_RELATION_MENU_TYPES)
26+
menu.with_sub_menu_item(
27+
label: t("#{I18N_NAMESPACE}.relations.label_other_relations"),
28+
menu_id: ADD_RELATION_SUB_MENU
29+
) do |sub_menu|
30+
render_add_relations_menu_items(sub_menu, SECOND_LEVEL_RELATION_MENU_TYPES)
31+
end
2632
end
2733
end
2834
end

app/components/work_package_relations_tab/index_component.rb

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
class WorkPackageRelationsTab::IndexComponent < ApplicationComponent
1010
FRAME_ID = "work-package-relations-tab-content"
1111
ADD_RELATION_ACTION_MENU = "add-relation-action-menu"
12+
ADD_RELATION_SUB_MENU = "add-relation-sub-menu"
1213
ADD_CHILD_ACTION_MENU = "add-child-action-menu"
1314
I18N_NAMESPACE = "work_package_relations_tab"
1415

@@ -17,20 +18,23 @@ class WorkPackageRelationsTab::IndexComponent < ApplicationComponent
1718
Relation::TYPE_CHILD
1819
].freeze
1920

20-
ADD_RELATION_MENU_TYPES = [
21+
FIRST_LEVEL_RELATION_MENU_TYPES = [
2122
*ADD_CHILD_MENU_TYPES,
22-
Relation::TYPE_RELATES,
2323
Relation::TYPE_FOLLOWS,
2424
Relation::TYPE_PRECEDES,
2525
Relation::TYPE_PARENT,
26-
Relation::TYPE_DUPLICATES,
27-
Relation::TYPE_DUPLICATED,
26+
Relation::TYPE_RELATES
27+
].freeze
28+
29+
SECOND_LEVEL_RELATION_MENU_TYPES = [
2830
Relation::TYPE_BLOCKS,
2931
Relation::TYPE_BLOCKED,
3032
Relation::TYPE_INCLUDES,
3133
Relation::TYPE_PARTOF,
3234
Relation::TYPE_REQUIRES,
33-
Relation::TYPE_REQUIRED
35+
Relation::TYPE_REQUIRED,
36+
Relation::TYPE_DUPLICATES,
37+
Relation::TYPE_DUPLICATED
3438
].freeze
3539

3640
include ApplicationHelper
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// We reference an ID as one is required to be specified for the action menu list.
22
// It can't be nested inside the BEM model as it's placed as a #top-layer element.
33
#add-relation-action-menu-list,
4+
#add-relation-sub-menu-list,
45
#add-child-action-menu-list
56
max-height: 510px
67
max-width: 280px

config/locales/en.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,7 @@ en:
888888

889889
label_parent_singular: "parent"
890890
label_parent_plural: "parent"
891+
label_other_relations: "Other relations"
891892
ghost_relation_title: "Related work package"
892893
ghost_relation_description: "This is not visible to you due to permissions."
893894

frontend/package-lock.json

Lines changed: 14 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,12 @@
102102
"@ngneat/content-loader": "^7.0.0",
103103
"@ngx-formly/core": "^6.1.4",
104104
"@openproject/octicons-angular": "^19.25.0",
105-
"@openproject/primer-view-components": "^0.68.0",
105+
"@openproject/primer-view-components": "^0.69.1",
106106
"@openproject/reactivestates": "^3.0.1",
107107
"@primer/css": "^21.5.0",
108108
"@primer/live-region-element": "^0.8.0",
109109
"@primer/primitives": "^9.1.2",
110-
"@primer/view-components": "npm:@openproject/primer-view-components@^0.68.0",
110+
"@primer/view-components": "npm:@openproject/primer-view-components@^0.69.1",
111111
"@types/hotwired__turbo": "^8.0.1",
112112
"@uirouter/angular": "^13.0.0",
113113
"@uirouter/core": "^6.1.0",

spec/support/components/work_packages/relations.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def add_relation_action_menu
128128
end
129129

130130
def new_relation_button
131-
page.find_test_selector("add-relation-action-menu").find_button
131+
page.find_test_selector("add-relation-action-menu").find_button(id: "add-relation-action-menu-button")
132132
end
133133

134134
def remove_relation(relatable)

0 commit comments

Comments
 (0)