%= form_with(model: active_field, scope: :active_field, url: active_field.persisted? ? active_field_path(active_field) : active_fields_path) do |f| %>
<% if active_field.errors.any? %>
<%= pluralize(active_field.errors.count, "error") %> prohibited this record from being saved:
<% active_field.errors.each do |error| %>
- <%= error.full_message %>
<% end %>
<% end %>
<%= f.label :type %>
<%=
f.text_field :type,
name: "type",
value: active_field.type_name,
disabled: active_field.persisted?,
readonly: active_field.new_record?
%>
<%= f.label :customizable_type %>
<%= f.select :customizable_type, ["TODO: add allowed customizable model names"], {}, { disabled: active_field.persisted? } %>
<%= f.label :name %>
<%= f.text_field :name %>
<%= f.label :min_size %>
<%= f.number_field :min_size, disabled: active_field.persisted? %>
<%= f.label :max_size %>
<%= f.number_field :max_size, disabled: active_field.persisted? %>
<%= f.label :allowed_values %>
<%=
render_array_field(
form: f,
name: :allowed_values,
value: active_field.allowed_values,
field_method: :text_field,
field_opts: { disabled: active_field.persisted? }
)
%>
<%= f.label :default_value %>
<%=
render_array_field(
form: f,
name: :default_value,
value: active_field.default_value,
field_method: :text_field,
)
%>
<%= f.submit %>
<% end %>