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.
This commit is contained in:
@@ -4,9 +4,7 @@
|
||||
<%= link_to "Uploads", posts_path(:tags => "user:#{user.name}") %>
|
||||
</h2>
|
||||
<div>
|
||||
<% presenter.uploads.each do |post| %>
|
||||
<%= PostPresenter.preview(post, :tags => "user:#{user.name}") %>
|
||||
<% end %>
|
||||
<%= post_previews_html(presenter.uploads, tags: "user:#{user.name}") %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -17,9 +15,7 @@
|
||||
<%= link_to "Favorites", posts_path(tags: "ordfav:#{user.name}") %>
|
||||
</h2>
|
||||
<div>
|
||||
<% presenter.favorites.each do |post| %>
|
||||
<%= PostPresenter.preview(post, tags: "ordfav:#{user.name}") %>
|
||||
<% end %>
|
||||
<%= post_previews_html(presenter.favorites, tags: "ordfav:#{user.name}") %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -33,9 +29,7 @@
|
||||
</h2>
|
||||
|
||||
<div class="box">
|
||||
<% presenter.posts_for_saved_search_category(label).each do |post| %>
|
||||
<%= PostPresenter.preview(post, :tags => "search:#{label}") %>
|
||||
<% end %>
|
||||
<%= post_previews_html(presenter.posts_for_saved_search_category, tags: "search:#{label}") %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user