EvoBal/app/views/emails/_list.html.erb

51 lines
2.6 KiB
Plaintext

<%= form_with url: batch_emails_url, method: :post, data: {"turbo-frame": "_top", controller: "checkboxes"} do |form| %>
<div class="shadow overflow-auto border-b border-gray-200 rounded-lg">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th scope="col" class="pl-3 pr-1 py-3 text-center text-xs font-medium text-gray-500 uppercase tracking-wider">
<%= check_box_tag "foo", "all", false,
class: "focus:ring-gray-500 h-4 w-4 text-gray-600 border-gray-300 rounded",
data: { action: "input->checkboxes#syncCheckedState", "checkboxes-target": "checkboxesGroup" } %>
</th>
<th scope="col" class="px-2 py-3 text-center text-xs font-medium text-gray-500 uppercase tracking-wider">Date</th>
<th scope="col" class="px-2 py-3 text-center text-xs font-medium text-gray-500 uppercase tracking-wider">From</th>
<th scope="col" class="px-2 py-3 text-center text-xs font-medium text-gray-500 uppercase tracking-wider">Subject</th>
<th scope="col" class="px-2 py-3 text-center text-xs font-medium text-gray-500 uppercase tracking-wider">Metadata</th>
</tr>
</thead>
<tbody class="text-sm bg-white divide-y divide-gray-200">
<% emails.each do |email| %>
<%= render partial: "list_row", object: email, as: :email, locals: {form: form} %>
<% end %>
</tbody>
</table>
<div class="bg-white px-4 py-3 flex items-center justify-between border-t border-gray-200 sm:px-6">
<div class="flex-1 flex justify-between sm:hidden">
<%= link_to_previous_page @emails, 'Previous page', class: "ml-3 paginate-page paginate-page-single" %>
<%= link_to_next_page @emails, 'Next Page', class: "paginate-page paginate-page-single" %>
</div>
<div class="hidden sm:flex-1 sm:flex sm:items-center sm:justify-between">
<div>
<%= form.hidden_field :return_url, value: request.url %>
<%= form.select :batch_action, [["Mark not inbox", :mark_not_inbox],["Mark inbox", :mark_inbox]] %>
<%= form.submit "Apply" %>
</div>
<div>
<p class="text-sm text-gray-700">
Showing
<span class="font-medium"><%= @emails.offset_value + 1 %></span>
to
<span class="font-medium"><%= @emails.offset_value + (@emails.respond_to?(:records) ? @emails.records : @emails.to_a).size %></span>
of
<span class="font-medium"><%= @emails.total_count %></span>
results
</p>
</div>
<%= paginate @emails %>
</div>
</div>
</div>
<% end %>