|
| 1 | +<div class="min-h-screen"> |
| 2 | + <div class="max-w-full mx-auto px-4 sm:px-6 lg:px-8"> |
| 3 | + <div class="max-w-7xl mx-auto <%= DomainTheme.bg_class_for(:categories) %> border border-gray-200 rounded-xl shadow-lg p-6"> |
| 4 | + <div class="space-y-6"> |
| 5 | + |
| 6 | + <!-- Header --> |
| 7 | + <div class="flex items-center justify-between mb-6"> |
| 8 | + <h1 class="text-2xl font-semibold text-gray-900"> |
| 9 | + <%= Category.model_name.human.pluralize %> (<%= @count_display %>) |
| 10 | + </h1> |
| 11 | + <%= link_to "New #{Category.model_name.human.downcase}", |
| 12 | + new_category_path, |
| 13 | + class: "btn btn-primary-outline" %> |
| 14 | + </div> |
| 15 | + |
| 16 | + <%= render "search_boxes" %> |
| 17 | + |
| 18 | + <!-- Table --> |
| 19 | + <div class="bg-white rounded"> |
| 20 | + <div class="overflow-x-auto"> |
| 21 | + <% if @categories.any? %> |
| 22 | + <table class="w-full table-fixed border-collapse border border-gray-200"> |
| 23 | + <thead class="bg-gray-100"> |
| 24 | + <tr> |
| 25 | + <th class="px-4 py-2 text-left text-sm font-semibold text-gray-700 w-1/3"> |
| 26 | + Name |
| 27 | + </th> |
| 28 | + |
| 29 | + <th class="px-4 py-2 text-left text-sm font-semibold text-gray-700 w-1/4"> |
| 30 | + Type |
| 31 | + </th> |
| 32 | + |
| 33 | + <th class="px-4 py-2 text-center text-sm font-semibold text-gray-700 w-1/6"> |
| 34 | + Published |
| 35 | + </th> |
| 36 | + |
| 37 | + <th class="px-4 py-2 text-center text-sm font-semibold text-gray-700 w-[80px]"> |
| 38 | + Actions |
| 39 | + </th> |
| 40 | + </tr> |
| 41 | + </thead> |
| 42 | + |
| 43 | + <tbody class="divide-y divide-gray-200"> |
| 44 | + <% @categories.each do |category| %> |
| 45 | + <tr class=" <%= "bg-gray-200" unless category.published %> |
| 46 | + <%= category.published ? "hover:bg-gray-50" : "hover:bg-gray-100" %> transition-colors duration-150"> |
| 47 | + |
| 48 | + <td class="px-4 py-2 text-md text-gray-800 truncate font-bold"> |
| 49 | + <%= category.name %> |
| 50 | + </td> |
| 51 | + |
| 52 | + <td class="px-4 py-2 text-sm text-gray-800 truncate"> |
| 53 | + <%= category.category_type&.name || "—" %> |
| 54 | + </td> |
| 55 | + |
| 56 | + <td class="px-4 py-2 text-center"> |
| 57 | + <% if category.published? %> |
| 58 | + <span class="inline-block px-2 py-1 text-xs font-semibold text-green-800 bg-green-100 rounded"> |
| 59 | + Yes |
| 60 | + </span> |
| 61 | + <% else %> |
| 62 | + <span class="inline-block px-2 py-1 text-xs font-semibold text-gray-700 bg-gray-200 rounded"> |
| 63 | + No |
| 64 | + </span> |
| 65 | + <% end %> |
| 66 | + </td> |
| 67 | + |
| 68 | + <!-- Actions --> |
| 69 | + <td class="px-4 py-2 text-center"> |
| 70 | + <%= link_to "Edit", |
| 71 | + edit_category_path(category), |
| 72 | + class: "btn btn-secondary-outline whitespace-nowrap" %> |
| 73 | + <%= link_to "Taggings", |
| 74 | + taggings_path(category_names: category.name), |
| 75 | + class: "btn btn-secondary-outline whitespace-nowrap" %> |
| 76 | + </td> |
| 77 | + |
| 78 | + </tr> |
| 79 | + <% end %> |
| 80 | + </tbody> |
| 81 | + </table> |
| 82 | + <% else %> |
| 83 | + <!-- Empty state --> |
| 84 | + <p class="text-gray-500 text-center py-6"> |
| 85 | + No <%= Category.model_name.human.pluralize %> found. |
| 86 | + </p> |
| 87 | + <% end %> |
| 88 | + </div> |
| 89 | + </div> |
| 90 | + |
| 91 | + <!-- Pagination --> |
| 92 | + <div class="pagination flex justify-center mt-12"> |
| 93 | + <%= tailwind_paginate @categories %> |
| 94 | + </div> |
| 95 | + |
| 96 | + </div> |
| 97 | + </div> |
| 98 | + </div> |
| 99 | +</div> |
0 commit comments