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
updates the item service to user the form value rather than the param
Marcello Rocha0fa62a154eaf
diff --git a/app/controllers/admin/custom_fields/hierarchy/items_controller.rb b/app/controllers/admin/custom_fields/hierarchy/items_controller.rbindex b40a44c5706..b5b5a70d30f 100644--- a/app/controllers/admin/custom_fields/hierarchy/items_controller.rb+++ b/app/controllers/admin/custom_fields/hierarchy/items_controller.rb@@ -56,7 +56,7 @@ module Adminenddef new- @new_item = ::CustomField::Hierarchy::Item.new(parent: @active_item)+ @new_item = ::CustomField::Hierarchy::Item.new(parent: @active_item, sort_order: params[:position])enddef edit; end@@ -65,8 +65,12 @@ module Adminitem_service.insert_item(**item_input).either(- ->(_) { redirect_to(new_child_custom_field_item_path(@custom_field, @active_item), status: :see_other) },- ->(validation_result) do+ lambda do |item|+ redirect_to(+ new_child_custom_field_item_path(@custom_field, @active_item, position: item.sort_order + 1)+ )+ end,+ lambda do |validation_result|add_errors_to_form(validation_result)render action: :newend@@ -77,10 +81,10 @@ module Adminitem_service.update_item(item: @active_item, label: item_input[:label], short: item_input[:short]).either(- ->(_) do- redirect_to(custom_field_item_path(@custom_field, @active_item.parent), status: :see_other)+ lambda do |_|+ redirect_to(custom_field_item_path(@custom_field, @active_item.parent))end,- ->(validation_result) do+ lambda do |validation_result|add_errors_to_edit_form(validation_result)render action: :editend@@ -111,6 +115,7 @@ module Admindef item_inputinput = { parent: @active_item, label: params[:label] }input[:short] = params[:short] if params[:short].present?+ input[:sort_order] = params[:sort_order].to_i if params[:sort_order].present?inputend