%
scope ||= nil
subsection_id ||= nil
show_unauthorized_columns = active_scaffold_config.send(form_action).show_unauthorized_columns if active_scaffold_config.actions.include? form_action
%>
<%= "style=\"display: none;\"".html_safe if columns.collapsed %>>
<% columns.each :for => @record, :crud_type => (:read if show_unauthorized_columns) do |column| %>
<% column_css_class = column.css_class unless column.css_class.nil? || column.css_class.is_a?(Proc) %>
<% renders_as = column_renders_as(column) %>
<% authorized = show_unauthorized_columns || renders_as == :subsection ? @record.authorized_for?(:crud_type => form_action, :column => column.name) : true %>
<% if renders_as == :subsection -%>
<% if authorized %>
<% subsection_id = sub_section_id(:sub_section => column.label) %>
-
<%= column.label %>
<%= render :partial => 'form', :locals => { :columns => column, :subsection_id => subsection_id, :form_action => form_action, :scope => scope } %>
<%= link_to_visibility_toggle(subsection_id, {:default_visible => !column.collapsed}) -%>
<% end %>
<% elsif renders_as == :subform and authorized -%>
<%= content_tag :li, active_scaffold_subform_attributes(column, column_css_class) do %>
<%= render_column(column, @record, renders_as, scope) %>
<% end %>
<% else -%>
-
<%= render_column(column, @record, renders_as, scope, !authorized) %>
<% end -%>
<% end -%>