%%= fields_for :<%= model_name_underscored %>, <%= model_name_underscored %> do |f| %> <%- if project? -%> <%% if <%= model_name_underscored %>.safe_attribute?('project_id') && !@project %>
<%%= f.label :project_id, ::<%= model_name %>.human_attribute_name(:project_id) %> <%%= f.select :project_id, Project.allowed_to(:manage_<%= model_name_pluralize_underscored %>).collect{|x| [x.name, x.id]}, include_blank: true %>
<%% end %> <%- end -%> <%- safe_columns.each do |column_name, column_options| -%> <%% if <%= model_name_underscored %>.safe_attribute?('<%= column_name %>') %><%%= f.label :<%= column_name %>, ::<%= model_name %>.human_attribute_name(:<%= column_name %>) %> <%- if column_options[:query_type] == 'string' || column_options[:query_type] == 'integer' -%> <%%= f.text_field :<%= column_name %> %> <%- elsif column_options[:query_type] == 'list' || column_options[:query_type] == 'list_optional' -%> <%%= f.select :<%= column_name %>, <%= column_options[:class] %>.all.collect{|x| [x.<%= column_options[:list_class_name] %>, x.id]}.sort, include_blank: true %> <%- elsif column_options[:query_type] == 'text' -%> <%%= f.text_area :<%= column_name %>, :cols => 60, :rows => (<%= model_name_underscored %>.<%= column_name %>.blank? ? 10 : [[10, <%= model_name_underscored %>.<%= column_name %>.length / 50].max, 100].min), :accesskey => accesskey(:edit), :class => 'wiki-edit' %> <%%= wikitoolbar_for '<%= model_name_underscored %>_<%= column_name %>' %> <%- elsif column_options[:query_type] == 'boolean' -%> <%%= f.radio_button :<%= column_name %>, false %> <%- else -%> <%%= f.text_field :<%= column_name %> %> <%- end -%>
<%% end %> <%- end -%> <%- if acts_as_customizable? -%> <%% custom_field_values = <%= model_name_underscored %>.visible_custom_field_values %> <%% custom_field_values.each do |value| %><%%= custom_field_tag_with_label :<%= model_name_underscored %>, value %>
<%% end %> <%- end -%> <%- if acts_as_attachable? -%><%%= render :partial => 'attachments/form', :locals => {:container => <%= model_name_underscored %>} %>
<%- end -%> <%% end %>