mirror of
https://github.com/indentlabs/notebook.git
synced 2025-10-26 11:19:22 +00:00
90 lines
3.0 KiB
Plaintext
90 lines
3.0 KiB
Plaintext
<%
|
|
raw_model = content.is_a?(ContentSerializer) ? content.raw_model : content
|
|
%>
|
|
|
|
<div id="<%= category[:name].gsub("'", '') %>_panel" class="panel card" style="display: none">
|
|
<div class="<%= raw_model.class.text_color %> text-darken-1 section-title sticky-below-navbar <%= raw_model.class.color %> lighten-5">
|
|
<i class="material-icons right"><%= category[:icon] %></i>
|
|
<%= category[:label] %>
|
|
</div>
|
|
|
|
<div class="card-content">
|
|
<% 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 %>
|
|
|
|
<div class="panel-field">
|
|
<% 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 %>
|
|
|
|
</div>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|