|
1 | | -<div class="col-md-12"> |
2 | | - <div class="row"> |
3 | | - <div class="col-md-9 col-lg-8 width"> |
4 | | - <div class="entry-content"> |
5 | | - <h2 class="normal"><%%= <%= plural_table_name.classify %>.model_name.human.pluralize %></h2> |
6 | | - </div> |
| 1 | +<div class="w-full px-4"> |
| 2 | + <!-- Header --> |
| 3 | + <div class="flex items-center justify-between mb-6"> |
| 4 | + <div> |
| 5 | + <h2 class="text-2xl font-semibold text-gray-900"><%%= <%= plural_table_name.classify %>.model_name.human.pluralize %></h2> |
7 | 6 | </div> |
8 | | - <div class="col-md-3 col-lg-4 width"> |
9 | | - <div class="entry-content"> |
10 | | - <%%= link_to 'New ' + <%= singular_table_name.classify %>.model_name.human, new_<%= singular_table_name %>_path, class: "btn btn-outline-primary" %> |
11 | | - </div> |
| 7 | + <div> |
| 8 | + <%%= link_to_button('New ' + <%= singular_table_name.classify %>.model_name.human.downcase, |
| 9 | + new_<%= singular_table_name %>_path, |
| 10 | + variant: :primary_outline) %> |
12 | 11 | </div> |
13 | 12 | </div> |
14 | | -</div> |
15 | | - |
16 | | -<div class="col-md-12"> |
17 | | - <table class="table table-striped table-bordered table-responsive"> |
18 | | - <thead> |
19 | | - <tr> |
20 | | - <%% attributes = @<%= plural_table_name %>.first.attributes.keys if @<%= plural_table_name %>.any? %> |
21 | | - <%% attributes&.each do |attribute| %> |
22 | | - <th><%%= attribute.humanize %></th> |
23 | | - <%% end %> |
24 | | - <th>Edit</th> |
25 | | - </tr> |
26 | | - </thead> |
| 13 | + <div class="border-b border-gray-300 mb-6"></div> |
27 | 14 |
|
28 | | - <tbody> |
29 | | - <%% @<%= plural_table_name %>.each do |<%= singular_table_name %>| %> |
| 15 | + <!-- Table --> |
| 16 | + <div class="overflow-x-auto"> |
| 17 | + <table class="min-w-full table-auto border-collapse border border-gray-200"> |
| 18 | + <thead class="bg-gray-100"> |
| 19 | + <%% if @<%= plural_table_name %>.any? %> |
30 | 20 | <tr> |
31 | | - <%% attributes.each do |attribute| %> |
32 | | - <td><%%= <%= singular_table_name %>[attribute] %></td> |
| 21 | + <%% attributes = @<%= plural_table_name %>.first.attributes.keys - ["id", "created_at", "updated_at"] if @<%= plural_table_name %>.any? %> |
| 22 | + <%% attributes&.each do |attribute| %> |
| 23 | + <th class="px-4 py-2 text-left text-sm font-semibold text-gray-700"><%%= attribute.humanize %></th> |
33 | 24 | <%% end %> |
34 | | - <td><%%= link_to 'Edit', edit_<%= singular_table_name %>_path(<%= singular_table_name %>) %></td> |
| 25 | + <th class="px-4 py-2 text-left text-sm font-semibold text-gray-700">Edit</th> |
35 | 26 | </tr> |
36 | | - <%% end %> |
37 | | - </tbody> |
38 | | - </table> |
| 27 | + <%% end %> |
| 28 | + </thead> |
| 29 | + |
| 30 | + <tbody class="divide-y divide-gray-200"> |
| 31 | + <%% @<%= plural_table_name %>.each do |<%= singular_table_name %>| %> |
| 32 | + <tr class="hover:bg-gray-50 transition-colors duration-150"> |
| 33 | + <%% attributes.each do |attribute| %> |
| 34 | + <td class="px-4 py-2 text-sm text-gray-800"> |
| 35 | + <%%= <%= singular_table_name %>[attribute] %> |
| 36 | + </td> |
| 37 | + <%% end %> |
| 38 | + <td class="px-4 py-2 flex gap-2"> |
| 39 | + <%%= link_to_button 'Edit', edit_<%= singular_table_name %>_path(<%= singular_table_name %>), |
| 40 | + variant: :secondary_outline %> |
| 41 | + </td> |
| 42 | + </tr> |
| 43 | + <%% end %> |
| 44 | + </tbody> |
| 45 | + </table> |
| 46 | + </div> |
| 47 | + |
| 48 | + <!-- Empty state --> |
| 49 | + <%% unless @<%= plural_table_name %>.any? %> |
| 50 | + <p class="text-gray-500 text-center py-6">No <%%= <%= plural_table_name.classify %>.model_name.human.pluralize %> found.</p> |
| 51 | + <%% end %> |
39 | 52 |
|
40 | | - <div class="text-center"> |
41 | | - <%<%= will_paginate @<%= plural_table_name %>, :previous_label => '<<', :next_label => '>>', :inner_window => 2 %> |
| 53 | + <!-- Pagination --> |
| 54 | + <div class="flex justify-center mt-6"> |
| 55 | + <%%= will_paginate @<%= plural_table_name %>, previous_label: '<<', next_label: '>>', |
| 56 | + class: 'flex space-x-2' %> |
42 | 57 | </div> |
43 | 58 | </div> |
0 commit comments