Codeminer42/Punchclock

View on GitHub
app/views/new_admin/notes/_notes_table.html.erb

Summary

Maintainability
Test Coverage
<table class="table-auto w-full h-fit" id="index_table_notes">
  <thead>
  <tr class="text-xs font-semibold tracking-wide text-left text-gray-500 uppercase border-b dark:border-gray-700 bg-gray-50 dark:text-gray-400 dark:bg-gray-800">
    <th class="px-4 py-3"><%= Note.human_attribute_name('title') %></th>
    <th class="px-4 py-3"><%= Note.human_attribute_name('author') %></th>
    <th class="px-4 py-3"><%= Note.human_attribute_name('user') %></th>
    <th class="px-4 py-3"><%= Note.human_attribute_name('rate') %></th>
    <th class="px-4 py-3"><%= Note.human_attribute_name('created_at') %></th>
    <th class="px-4 py-3"><%= Note.human_attribute_name('updated_at') %></th>
    <th></th>
    <th></th>
    <th></th>
  </tr>
  </thead>
  <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800 text-sm text-start">
    <% notes.each do |note| %>
      <tr id="<%= "project_#{note.id}" %>" class="text-gray-700 dark:text-gray-400">
        <td class="px-4 py-3">
          <%= note.title %>
        </td>

        <td class="px-4 py-3">
          <%= note.author %>
        </td>

        <td class="px-4 py-3">
          <%= note.user %>
        </td>

        <td class="px-4 py-3">
          <%= note.rate %>
        </td>

        <td class="px-4 py-3">
          <%= l(note.created_at, format: :short) %>
        </td>
        <td class="px-4 py-3">
          <%= l(note.updated_at, format: :short) %>
        </td>
        <td>
          <%= link_to t('view'), 
          new_admin_show_note_path(note.id),
          class: 'font-semibold transition-colors duration-150 underline dark:hover:text-white hover:text-gray-900' %>
        </td>
        <td>
          <%= link_to t('edit'), 
          edit_new_admin_note_path(note.id),
          class: 'font-semibold transition-colors duration-150 underline dark:hover:text-white hover:text-gray-900' %>
        </td>
        <td>
          <%= link_to t('helpers.destroy'), 
          new_admin_destroy_note_path(note.id),
          class: 'font-semibold transition-colors duration-150 underline dark:hover:text-white hover:text-gray-900',
          method: :delete %>
        </td>
      </tr>
    <% end %>
  </tbody>
</table>