|
2 | 2 |
|
3 | 3 | <div class="w-full">
|
4 | 4 | <%% if notice.present? %>
|
5 |
| - <p class="inline-block px-3 py-2 mb-5 font-medium text-green-500 rounded-md bg-green-50" id="notice"><%%= notice %></p> |
| 5 | + <p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-md inline-block" id="notice"><%%= notice %></p> |
6 | 6 | <%% end %>
|
7 | 7 |
|
8 |
| - <div class="flex items-center justify-between"> |
9 |
| - <h1 class="text-4xl font-bold"><%= human_name.pluralize %></h1> |
| 8 | + <div class="flex justify-between items-center"> |
| 9 | + <h1 class="font-bold text-4xl"><%= human_name.pluralize %></h1> |
10 | 10 | <%%= link_to "New <%= human_name.downcase %>", new_<%= singular_route_name %>_path, class: "rounded-md px-3.5 py-2.5 bg-blue-600 hover:bg-blue-500 text-white block font-medium" %>
|
11 | 11 | </div>
|
12 | 12 |
|
|
22 | 22 | </tr>
|
23 | 23 | </thead>
|
24 | 24 | <tbody class="divide-y divide-gray-200">
|
25 |
| - <%% @users.each do |user| %> |
| 25 | + <%% @<%= plural_table_name %>.each do |<%= singular_name %>| %> |
26 | 26 | <tr class="border-b">
|
27 | 27 | <% attributes.reject(&:password_digest?).each do |attribute| -%>
|
| 28 | +<% if attribute.attachment? -%> |
| 29 | + <td class="py-4 whitespace-nowrap"><%%= link_to <%= singular_name %>.<%= attribute.column_name %>.filename, <%= singular_name %>.<%= attribute.column_name %> if <%= singular_name %>.<%= attribute.column_name %>.attached? %></td> |
| 30 | +<% elsif attribute.attachments? -%> |
| 31 | + <td class="py-4 whitespace-nowrap"> |
| 32 | + <%% <%= singular_name %>.<%= attribute.column_name %>.each do |<%= attribute.singular_name %>| %> |
| 33 | + <div><%%= link_to <%= attribute.singular_name %>.filename, <%= attribute.singular_name %> %></div> |
| 34 | + <%% end %> |
| 35 | + </td> |
| 36 | +<% else -%> |
28 | 37 | <td class="py-4 whitespace-nowrap"><%%= <%= singular_name %>.<%= attribute.column_name %> %></td>
|
| 38 | +<% end -%> |
29 | 39 | <% end -%>
|
30 | 40 | <td class="py-4 space-x-4 whitespace-nowrap">
|
31 | 41 | <%%= link_to "Show", <%= model_resource_name(singular_table_name) %>, class: "text-blue-600 hover:text-blue-900" %>
|
| 42 | + <%%= link_to "Edit", edit_<%= singular_route_name %>_path(<%= singular_table_name %>), class: "text-blue-600 hover:text-blue-900" %> |
| 43 | + <div class="inline-block ml-2"> |
| 44 | + <%%= button_to "Destroy", <%= model_resource_name %>, method: :delete, class: "text-red-600 hover:text-red-900" %> |
| 45 | + </div> |
32 | 46 | </td>
|
33 | 47 | </tr>
|
34 | 48 | <%% end %>
|
35 | 49 | </tbody>
|
36 | 50 | </table>
|
37 | 51 | <%% else %>
|
38 |
| - <p class="my-10 text-center">No <%= human_name.downcase.pluralize %> found.</p> |
| 52 | + <p class="text-center my-10">No <%= human_name.downcase.pluralize %> found.</p> |
39 | 53 | <%% end %>
|
40 | 54 | </div>
|
41 | 55 | </div>
|
0 commit comments