Skip to content

Commit f76b26a

Browse files
committed
Release OpenProject 16.6.1
2 parents f329392 + 8a6c7b5 commit f76b26a

File tree

196 files changed

+1388
-634
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

196 files changed

+1388
-634
lines changed

.github/workflows/docker-scheduled.yml

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,17 @@ on:
77
workflow_dispatch: # Allow manual trigger
88

99
jobs:
10-
generate-matrix:
11-
runs-on: ubuntu-latest
12-
outputs:
13-
matrix: ${{ steps.set-matrix.outputs.matrix }}
14-
steps:
15-
- uses: actions/checkout@v5
16-
- name: Generate matrix
17-
id: set-matrix
18-
run: ruby script/gh/docker-tags.rb --matrix
19-
20-
build:
21-
needs: generate-matrix
22-
strategy:
23-
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
24-
fail-fast: false
10+
build-dev:
2511
uses: ./.github/workflows/docker.yml
2612
with:
27-
branch: ${{ matrix.branch }}
28-
tag: ${{ matrix.tag }}
29-
secrets: inherit
13+
branch: dev
14+
tag: dev
15+
secrets: inherit
16+
build-release-candidate:
17+
# References to release/X.Y and X.Y-rc are being
18+
# updated from the devkit (UpdateWorkflows step) whenever a new release branch is created
19+
uses: opf/openproject/.github/workflows/docker.yml@release/16.6
20+
with:
21+
branch: release/16.6
22+
tag: 16.6-rc
23+
secrets: inherit

app/components/admin/custom_fields/hierarchy/change_item_parent_dialog_component.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def form_id = "custom-fields--change-item-parent-form"
5050
def form_arguments
5151
{
5252
id: form_id,
53-
url: change_parent_custom_field_item_path(custom_field_id: @custom_field.id, id: @hierarchy_item.id),
53+
url:,
5454
model: form_model,
5555
method: :post
5656
}
@@ -65,6 +65,15 @@ def hierarchy_service
6565
def form_model
6666
CustomField::Hierarchy::Forms::NewParentFormModel.new(new_parent: [])
6767
end
68+
69+
def url
70+
if @custom_field.is_a?(ProjectCustomField)
71+
change_parent_admin_settings_project_custom_field_item_path(project_custom_field_id: @custom_field.id,
72+
id: @hierarchy_item.id)
73+
else
74+
change_parent_custom_field_item_path(custom_field_id: @custom_field.id, id: @hierarchy_item.id)
75+
end
76+
end
6877
end
6978
end
7079
end

app/components/admin/custom_fields/hierarchy/delete_item_dialog_component.rb

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,21 @@ def initialize(custom_field:, hierarchy_item:)
4444

4545
def form_arguments
4646
{
47-
action: custom_field_item_path(custom_field_id: @custom_field.id, id: @hierarchy_item.id),
47+
action: url,
4848
method: :delete
4949
}
5050
end
51+
52+
private
53+
54+
def url
55+
if @custom_field.is_a?(ProjectCustomField)
56+
admin_settings_project_custom_field_item_path(project_custom_field_id: @custom_field.id,
57+
id: @hierarchy_item.id)
58+
else
59+
custom_field_item_path(custom_field_id: @custom_field.id, id: @hierarchy_item.id)
60+
end
61+
end
5162
end
5263
end
5364
end

app/components/admin/custom_fields/hierarchy/item_component.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ See COPYRIGHT and LICENSE files for more details.
3838
render(Primer::OpenProject::DragHandle.new(draggable: true))
3939
end
4040
item_information.with_column(mr: 2) do
41-
render(Primer::Beta::Link.new(href: custom_field_item_path(@root.custom_field_id, model), underline: false)) do
41+
render(Primer::Beta::Link.new(href: item_link, underline: false)) do
4242
render(Primer::Beta::Text.new(font_weight: :bold)) { model.label }
4343
end
4444
end

app/components/admin/custom_fields/hierarchy/item_component.rb

Lines changed: 93 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,16 @@ def short_text
4949
"(#{model.short})"
5050
end
5151

