Files
danbooru/app/views/users/_post_summary.html.erb
evazion 1b30b71a07 posts: refactor post previews to use ViewComponent.
Refactor the post preview html to use the ViewComponent framework. This
lets us encapsulate all the HTML, CSS, and helper methods for a UI
component in a single place.

See https://viewcomponent.org.
2021-01-14 21:17:57 -06:00

37 lines
1.1 KiB
Plaintext

<% if presenter.has_uploads? %>
<div class="box user-uploads">
<h2>
<%= link_to "Uploads", posts_path(:tags => "user:#{user.name}") %>
</h2>
<div>
<%= post_previews_html(presenter.uploads, tags: "user:#{user.name}") %>
</div>
</div>
<% end %>
<% if presenter.has_favorites? && policy(user).can_see_favorites? %>
<div class="box user-favorites">
<h2>
<%= link_to "Favorites", posts_path(tags: "ordfav:#{user.name}") %>
</h2>
<div>
<%= post_previews_html(presenter.favorites, tags: "ordfav:#{user.name}") %>
</div>
</div>
<% end %>
<% if false %>
<% presenter.saved_search_labels.each do |label| %>
<div class="box user-saved-search" data-label="<%= label %>">
<h2>
Saved Search: <%= link_to label, posts_path(:tags => "search:#{label}") %>
(<%= link_to "manage", saved_searches_path(label: label) %>)
</h2>
<div class="box">
<%= post_previews_html(presenter.posts_for_saved_search_category, tags: "search:#{label}") %>
</div>
</div>
<% end %>
<% end %>