docbrown/app/components/admin/users/tools/reactions_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: "Reactions", user: @user) %>
<% if @reactions.any? %>
<article>
<ul class="list-none">
<% @reactions.each_with_index do |reaction, index| %>
<li
class="py-3 pl-3 <%= index == @reactions.size - 1 ? "border-b-0" : "border-b-1" %> border-l-0 border-t-0 border-r-0 border-solid border-base-50">
<a href="<%= reaction.reactable.path %>"
class="text-none color-base-60 flex justify-between"
rel="noopener noreferer"
target="_blank">
<span>🤢 <%= reaction.category.capitalize %></span>
<span><strong><%= reaction.reactable_type %></strong><%= reaction.reactable_type == "User" ? "" : ": #{reaction.reactable.title}" %></span>
<span><local-time datetime="<%= reaction.created_at.iso8601 %>"><%= reaction.created_at.strftime("%b %d, %Y") %></local-time></span>
</a>
</li>
<% end %>
</ul>
</article>
<% end %>
</section>