css: factor out recent posts component.

This commit is contained in:
evazion
2021-02-16 01:48:20 -06:00
parent 1e80540a04
commit e215fd1c47
5 changed files with 27 additions and 31 deletions

View File

@@ -0,0 +1,9 @@
/* A small set of recent posts. Used for recent uploads and favorites on user
* profile pages, and recent posts on artist and wiki pages. */
div.recent-posts {
margin-bottom: 1rem;
h2.recent-posts-header {
margin-bottom: 0.25rem;
}
}

View File

@@ -1,9 +1,5 @@
div#c-users {
div#a-show {
div.box {
margin-bottom: 2em;
}
table.user-statistics {
th {
width: 15%;

View File

@@ -22,11 +22,13 @@
<% if @artist.tag.present? && @artist.tag.post_count > 0 %>
<div class="recent-posts">
<h2>Recent Posts <%= link_to "»", posts_path(tags: @artist.name) %></h2>
<h2 class="recent-posts-header">
<%= link_to "Posts", posts_path(tags: @artist.name) %>
</h2>
<%= render "posts/partials/common/inline_blacklist" %>
<div>
<div class="recent-posts-previews">
<%= post_previews_html(@artist.tag.posts.limit(8), tags: @artist.name) %>
</div>
</div>

View File

@@ -1,36 +1,21 @@
<% if presenter.has_uploads? %>
<div class="box user-uploads">
<h2>
<%= link_to "Uploads", posts_path(:tags => "user:#{user.name}") %>
<div class="user-uploads recent-posts">
<h2 class="recent-posts-header">
<%= link_to "Uploads", posts_path(tags: "user:#{user.name}") %>
</h2>
<div>
<div class="recent-posts-previews">
<%= 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>
<div class="user-favorites recent-posts">
<h2 class="recent-posts-header">
<%= link_to "Favorites", posts_path(tags: "ordfav:#{user.name}") %>
</h2>
<div>
<div class="recent-posts-previews">
<%= 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 %>

View File

@@ -1,7 +1,11 @@
<% if wiki_page.tag.present? && !wiki_page.tag.empty? %>
<div id="wiki-page-posts">
<h2>Recent Posts <%= link_to "»", posts_path(tags: wiki_page.title) %></h2>
<div class="recent-posts">
<h2 class="recent-posts-header">
<%= link_to "Posts", posts_path(tags: wiki_page.title) %>
</h2>
<%= post_previews_html(wiki_page.tag.posts.limit(8), tags: wiki_page.title) %>
<div class="recent-posts-previews">
<%= post_previews_html(wiki_page.tag.posts.limit(8), tags: wiki_page.title) %>
</div>
</div>
<% end %>