52+
def item_link
53+
custom_field = @root.custom_field
54+
55+
if project_custom_field_context?
56+
admin_settings_project_custom_field_item_path(custom_field.id, model)
57+
else
58+
custom_field_item_path(custom_field.id, model)
59+
end
60+
end
61+
5262
def secondary_text
5363
if model.short.present?
5464
"(#{model.short})"
@@ -98,58 +108,102 @@ def menu_items(menu) # rubocop:disable Metrics/AbcSize
98108

99109
private
100110

111+
def project_custom_field_context?
112+
@root.custom_field.is_a?(ProjectCustomField)
113+
end
114+
115+
def custom_field_id = @root.custom_field_id
116+
101117
def edit_action_item(menu)
102-
menu.with_item(label: I18n.t(:button_edit),
103-
tag: :a,
104-
href: edit_custom_field_item_path(@root.custom_field_id, model)) do |item|
118+
href = if project_custom_field_context?
119+
edit_admin_settings_project_custom_field_item_path(custom_field_id, model)
120+
else
121+
edit_custom_field_item_path(custom_field_id, model)
122+
end
123+
124+
menu.with_item(label: I18n.t(:button_edit), tag: :a, href:) do |item|
105125
item.with_leading_visual_icon(icon: :pencil)
106126
end
107127
end
108128

109129
def add_above_action_item(menu)
130+
parent = model.parent
131+
position = model.sort_order
132+
href = if project_custom_field_context?
133+
new_child_admin_settings_project_custom_field_item_path(custom_field_id, parent, position:)
134+
else
135+
new_child_custom_field_item_path(custom_field_id, parent, position:)
136+
end
137+
110138
menu.with_item(
111139
label: I18n.t(:button_add_item_above),
112140
tag: :a,
113-
content_arguments: { data: { turbo_frame: ItemsComponent.wrapper_key } },
114-
href: new_child_custom_field_item_path(@root.custom_field_id, model.parent, position: model.sort_order)
141+
href:,
142+
content_arguments: { data: { turbo_frame: ItemsComponent.wrapper_key } }
115143
) { it.with_leading_visual_icon(icon: "fold-up") }
116144
end
117145

118146
def add_below_action_item(menu)
147+
parent = model.parent
148+
position = model.sort_order + 1
149+
href = if project_custom_field_context?
150+
new_child_admin_settings_project_custom_field_item_path(custom_field_id, parent, position:)
151+
else
152+
new_child_custom_field_item_path(custom_field_id, parent, position:)
153+
end
154+
119155
menu.with_item(
120156
label: I18n.t(:button_add_item_below),
121157
tag: :a,
122-
content_arguments: { data: { turbo_frame: ItemsComponent.wrapper_key } },
123-
href: new_child_custom_field_item_path(@root.custom_field_id, model.parent, position: model.sort_order + 1)
158+
href:,
159+
content_arguments: { data: { turbo_frame: ItemsComponent.wrapper_key } }
124160
) { it.with_leading_visual_icon(icon: "fold-down") }
125161
end
126162

127163
def add_sub_item_action_item(menu)
128-
position = model.children.any? ? model.children.maximum(:sort_order) + 1 : 0
164+
children = model.children
165+
position = children.any? ? children.maximum(:sort_order) + 1 : 0
166+
href = if project_custom_field_context?
167+
new_child_admin_settings_project_custom_field_item_path(custom_field_id, model, position:)
168+
else
169+
new_child_custom_field_item_path(custom_field_id, model, position:)
170+
end
129171

130172
menu.with_item(
131173
label: I18n.t(:button_add_sub_item),
132174
tag: :a,
133-
content_arguments: { data: { turbo_frame: ItemsComponent.wrapper_key } },
134-
href: new_child_custom_field_item_path(@root.custom_field_id, model, position:)
175+
href:,
176+
content_arguments: { data: { turbo_frame: ItemsComponent.wrapper_key } }
135177
) { it.with_leading_visual_icon(icon: "op-arrow-in") }
136178
end
137179

