|
@@ -1,4 +1,4 @@
|
|
-<%%= form_with(model: <%= model_resource_name %>, local: true) do |form| %>
|
|
|
|
|
|
+<%%= simple_form_for(@<%= singular_table_name %>) do |f| %>
|
|
<%% if <%= singular_table_name %>.errors.any? %>
|
|
<%% if <%= singular_table_name %>.errors.any? %>
|
|
<div id="error_explanation">
|
|
<div id="error_explanation">
|
|
<h2><%%= pluralize(<%= singular_table_name %>.errors.count, "error") %> prohibited this <%= singular_table_name %> from being saved:</h2>
|
|
<h2><%%= pluralize(<%= singular_table_name %>.errors.count, "error") %> prohibited this <%= singular_table_name %> from being saved:</h2>
|
|
@@ -11,31 +11,26 @@
|
|
</div>
|
|
</div>
|
|
<%% end %>
|
|
<%% end %>
|
|
|
|
|
|
-<% attributes.each do |attribute| -%>
|
|
|
|
- <div class="form-group">
|
|
|
|
-<% if attribute.password_digest? -%>
|
|
|
|
- <%%= form.label :password %>
|
|
|
|
- <%%= form.password_field :password, class: 'form-control' %>
|
|
|
|
- </div>
|
|
|
|
|
|
|
|
- <div class="form-group">
|
|
|
|
- <%%= form.label :password_confirmation %>
|
|
|
|
- <%%= form.password_field :password_confirmation, class: 'form-control' %>
|
|
|
|
|
|
+ <div class="form-inputs">
|
|
|
|
+ <% attributes.each do |attribute| -%>
|
|
|
|
+<% if attribute.password_digest? -%>
|
|
|
|
+ <%%= f.input :password %>
|
|
|
|
+ <%%= f.input :password_confirmation %>
|
|
<% else -%>
|
|
<% else -%>
|
|
- <%%= form.label :<%= attribute.column_name %> %>
|
|
|
|
- <%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, class: 'form-control' %>
|
|
|
|
|
|
+ <%%= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> %>
|
|
<% end -%>
|
|
<% end -%>
|
|
|
|
+ <% end -%>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
-<% end -%>
|
|
|
|
- <div class="form-group">
|
|
|
|
|
|
+ <div class="form-actions">
|
|
<%% if <%= model_resource_name %>.persisted? %>
|
|
<%% if <%= model_resource_name %>.persisted? %>
|
|
<div class="float-right">
|
|
<div class="float-right">
|
|
<%%= link_to 'Destroy', <%= model_resource_name %>, method: :delete, class: "text-danger", data: { confirm: 'Are you sure?' } %>
|
|
<%%= link_to 'Destroy', <%= model_resource_name %>, method: :delete, class: "text-danger", data: { confirm: 'Are you sure?' } %>
|
|
</div>
|
|
</div>
|
|
<%% end %>
|
|
<%% end %>
|
|
|
|
|
|
- <%%= form.submit class: 'btn btn-primary' %>
|
|
|
|
|
|
+ <%%= f.submit class: 'btn btn-primary' %>
|
|
|
|
|
|
<%% if <%= model_resource_name %>.persisted? %>
|
|
<%% if <%= model_resource_name %>.persisted? %>
|
|
<%%= link_to "Cancel", <%= model_resource_name %>, class: "btn btn-link" %>
|
|
<%%= link_to "Cancel", <%= model_resource_name %>, class: "btn btn-link" %>
|