docbrown/app/components/admin/users/tools/reports_component.html.erb
rhymes fc01a93326
Admin Member view: add Tools::HeaderComponent to reduce duplication (#14558)
* This does not work

* Revert "This does not work"

This reverts commit b2292e61fb10faa6051b009214e732a9927c7746.

* Tried with a partial, works

* Improved with component
2021-08-24 15:08:48 +02:00

27 lines
1.2 KiB
Text

<section
class="crayons-card p-3 js-component"
data-controller="users--tools--ajax"
data-action="ajax:success@document->users--tools--ajax#success ajax:error@document->users--tools--ajax#error">
<%= render Admin::Users::Tools::HeaderComponent.new(title: "Reports", user: @user) %>
<% if @reports.any? %>
<article>
<ul class="list-none">
<% @reports.each_with_index do |report, index| %>
<li
class="py-3 pl-3 <%= index == @reports.size - 1 ? "border-b-0" : "border-b-1" %> border-l-0 border-t-0 border-r-0 border-solid border-base-50">
<a href="<%= admin_report_path(report) %>"
class="text-none color-base-60 flex justify-between"
rel="noopener noreferer"
target="_blank">
<span><%= report.category.capitalize %> (<%= report.status %>)</span>
<span><strong><%= report.user_types(@user.id).to_sentence %></strong>: <%= report.message %></span>
<span><local-time datetime="<%= report.created_at.iso8601 %>"><%= report.created_at.strftime("%b %d, %Y") %></local-time></span>
</a>
</li>
<% end %>
</ul>
</article>
<% end %>
</section>