138180
def change_parent_item(menu)
181+
href = if project_custom_field_context?
182+
change_parent_admin_settings_project_custom_field_item_path(project_custom_field_id: custom_field_id,
183+
id: model.id)
184+
else
185+
change_parent_custom_field_item_path(custom_field_id:, id: model.id)
186+
end
187+
139188
menu.with_item(
140189
label: I18n.t(:label_change_parent),
141190
tag: :a,
142-
content_arguments: { data: { controller: "async-dialog" } },
143-
href: change_parent_custom_field_item_path(custom_field_id: @root.custom_field_id, id: model.id)
191+
href:,
192+
content_arguments: { data: { controller: "async-dialog" } }
144193
) { it.with_leading_visual_icon(icon: "arrow-switch") }
145194
end
146195

147196
def move_to_top_action_item(menu)
148197
form_inputs = [{ name: "new_sort_order", value: 0 }]
198+
href = if project_custom_field_context?
199+
move_admin_settings_project_custom_field_item_path(custom_field_id, model)
200+
else
201+
move_custom_field_item_path(custom_field_id, model)
202+
end
149203

150204
menu.with_item(label: I18n.t(:label_sort_highest),
151205
tag: :button,
152-
href: move_custom_field_item_path(@root.custom_field_id, model),
206+
href:,
153207
content_arguments: { data: { turbo_frame: ItemsComponent.wrapper_key } },
154208
form_arguments: { method: :post, inputs: form_inputs }) do |item|
155209
item.with_leading_visual_icon(icon: "move-to-top")
@@ -158,10 +212,15 @@ def move_to_top_action_item(menu)
158212

159213
def move_up_action_item(menu)
160214
form_inputs = [{ name: "new_sort_order", value: model.sort_order - 1 }]
215+
href = if project_custom_field_context?
216+
move_admin_settings_project_custom_field_item_path(custom_field_id, model)
217+
else
218+
move_custom_field_item_path(custom_field_id, model)
219+
end
161220

162221
menu.with_item(label: I18n.t(:label_sort_higher),
163222
tag: :button,
164-
href: move_custom_field_item_path(@root.custom_field_id, model),
223+
href:,
165224
content_arguments: { data: { turbo_frame: ItemsComponent.wrapper_key } },
166225
form_arguments: { method: :post, inputs: form_inputs }) do |item|
167226
item.with_leading_visual_icon(icon: "chevron-up")
@@ -170,10 +229,15 @@ def move_up_action_item(menu)
170229

171230
def move_down_action_item(menu)
172231
form_inputs = [{ name: "new_sort_order", value: model.sort_order + 2 }]
232+
href = if project_custom_field_context?
233+
move_admin_settings_project_custom_field_item_path(custom_field_id, model)
234+
else
235+
move_custom_field_item_path(custom_field_id, model)
236+
end
173237

174238
menu.with_item(label: I18n.t(:label_sort_lower),
175239
tag: :button,
176-
href: move_custom_field_item_path(@root.custom_field_id, model),
240+
href:,
177241
content_arguments: { data: { turbo_frame: ItemsComponent.wrapper_key } },
178242
form_arguments: { method: :post, inputs: form_inputs }) do |item|
179243
item.with_leading_visual_icon(icon: "chevron-down")
@@ -182,21 +246,33 @@ def move_down_action_item(menu)
182246

183247
def move_to_bottom_action_item(menu)
184248
form_inputs = [{ name: "new_sort_order", value: model.parent.children.length + 1 }]
249+
href = if project_custom_field_context?
250+
move_admin_settings_project_custom_field_item_path(custom_field_id, model)
251+
else
252+
move_custom_field_item_path(custom_field_id, model)
253+
end
185254

186255
menu.with_item(label: I18n.t(:label_sort_lowest),
187256
tag: :button,
188-
href: move_custom_field_item_path(@root.custom_field_id, model),
257+
href:,
189258
content_arguments: { data: { turbo_frame: ItemsComponent.wrapper_key } },
190259
form_arguments: { method: :post, inputs: form_inputs }) do |item|
191260
item.with_leading_visual_icon(icon: "move-to-bottom")
192261
end
193262
end
194263

