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

[#59359] redirect to edit path after creating a custom field

Eric Schubertcdc8201ab85e
diff --git a/app/controllers/concerns/custom_fields/shared_actions.rb b/app/controllers/concerns/custom_fields/shared_actions.rb
index ebacebf5458..da469b00ec8 100644
--- a/app/controllers/concerns/custom_fields/shared_actions.rb
+++ b/app/controllers/concerns/custom_fields/shared_actions.rb
@@ -55,9 +55,10 @@ module CustomFields
.call(get_custom_field_params.merge(type: permitted_params.custom_field_type))
if call.success?
+ custom_field = call.result
flash[:notice] = t(:notice_successful_create)
- call_hook(:controller_custom_fields_new_after_save, custom_field: call.result)
- redirect_to index_path(call.result, tab: call.result.class.name)
+ call_hook(:controller_custom_fields_new_after_save, custom_field:)
+ redirect_to edit_path(custom_field, id: custom_field.id)
else
@custom_field = call.result || new_custom_field
render action: :new, status: :unprocessable_entity
@@ -142,7 +143,7 @@ module CustomFields
index = 0
- params[:custom_field][:custom_options_attributes].each do |_id, attributes|
+ params[:custom_field][:custom_options_attributes].each_value do |attributes|
attributes[:position] = (index = index + 1)
end
end