mirror of
https://github.com/indentlabs/notebook.git
synced 2025-10-26 11:19:22 +00:00
30 lines
1.1 KiB
Plaintext
30 lines
1.1 KiB
Plaintext
<%# Usage: render 'content/form/relation_input', f: f, attribute: attribute, relation: through_class %>
|
|
<div class="content-field">
|
|
<div class="hoverable" style="padding: 8px; margin-bottom: 1rem;">
|
|
<div>
|
|
<%= f.label attribute, I18n.translate(
|
|
"attributes.#{f.object.class.name.downcase}.#{attribute}",
|
|
scope: :activerecord,
|
|
default: label.humanize.capitalize
|
|
) %>
|
|
</div>
|
|
|
|
<div id="<%= relation %>">
|
|
<%= f.fields_for relation do |builder| %>
|
|
<%= render 'content/form/groupship_fields', f: builder, attribute: attribute.singularize, parent: f.object %>
|
|
<% end %>
|
|
<div class="links">
|
|
<% model_class = f.object.send(attribute).build.class %>
|
|
<% color = model_class.color %>
|
|
<%= link_to_add_association "link #{model_class.name.downcase}", f, relation,
|
|
class: "btn #{color}",
|
|
partial: 'content/form/groupship_fields',
|
|
render_options: { locals: {
|
|
attribute: attribute.singularize,
|
|
parent: f.object
|
|
}} %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|