<% @orm.column_fields.each_with_index do |column, index| -%>
<%% error = <%= @orm.has_error(column[:name]) %> %>
<fieldset class='control-group <%%= error ? 'has-error' : ''%>'>
  <%%= f.label :<%= column[:name] %>, :class => 'control-label' %>
  <div class='controls'>
    <%%= f.<%= column[:field_type] %> :<%= column[:name] %>, :class => 'form-control input-xlarge input-with-feedback'<%- if (index == 0) -%>, :autofocus => true<%- end -%> %>
    <span class='help-inline'><%%= error ? f.error_message_on(:<%= column[:name] %>) : "Ex: a simple text" %></span>
  </div>
</fieldset>
<% end %>

<div class="form-actions">
  <%%= f.submit pat(:save), :class => 'btn btn-primary' %>
  &nbsp;
  <%%= f.submit pat(:save_and_continue), :class => 'btn btn-info', :name => 'save_and_continue' %>
  &nbsp;
  <%%= link_to pat(:cancel), url(:<%= @orm.name_plural %>, :index), :class => 'btn btn-default' %>
</div>