Sha256: e574d66bfb45725636e0f4d183ecbce379f7d41eed6c42b4283fbbf1e9e5b04d

Contents?: true

Size: 1.7 KB

Versions: 12

Compression:

Stored size: 1.7 KB

Contents

<%
associated = column.association.singular? ? [parent_record.send(column.name)].compact : parent_record.send(column.name).to_a
if column.show_blank_record?(associated)
  show_blank_record = build_associated(column.association, parent_record)
end
disable_required_for_new = @disable_required_for_new
@disable_required_for_new = !!show_blank_record unless (column.association.singular? && column.required?)
subform_div_id = "#{sub_form_id(:association => column.name, :id => parent_record.id || generated_id(parent_record) || 99999999999)}-div"

# render footer before rendering associated records, fixes create new on self-associations
# so generated_id for blank associated record is not used in create new button
footer = render(:partial => 'form_association_footer', :locals => {:parent_record => parent_record, :column => column, :associated => associated, :scope => scope})
-%>
<h5>
  <%= column.label -%>
  <%= link_to_visibility_toggle(subform_div_id, default_visible: !column.collapsed) -%>
</h5>
<%= content_tag :span, column.description, class: 'description' if column.description.present? %>
<div id ="<%= subform_div_id %>" <%= 'style="display: none;"'.html_safe if column.collapsed -%>>
<%# HACK: to be able to delete all associated records %>
  <%= hidden_field_tag "#{(opts = active_scaffold_input_options(column, scope, :object => parent_record))[:name]}[0]", '', :id => "#{opts[:id]}_0" if column.association.collection? %>
  <%= render :partial => subform_partial_for_column(column), :locals => {:column => column, :parent_record => parent_record, :associated => associated, :show_blank_record => show_blank_record, :scope => scope} %>
  <%= footer -%>
</div>
<%
  @disable_required_for_new = disable_required_for_new
-%>

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
active_scaffold-3.6.10 app/views/active_scaffold_overrides/_form_association.html.erb
active_scaffold-3.6.9 app/views/active_scaffold_overrides/_form_association.html.erb
active_scaffold-3.6.8 app/views/active_scaffold_overrides/_form_association.html.erb
active_scaffold-3.6.6 app/views/active_scaffold_overrides/_form_association.html.erb
active_scaffold-3.6.5 app/views/active_scaffold_overrides/_form_association.html.erb
active_scaffold-3.6.4.1 app/views/active_scaffold_overrides/_form_association.html.erb
active_scaffold-3.6.4 app/views/active_scaffold_overrides/_form_association.html.erb
active_scaffold-3.6.3 app/views/active_scaffold_overrides/_form_association.html.erb
active_scaffold-3.6.2 app/views/active_scaffold_overrides/_form_association.html.erb
active_scaffold-3.6.1 app/views/active_scaffold_overrides/_form_association.html.erb
active_scaffold-3.6.0 app/views/active_scaffold_overrides/_form_association.html.erb
active_scaffold-3.6.0.rc2 app/views/active_scaffold_overrides/_form_association.html.erb