<%# - - - - - - - - - - - - %>
<%# NAME %>
<%# - - - - - - - - - - - - %>
<%= ff.input :name, as: :string, input_html: { class: "form-item--input" } %>
<% if ff.object.new_record? %>
<%# - - - - - - - - - - - - %>
<%# SLUG %>
<%# - - - - - - - - - - - - %>
<%= ff.input :slug, as: :hidden, input_html: { class: "form-item--input" } %>
<%# - - - - - - - - - - - - %>
<%# FIELD TYPE %>
<%# - - - - - - - - - - - - %>
<% if ff.object.field_type.nil? %>
<%= ff.input :field_type, as: :select, collection: get_field_types, include_blank: false, prompt: t(:select_field_type), input_html: { class: 'form-item--select-input' } %>
<% else %>
<%= ff.input :field_type, as: :string, disabled: true, input_html: { class: "form-item--input" } %>
<% end %>
<% else %>
<%# - - - - - - - - - - - - %>
<%# SLUG %>
<%# - - - - - - - - - - - - %>
<%= ff.input :slug, as: :string, input_html: { class: "form-item--input" } %>
<%# - - - - - - - - - - - - %>
<%# FIELD TYPE %>
<%# - - - - - - - - - - - - %>
<% if ff.object.field_type.nil? %>
<%= ff.input :field_type, as: :select, collection: get_field_types, include_blank: false, prompt: t(:select_field_type), input_html: { class: 'form-item--select-input' } %>
<% else %>
<%= ff.input :field_type, as: :string, disabled: true, input_html: { class: "form-item--input" } %>
<% end %>
<%# - - - - - - - - - - - - %>
<%# DESCRIPTION %>
<%# - - - - - - - - - - - - %>
<%= ff.input :description, input_html: { class: "form-item--input" } %>
<%# - - - - - - - - - - - - %>
<%# POSITION %>
<%# - - - - - - - - - - - - %>
<%= ff.input :position, as: :integer, input_html: { class: "form-item--input" } %>
<%# - - - - - - - - - - - - %>
<%# ACCEPTED STRUCTURES %>
<%# - - - - - - - - - - - - %>
<% if ff.object.field_type == 'relation' %>
<%= ff.input :accepted_structure_ids,
collection: Binda::Structure.all,
as: :select,
input_html: { multiple: true, class: 'select2-item' },
checked: ff.object.accepted_structures,
include_blank: false,
include_hidden: false %>
<% end %>
<% choiceables = ['radio', 'selection', 'checkbox'] %>
<% if choiceables.include? ff.object.field_type %>
<%# - - - - - - - - - - - - %>
<%# CHOICES %>
<%# - - - - - - - - - - - - %>
<%= render 'form_item_choice', f: f, ff: ff %>
<% end %>
<% end %>