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

setting custom fields controller on content tag doesn't seem to be needed

Ivan Kuchina93b09a0bd68
diff --git a/app/helpers/custom_fields_helper.rb b/app/helpers/custom_fields_helper.rb
index 93bad92c3d7..3cf850fbe07 100644
--- a/app/helpers/custom_fields_helper.rb
+++ b/app/helpers/custom_fields_helper.rb
@@ -42,7 +42,7 @@ module CustomFieldsHelper
}.freeze
def self.stimulus_config
- CONFIG.map { |target_name, (operator, formats)| [target_name, operator, formats] }
+ CONFIG.map { |target_name, (operator, formats)| [target_name, operator, formats] }.to_json
end
attr_reader :format
@@ -248,6 +248,4 @@ module CustomFieldsHelper
format.label.is_a?(Proc) ? format.label.call : I18n.t(format.label)
end
end
-
- def custom_fields_format_config = CustomFieldsHelper::FormatDependent.stimulus_config
end
diff --git a/app/views/custom_fields/_form.html.erb b/app/views/custom_fields/_form.html.erb
index 1db1eb151a3..ad2634f25ec 100644
--- a/app/views/custom_fields/_form.html.erb
+++ b/app/views/custom_fields/_form.html.erb
@@ -29,9 +29,13 @@ See COPYRIGHT and LICENSE files for more details.
<% format_dependent = CustomFieldsHelper::FormatDependent.new(@custom_field.field_format) %>
-<% content_controller 'admin--custom-fields', dynamic: true, 'admin--custom-fields-format-config-value': custom_fields_format_config %>
-
-<section class="form--section" id="custom_field_form">
+<section
+ class="form--section"
+ id="custom_field_form"
+ data-controller="admin--custom-fields"
+ data-application-target="dynamic"
+ data-admin--custom-fields-format-config-value="<%= CustomFieldsHelper::FormatDependent.stimulus_config %>"
+>
<div class="form--field -required" id="custom_field_name_attributes">
<%= f.text_field :name, required: true, container_class: '-middle' %>
</div>