<%
  form_name_prefix ||= 'project'
  values_from_params ||= {}
  uniq_id = project.id.to_s
%>

<% if custom_field_values.blank? -%>
  <%= hidden_field_tag "#{form_name_prefix}[project_custom_field_ids][]", '' -%>
<% else -%>
  <% custom_field_values.each do |value| -%>
    <% value.value = values_from_params[value.custom_field_id.to_s] if values_from_params[value.custom_field_id.to_s] %>
    <p class="<%= value.custom_field.name.tr(' ', '_').underscore.dasherize -%>">
      <% if value.custom_field.is_a?(EasyProjectTemplateCustomField) %>
        <%= custom_field_tag_with_label('project', value) -%>
      <% else %>
        <%= custom_field_tag_with_label(form_name_prefix, value, {:uniq_id => uniq_id}, {:uniq_id => uniq_id}) -%>
        <%= hidden_field_tag "#{form_name_prefix}[project_custom_field_ids][]", value.custom_field_id -%>
      <% end %>
    </p>
  <% end -%>
<% end -%>
<%= call_hook(:view_projects_form_custom_fields, :custom_field_values => custom_field_values, :form_name_prefix => form_name_prefix, :project => project ) %>
