app/views/panda_cms/admin/posts/index.html.erb in panda_cms-0.3.15 vs app/views/panda_cms/admin/posts/index.html.erb in panda_cms-0.5.0
- old
+ new
@@ -1,45 +1,16 @@
<%= render PandaCms::Admin::ContainerComponent.new do |component| %>
<% component.with_heading(text: "Posts", level: 1) do |heading| %>
<% end %>
- <div class="-mx-4 ring-1 ring-gray-300 sm:mx-0 rounded-lg sm:rounded-lg overflow-x-auto">
- <table class="min-w-full border-collapse table-auto divide-y divide-gray-300">
- <thead>
- <tr>
- <th scope="col" class="py-3.5 px-3 text-sm font-semibold text-left text-gray-900">Title</th>
- <th scope="col" class="py-3.5 px-3 text-sm font-semibold text-left text-gray-900">Status</th>
- <th scope="col" class="py-3.5 px-3 text-sm font-semibold text-left text-gray-900">Author</th>
- <th scope="col" class="py-3.5 px-3 text-sm font-semibold text-left text-gray-900">Published</th>
- <th scope="col" class="relative py-3.5 pr-4 pl-3 sm:pr-0">
- <span class="sr-only">Edit</span>
- </th>
- </tr>
- </thead>
- <tbody class="bg-white divide-y divide-gray-200">
- <% posts.each do |post| %>
- <tr class="bg-white hover:bg-gray-50 cursor-pointer relative">
- <td class="py-5 pr-3 pl-3 text-sm whitespace-nowrap">
- <div class="flex items-center">
- <div class="">
- <div class="font-medium text-gray-900"><%= post.title %></div>
- <div class="mt-1 text-gray-500"><%= link_to post.path, post.path, target: "_blank" %></div>
- </div>
- </div>
- </td>
- <td class="py-5 px-3 text-sm text-gray-500 whitespace-nowrap">
- <%= render PandaCms::Admin::TagComponent.new(status: :active) %>
- </td>
- <td class="py-5 px-3 text-sm text-gray-500 whitespace-nowrap">
-
- </td>
- <td class="py-5 px-3 text-sm text-gray-500 whitespace-nowrap">
- <div class="text-gray-500"><%= time_ago_in_words(post&.created_at) %> ago</div>
- </td>
- <td class="py-5 pr-4 pl-3 text-sm font-medium text-right whitespace-nowrap">
- </td>
- </tr>
- <% end %>
- </tbody>
- </table>
- </div>
+ <%= render PandaCms::Admin::TableComponent.new(rows: posts) do |table| %>
+ <% table.column("Title") do |post| %>
+ <div class="">
+ <%= link_to post.title, edit_admin_post_path(post), class: "block h-full w-full" %>
+ <span class="block text-xs text-black/60"><%= post.path %></span>
+ </div>
+ <% end %>
+ <% table.column("Status") { |post| render PandaCms::Admin::TagComponent.new(status: post.status) } %>
+ <% table.column("Last Updated") { |post| render PandaCms::Admin::UserActivityComponent.new(whodunnit_to: post)} %>
+ <% end %>
+
<% end %>