mirror of
https://github.com/astuto/astuto.git
synced 2025-12-16 03:37:56 +01:00
46 lines
1.3 KiB
Plaintext
46 lines
1.3 KiB
Plaintext
<%#
|
|
# Form Partial
|
|
|
|
This partial is rendered on a resource's `new` and `edit` pages,
|
|
and renders all form fields for a resource's editable attributes.
|
|
|
|
## Local variables:
|
|
|
|
- `page`:
|
|
An instance of [Administrate::Page::Form][1].
|
|
Contains helper methods to display a form,
|
|
and knows which attributes should be displayed in the resource's form.
|
|
|
|
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Page/Form
|
|
%>
|
|
|
|
<%= form_for([namespace, page.resource], html: { class: "form" }) do |f| %>
|
|
<% if page.resource.errors.any? %>
|
|
<div id="error_explanation">
|
|
<h2 style="text-align: center;">
|
|
<%= t(
|
|
"administrate.form.errors",
|
|
pluralized_errors: pluralize(page.resource.errors.count, t("administrate.form.error")),
|
|
resource_name: display_resource_name(page.resource_name)
|
|
) %>
|
|
</h2>
|
|
|
|
<ul>
|
|
<% page.resource.errors.full_messages.each do |message| %>
|
|
<li class="flash-error"><%= message %></li>
|
|
<% end %>
|
|
</ul>
|
|
</div>
|
|
<% end %>
|
|
|
|
<% page.attributes.each do |attribute| -%>
|
|
<div class="field-unit field-unit--<%= attribute.html_class %>">
|
|
<%= render_field attribute, f: f %>
|
|
</div>
|
|
<% end -%>
|
|
|
|
<div class="form-actions">
|
|
<%= f.submit %>
|
|
</div>
|
|
<% end %>
|