<div class="alert alert-danger" role="alert">
  <strong>Admin Interface</strong>
</div>

<ol class="breadcrumb">
  <li><a href="/admin">Admin</a></li>
  <li><a href=".."><%= current_model_name.capitalize %></a></li>
  <li class="active"><%= params[:id] %></li>
</ol>

<form method="POST">
  <% fields.each do |f| %>
    <%
    if select_fields.include?(f)
      template = :"admin/select_field"
    else
      template = "admin/#{object.class.columns_hash[f.to_s]&.type || :string}_field".to_sym
    end
    %>
    <%== erb(template, locals: {name: f, value: object.send(f), disabled: read_only_fields.include?(f)}) %>
  <% end %>
  <% if fields != read_only_fields %>
    <input type="submit" class="btn btn-primary" value="Save"/>
  <% end %>
    <a href=".." class="btn btn-default">Go back</a>
</form>
