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

- https://community.openproject.org/work_packages/59359
This commit is contained in:
Eric Schubert
2025-09-26 14:22:28 +02:00
parent 0a12e2eafc
commit cdc8201ab8
@@ -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