195264
def deletion_action_item(menu)
265+
href = if project_custom_field_context?
266+
delete_admin_settings_project_custom_field_item_path(project_custom_field_id: custom_field_id,
267+
id: model.id)
268+
else
269+
delete_custom_field_item_path(custom_field_id:, id: model.id)
270+
end
271+
196272
menu.with_item(label: I18n.t(:button_delete),
197273
scheme: :danger,
198274
tag: :a,
199-
href: delete_custom_field_item_path(custom_field_id: @root.custom_field_id, id: model.id),
275+
href:,
200276
content_arguments: { data: { controller: "async-dialog" } }) do |item|
201277
item.with_leading_visual_icon(icon: :trash)
202278
end

app/components/admin/custom_fields/hierarchy/item_form_component.rb

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,7 @@ def item_options
4646
end
4747

4848
def http_verb
49-
model.new_record? ? :post : :put
50-
end
51-
52-
def url
53-
if model.new_record?
54-
new_child_custom_field_item_path(root.custom_field_id, model.parent, position: model.sort_order)
55-
else
56-
custom_field_item_path(root.custom_field_id, model)
57-
end
49+
new_record? ? :post : :put
5850
end
5951

6052
def secondary_input_format
@@ -72,7 +64,31 @@ def secondary_input_format
7264
private
7365

7466
def root
75-
@root ||= model.new_record? ? model.parent.root : model.root
67+
@root ||= new_record? ? model.parent.root : model.root
68+
end
69+
70+
def project_custom_field_context?
71+
root.custom_field.is_a?(ProjectCustomField)
72+
end
73+
74+
def new_record? = model.new_record?
75+
76+
def custom_field_id = root.custom_field_id
77+
78+
def url # rubocop:disable Metrics/AbcSize
79+
parent = model.parent
80+
position = model.sort_order
81+
if project_custom_field_context?
82+
if new_record?
83+
new_child_admin_settings_project_custom_field_item_path(custom_field_id, parent, position:)
84+
else
85+
admin_settings_project_custom_field_item_path(custom_field_id, model)
86+
end
87+
elsif new_record?
88+
new_child_custom_field_item_path(custom_field_id, parent, position:)
89+
else
90+
custom_field_item_path(custom_field_id, model)
91+
end
7692
end
7793
end
7894
end

app/components/admin/custom_fields/hierarchy/items_component.rb

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,13 @@ def root
4646

4747
def new_item_path
4848
position = model.children.any? ? model.children.last.sort_order + 1 : 0
49+
custom_field_id = root.custom_field_id
4950

50-
new_child_custom_field_item_path(root.custom_field_id, model, position:)
51+
if project_custom_field_context?
52+
new_child_admin_settings_project_custom_field_item_path(custom_field_id, model, position:)
53+
else
54+
new_child_custom_field_item_path(custom_field_id, model, position:)
55+
end
5156
end
5257

5358
def children
@@ -89,14 +94,28 @@ def blank_description_text
8994

9095
private
9196

92-
def slices
93-
nodes = ::CustomFields::Hierarchy::HierarchicalItemService.new.get_branch(item: model).value!
97+
def project_custom_field_context?
98+
root.custom_field.is_a?(ProjectCustomField)
99+
end
100+
101+
def branch(item)
102+
::CustomFields::Hierarchy::HierarchicalItemService.new.get_branch(item:).value!
103+
end
104+
105+
def slices # rubocop:disable Metrics/AbcSize
106+
custom_field = root.custom_field
94107

95-
nodes.map do |item|
96-
if item.root?
97-
{ href: custom_field_items_path(root.custom_field_id), label: root.custom_field.name }
108+
branch(model).map do |item|
109+
if project_custom_field_context?
110+
if item.root?
111+
{ href: admin_settings_project_custom_field_items_path(custom_field.id), label: custom_field.name }
112+
else
113+
{ href: admin_settings_project_custom_field_item_path(custom_field.id, item), label: item.label }
114+
end
115+
elsif item.root?
116+
{ href: custom_field_items_path(custom_field.id), label: custom_field.name }
98117
else
99-
{ href: custom_field_item_path(root.custom_field_id, item), label: item.label }
118+
{ href: custom_field_item_path(custom_field.id, item), label: item.label }
100119
end
101120
end
102121
end

0 commit comments

Comments
 (0)