Sha256: 779631346ae96c35cac43b094b3c1a7064a537f3d89a25272ab0d42e7810a570

Contents?: true

Size: 1.61 KB

Versions: 8

Compression:

Stored size: 1.61 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>
<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

8 entries across 8 versions & 1 rubygems

Version Path
active_scaffold-3.6.0.rc1 app/views/active_scaffold_overrides/_form_association.html.erb
active_scaffold-3.5.5 app/views/active_scaffold_overrides/_form_association.html.erb
active_scaffold-3.6.0.pre app/views/active_scaffold_overrides/_form_association.html.erb
active_scaffold-3.5.4 app/views/active_scaffold_overrides/_form_association.html.erb
active_scaffold-3.5.3 app/views/active_scaffold_overrides/_form_association.html.erb
active_scaffold-3.5.2 app/views/active_scaffold_overrides/_form_association.html.erb
active_scaffold-3.5.1 app/views/active_scaffold_overrides/_form_association.html.erb
active_scaffold-3.5.0 app/views/active_scaffold_overrides/_form_association.html.erb