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

[#64347] only use hidden fields for new records

Tobias Dillmann82c63443d7ce
diff --git a/app/components/admin/custom_fields/calculated_values/details_form.rb b/app/components/admin/custom_fields/calculated_values/details_form.rb
index 79abd41c760..b1a483daf9e 100644
--- a/app/components/admin/custom_fields/calculated_values/details_form.rb
+++ b/app/components/admin/custom_fields/calculated_values/details_form.rb
@@ -31,6 +31,11 @@
module Admin::CustomFields::CalculatedValues
class DetailsForm < ApplicationForm
form do |details_form|
+ if model.new_record?
+ details_form.hidden(name: :field_format)
+ details_form.hidden(name: :type, scope_name_to_model: false)
+ end
+
details_form.text_field(
name: :name,
label: I18n.t(:label_name),
@@ -67,9 +72,6 @@ module Admin::CustomFields::CalculatedValues
caption: I18n.t("custom_fields.instructions.admin_only")
)
- details_form.hidden(name: :field_format)
- details_form.hidden(name: :type, scope_name_to_model: false)
-
details_form.submit(name: :submit, label: I18n.t(:button_save), scheme: :default)
end
end