Skip to content

Commit

Permalink
Merge pull request #16837 from opf/implementation/57813-add-new-custo…
Browse files Browse the repository at this point in the history
…m-field-type-hierarchy

[#57813] amend custom field code to allow creation
  • Loading branch information
Kharonus authored Sep 30, 2024
2 parents 011f74e + 02d1207 commit 2faea13
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 8 additions & 0 deletions app/services/custom_fields/create_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ def after_perform(call)

if cf.is_a?(ProjectCustomField)
add_cf_to_visible_columns(cf)
elsif cf.field_format == "hierarchy"
# TODO: Use persistence service
CustomField::Hierarchy::Item.create(custom_field: cf,
label: nil,
parent: nil,
short: nil,
sort_order: 0)
.save
end

call
Expand Down
8 changes: 4 additions & 4 deletions lib/open_project/custom_field_format_dependent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ class CustomFieldFormatDependent
allowNonOpenVersions: [:only, %w[version]],
defaultBool: [:only, %w[bool]],
defaultLongText: [:only, %w[text]],
defaultText: [:except, %w[list bool date text user version]],
length: [:except, %w[list bool date user version link]],
multiSelect: [:only, %w[list user version]],
defaultText: [:except, %w[list bool date text user version hierarchy]],
length: [:except, %w[list bool date user version link hierarchy]],
multiSelect: [:only, %w[list user version hierarchy]],
possibleValues: [:only, %w[list]],
regexp: [:except, %w[list bool date user version]],
regexp: [:except, %w[list bool date user version hierarchy]],
searchable: [:except, %w[bool date float int user version]],
textOrientation: [:only, %w[text]]
}.freeze
Expand Down

0 comments on commit 2faea13

Please sign in to comment.