|
| 1 | +<%%= form_with(model: <%= model_resource_name %>, class: "contents") do |form| %> |
| 2 | + <%% if <%= singular_table_name %>.errors.any? %> |
| 3 | + <div id="error_explanation" class="bg-red-50 text-red-500 px-3 py-2 font-medium rounded-lg mt-3"> |
| 4 | + <h2><%%= pluralize(<%= singular_table_name %>.errors.count, "error") %> prohibited this <%= singular_table_name %> from being saved:</h2> |
| 5 | + |
| 6 | + <ul> |
| 7 | + <%% <%= singular_table_name %>.errors.each do |error| %> |
| 8 | + <li><%%= error.full_message %></li> |
| 9 | + <%% end %> |
| 10 | + </ul> |
| 11 | + </div> |
| 12 | + <%% end %> |
| 13 | + |
| 14 | +<% attributes.each do |attribute| -%> |
| 15 | + <div class="my-5"> |
| 16 | +<% if attribute.password_digest? -%> |
| 17 | + <%%= form.label :password %> |
| 18 | + <%%= form.password_field :password %> |
| 19 | +</div> |
| 20 | + |
| 21 | +<div class="my-5"> |
| 22 | + <%%= form.label :password_confirmation %> |
| 23 | + <%%= form.password_field :password_confirmation, class: "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-full" %> |
| 24 | +<% elsif attribute.attachments? -%> |
| 25 | + <%%= form.label :<%= attribute.column_name %> %> |
| 26 | + <%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, multiple: true, class: "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-full" %> |
| 27 | +<% else -%> |
| 28 | + <%%= form.label :<%= attribute.column_name %> %> |
| 29 | +<% if attribute.field_type == :text_area -%> |
| 30 | + <%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, rows: 4, class: "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-full" %> |
| 31 | +<% elsif attribute.field_type == :check_box -%> |
| 32 | + <%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, class: "block mt-2 h-5 w-5" %> |
| 33 | +<% else -%> |
| 34 | + <%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, class: "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-full" %> |
| 35 | +<% end -%> |
| 36 | +<% end -%> |
| 37 | + </div> |
| 38 | + |
| 39 | +<% end -%> |
| 40 | + <div class="inline"> |
| 41 | + <%%= form.submit class: "rounded-lg py-3 px-5 bg-blue-600 text-white inline-block font-medium" %> |
| 42 | + </div> |
| 43 | +<%% end %> |
0 commit comments