docbrown/app/views/articles/_special_sidebar.html.erb
rhymes 5782ffd7e0 Use published scope for articles (#2374)
* Use published scope for articles

* Fix variable name

* The sequencing in the union query matters

* Fix spec

* Restore a published: true condition

* This test is actually misleading due to the union

* Revert this change, not sure why it's not a relation

* Fix useless diff
2019-04-11 13:18:26 -04:00

26 lines
1.2 KiB
Text

<div class="widget">
<a href="/t/shecoded">
<img src="<%= asset_path("she-coded-rectangle.png") %>" style="cursor:pointer;min-height:136px;background:#0e0e0e" alt="she coded" />
</a>
<center style="padding:10px;font-weight:600;font-size:22px;">Latest Posts</center>
</div>
<% Article.published.tagged_with("shecoded").where(approved: true).order("created_at DESC").limit(8).each do |article| %>
<a href="<%= article.path %>" style="display:block;color:#0e0e0e">
<div class="widget">
<header>
<h4><span class="emoji">💪</span> <%= article.title %></h4>
</header>
<img src="<%= ProfileImage.new(article.user).get(420) %>" style="cursor:pointer;" alt="<%= article.user.username %>" />
</div>
</a>
<% end %>
<a href="/t/shecoded">
<div class="widget">
<a href="/t/shecoded">
<img src="<%= asset_path("she-coded-rectangle.png") %>" style="cursor:pointer;min-height:136px;background:#0e0e0e" alt="she coded" />
<center style="padding:10px;font-weight:600;font-size:22px;text-decoration:underline;color:#0e0e0e">View
All <%= Article.published.tagged_with("shecoded").where(approved: true).size %> Submissions
</center>
</a>
</div>
</a>