<%= form_for @changeset, @action, fn f -> %>
  <%= if @changeset.action do %>
    <div class="alert alert-danger">
      <p>Oops, something went wrong! Please check the errors below.</p>
    </div>
  <% end %>

  <%= for {id, column} <- @columns do %>
    <%= unless id == :id || id == :sort_order ||
               id == :inserted_at || id == :updated_at do %>
      <div class="form-group">
        <%= label f, id, class: "control-label" %>
        <%= case column.type do
              :boolean -> checkbox f, id, class: "form-control"
              :integer -> number_input f, id, class: "form-control"
              :datetime -> datetime_select f, id, class: "form-control"
              _ -> text_input f, id, class: "form-control"
            end
        %>
        <%= error_tag f, id %>
      </div>
    <% end %>
  <% end %>

  <div class="form-group">
    <%= submit "Submit", class: "btn btn-primary" %>
  </div>
<% end %>
