<%%= error_summary @<%= singular_table_name %> %>
<%%= @<%= singular_table_name %>.new_record? ? 'New' : 'Update' %> <%= singular_table_name.titleize %>
<%%= form_for(@<%= singular_table_name %>) do |f| %> <%- attributes.each do |attribute| -%> <%- if attribute.type == :boolean -%> <%%= f.check_box_form_group :<%= attribute.column_name %> %> <%- elsif attribute.type == :date || (attribute.type == :datetime && attribute.column_name =~ /date/ && !(attribute.column_name =~ /time/)) -%> <%%= f.datepicker_form_group :<%= attribute.column_name %> %> <%- elsif (attribute.type == :references) || (attribute.type == :integer && attribute.column_name =~ /_id\z/) -%> <%- if (ref_class = (attribute.column_name.gsub(/_id\z/,'').classify.constantize rescue nil)) -%> <%%= f.select_form_group :<%= attribute.column_name %>, <%= ref_class %>.all, :id, :to_s, label_text: <%= attribute.column_name.gsub(/_id\z/,'').humanize.inspect %>, field_class: 'form-control select2' %> <%- else -%> <%%= f.text_form_group :<%= attribute.column_name %>, field_type: :number, field_class: "form-control integer", label_text: <%= attribute.column_name.gsub(/_id\z/, '').humanize.inspect %> %> <%- end -%> <%- elsif attribute.type == :integer -%> <%%= f.text_form_group :<%= attribute.column_name %>, field_type: :number, field_class: "form-control integer" %> <%- elsif attribute.type == :float -%> <%%= f.text_form_group :<%= attribute.column_name %>, field_type: :number, field_class: "form-control float" %> <%- elsif attribute.type == :string -%> <%%= f.text_form_group :<%= attribute.column_name %> %> <%- elsif attribute.password_digest? -%> <%%= f.text_form_group :password, field_type: :password %> <%%= f.text_form_group :password_confirmation, field_type: :password %> <%- else -%>
<%%= f.label :<%= attribute.column_name %> %> <%%= f.<%= attribute.field_type %> :<%= attribute.column_name %>, class: "form-control" %>
<%- end -%> <%- end -%> <%%= f.submit class: "btn btn-primary" %> <%%= link_to "Cancel", @<%= singular_table_name %>.new_record? ? <%= index_helper %>_path : <%= singular_table_name %>_path(@<%= singular_table_name %>), class: "btn btn-default" %> <%% end %>