Sha256: 7f961ca794b100778e118af0a5e8705f23c9a92cc00428583f46c88209f3c787

Contents?: true

Size: 1.93 KB

Versions: 29

Compression:

Stored size: 1.93 KB

Contents

<%
ActiveSupport::Deprecation.warn "Relying on @record to render form_asssociation partial with no parent_record local variable is deprecated", caller(1) unless local_assigns[:parent_record]
parent_record ||= @record # TODO: remove when changing @record is removed, save @record, some partial can change @record
associated = column.singular_association? ? [parent_record.send(column.name)].compact : parent_record.send(column.name).to_a
#associated = associated.sort_by {|r| r.new_record? ? 99999999999 : r.id} unless column.association.options.has_key?(:order)
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.singular_association? && column.required?)
subform_div_id = "#{sub_form_id(:association => column.name, :id => parent_record.id || generated_id(parent_record) || 99999999999)}-div" 
-%>
<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 "#{active_scaffold_input_options(column, scope, :object => parent_record)[:name]}[0]", '' if column.plural_association? %>
  <%= render :partial => subform_partial_for_column(column), :locals => {:column => column, :parent_record => parent_record, :associated => associated, :show_blank_record => show_blank_record, :scope => scope} %>
  <%= render :partial => 'form_association_footer', :locals => {:parent_record => parent_record, :column => column, :associated => associated, :scope => scope} -%>
</div>
<%
  @record = parent_record # TODO: remove when changing @record is removed, restore @record, some partials can change it
  @disable_required_for_new = disable_required_for_new
-%>

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
active_scaffold-3.4.43 app/views/active_scaffold_overrides/_form_association.html.erb
active_scaffold-3.4.42 app/views/active_scaffold_overrides/_form_association.html.erb
active_scaffold-3.4.41.1 app/views/active_scaffold_overrides/_form_association.html.erb
active_scaffold-3.4.41 app/views/active_scaffold_overrides/_form_association.html.erb
active_scaffold-3.4.40 app/views/active_scaffold_overrides/_form_association.html.erb
active_scaffold-3.4.39 app/views/active_scaffold_overrides/_form_association.html.erb
active_scaffold-3.4.38 app/views/active_scaffold_overrides/_form_association.html.erb
active_scaffold-3.4.37 app/views/active_scaffold_overrides/_form_association.html.erb
active_scaffold-3.4.36 app/views/active_scaffold_overrides/_form_association.html.erb
active_scaffold-3.4.35 app/views/active_scaffold_overrides/_form_association.html.erb
active_scaffold-3.4.34 app/views/active_scaffold_overrides/_form_association.html.erb
active_scaffold-3.4.33 app/views/active_scaffold_overrides/_form_association.html.erb
active_scaffold-3.4.32 app/views/active_scaffold_overrides/_form_association.html.erb
active_scaffold-3.4.31 app/views/active_scaffold_overrides/_form_association.html.erb
active_scaffold-3.4.30 app/views/active_scaffold_overrides/_form_association.html.erb
active_scaffold-3.4.29 app/views/active_scaffold_overrides/_form_association.html.erb
active_scaffold-3.4.28 app/views/active_scaffold_overrides/_form_association.html.erb
active_scaffold-3.4.27 app/views/active_scaffold_overrides/_form_association.html.erb
active_scaffold-3.4.26 app/views/active_scaffold_overrides/_form_association.html.erb
active_scaffold-3.4.25 app/views/active_scaffold_overrides/_form_association.html.erb