<% if category[:name] == 'gallery' %>
<%= form_for raw_model do |f| %>
<%= render partial: 'content/form/gallery/panel', locals: { f: f, content: content } %>
<% end %>
<% end %>
<% if category[:name] == 'contributors' %>
<%= form_for raw_model do |f| %>
<%= render partial: 'content/form/contributors', locals: { f: f, content: content } %>
<% end %>
<% end %>
<% category[:fields].each do |field| %>
<% next if !!field[:hidden] %>
<%= form_for @content, url: FieldTypeService.form_path(field), remote: true do |f| %>
<%= hidden_field_tag "entity[entity_id]", raw_model.id %>
<%= hidden_field_tag "entity[entity_type]", raw_model.class.name %>
<% if field[:type] == 'link' %>
<%=
# migration phases: 1) /legacy_link, 2) /migration_link, 3) /link
render partial: 'content/form/field_types/migration_link', locals: {
f: f,
attribute: field[:old_column_source] || field[:label],
field: field,
page: @content,
label: field[:label],
relation: field.fetch(:old_column_source, false) ? raw_model.class.reflect_on_association(field[:old_column_source]).options[:through].to_s
: nil
}
%>
<% elsif field[:type] == 'tags' %>
<%=
render partial: 'content/form/field_types/tags', locals: {
f: f,
page: @content,
field: field
}
%>
<% elsif field[:type] == 'universe' %>
<%=
render partial: 'content/form/field_types/universe', locals: {
f: f,
field: field,
page: @content,
raw_model: raw_model
}
%>
<% elsif field[:type] == 'name' %>
<%=
render partial: 'content/form/field_types/name', locals: {
f: f,
page: @content,
field: field
}
%>
<% else %>
<%=
render partial: 'content/form/field_types/text', locals: {
f: f,
content: @content,
raw_model: raw_model,
field: field,
}
%>
<% end %>
<% end %>
<% end %>