<%- @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-large input-with-feedback'<%- if (index == 0) -%>, :autofocus => true<%- end -%>

    span class='help-inline' = error ? f.error_message_on(:<%= column[:name] %>, :class => 'text-error') : pat(:example)
<%- 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'