Skip to content

Commit

Permalink
[#57814] added predicate for field_format
Browse files Browse the repository at this point in the history
  • Loading branch information
Kharonus committed Oct 1, 2024
1 parent e0097af commit 6fdbc59
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions app/models/custom_field.rb
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,10 @@ def multi_value_possible?
version? || user? || list?
end

def field_format_hierarchy?
field_format == "hierarchy"
end

def allow_non_open_versions_possible?
version?
end
Expand Down
2 changes: 1 addition & 1 deletion app/services/custom_fields/create_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def after_perform(call)

if cf.is_a?(ProjectCustomField)
add_cf_to_visible_columns(cf)
elsif cf.field_format == "hierarchy"
elsif cf.field_format_hierarchy?
# TODO: Use persistence service
CustomField::Hierarchy::Item.create(custom_field: cf,
label: nil,
Expand Down
2 changes: 1 addition & 1 deletion app/views/custom_fields/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ See COPYRIGHT and LICENSE files for more details.
<%= error_messages_for 'custom_field' %>
<% if @custom_field.field_format == "hierarchy" %>
<% if @custom_field.field_format_hierarchy? %>
<%= render CustomFields::DetailsComponent.new(@custom_field) %>
<% else %>
<%= labelled_tabular_form_for @custom_field, as: :custom_field,
Expand Down

0 comments on commit 6fdbc59

Please sign in to comment.