docbrown/app/views/articles/_sidebar_additional.html.erb
Ben Halpern 39759afaa9
Ben/womens day (#54)
* Up shecoded to 100 on sidebar
2018-03-08 05:46:36 -08:00

187 lines
7.5 KiB
Text

<div id="sidebar-wrapper-right" class="sidebar-wrapper sidebar-wrapper-right">
<div class="sidebar-bg" id="sidebar-bg-right"></div>
<div class="side-bar sidebar-additional showing" id="sidebar-additional">
<% if @user && @user.class.name == "User" %>
<% @user.github_repos.where(featured: true).order({stargazers_count: :desc}, {name: :asc}).each do |repo| %>
<a class="widget" href="<%= repo.url %>" target="_blank">
<header>
<span class="emoji"><img src="<%= asset_path("github-logo.svg") %>" /></span> <%= repo.name %>
</header>
<div class="widget-body" style="font-size:0.85em;">
<%= repo.description %>
<div class="widget-footer">
<% if repo.fork %>
<span class="widget-accent">fork</span>
<% end %>
<%= repo.language %>
<% if repo.stargazers_count > 0%>
<img src="<%= asset_path("star.svg") %>" /> <%= repo.stargazers_count %>
<% end %>
</div>
</div>
</a>
<% end %>
<% if Reaction.for_display(@user).size > 0 %>
<div class="widget">
<header>
&lt;RECENT REACTIONS&gt;
</header>
<div class="widget-body">
<% Reaction.for_display(@user).each do |reaction| %>
<div class="row">
<div class="key">
<%= image_tag(ReactionImage.new(reaction.category).path, style:"height:22px;width:22px;border:0px;vertical-align:5px;") %>
</div>
<div class="value" style="padding:5px 2px 0px 10px;">
<a href="<%= reaction.reactable.path %>"><%= reaction.reactable.title %>
</div>
</div>
<% end %>
</div>
</div>
<% end %>
<% elsif @user && @user.class.name == "Organization" %>
<% elsif @tag %>
<% if Article.active_discuss_threads(@tag).any? %>
<div class="widget">
<header>
<#DISCUSS>
</header>
<div class="widget-body">
<div class="widget-link-list">
<% Article.active_discuss_threads(@tag).
each do |plucked_article| %>
<%= render "articles/widget_list_item", plucked_article: plucked_article, show_comment_count: true %>
<% end %>
</div>
</div>
</div>
<% end %>
<% elsif @query %>
<% elsif @podcast_index %>
<% else %>
<% unless user_signed_in? %>
<div class="widget signin-cta-widget">
<header>
DEV.TO(GETHER)
</header>
<div class="widget-body">
<p style="margin-bottom: 12px;">Join thousands of software developers leveling up their code and careers.</p>
<center style="margin-bottom: 12px;">
<a href="/users/auth/twitter?state=navbar_basic" class="cta cta-button" data-no-instant>
TWITTER
</a>
<a href="/users/auth/github?state=navbar_basic" class="cta cta-button" data-no-instant>
GITHUB
</a>
</center>
</div>
</div>
<% end %>
<% if @sidebar_ad %>
<div class="widget">
<div class="widget-body" style="margin-top:-6px">
<%= @sidebar_ad.processed_html.html_safe %>
</div>
</div>
<% end %>
<% if Flipflop.she_coded? %>
<div class="widget">
<header>
<#SHECODED>
</header>
<div class="widget-body">
<div class="widget-link-list">
<% Article.
where(published: true, approved: true).
tagged_with(["shecoded", "theycoded"], any: true).
order("published_at DESC").
limit(100).
pluck(:path, :title, :comments_count, :created_at).
each do |plucked_article| %>
<%= render "articles/widget_list_item", plucked_article: plucked_article, show_comment_count: false %>
<% end %>
</div>
<p><center><a class="cta cta-button" href="/t/shecoded" style="color: white; background: #8a62b4;">VIEW ALL #SHECODED</a></center></p>
<p><center><a class="cta cta-button" href="/new/shecoded" style="color: white; background: #8a62b4;">SUBMIT YOUR STORY</a></center></p>
</div>
</div>
<% end %>
<% if Article.active_help.any? %>
<div class="widget">
<header>
<#HELP>
</header>
<div class="widget-body">
<div class="widget-link-list">
<% Article.active_help.limit(8).pluck(:path,:title,:comments_count, :created_at).each do |plucked_article| %>
<div class="widget-link-list__item">
<a href="<%= plucked_article[0] %>">
<%= plucked_article[1] %> <span class="discuss-list-comment-count <%= "discuss-list-comment-count-brand-new" if plucked_article[2] == 0 %>"><%= plucked_article[2] == 0 ? "fresh" : plucked_article[2] %></span>
</a>
</div>
<% end %>
</div>
<p><center><a class="cta cta-button" href="/new/help">ASK FOR HELP</a></center></p>
</div>
</div>
<% end %>
<div class="widget">
<header>
<#DISCUSS>
</header>
<div class="widget-body">
<div class="widget-link-list">
<% Article.
where(published:true).
where("published_at > ?", 2.days.ago).
tagged_with("discuss").
order("last_comment_at DESC").
limit(8).
pluck(:path, :title, :comments_count, :created_at).
each do |plucked_article| %>
<%= render "articles/widget_list_item", plucked_article: plucked_article, show_comment_count: true %>
<% end %>
</div>
<p><center><a class="cta cta-button" href="/new/discuss">START A DISCUSSION</a></center></p>
</div>
</div>
<div class="widget">
<header>
<#EXPLAINLIKEIMFIVE>
</header>
<div class="widget-body">
<div class="widget-link-list">
<% Article.
where(published:true).
tagged_with("explainlikeimfive").
order("last_comment_at DESC").
where("published_at > ?", 5.days.ago).
limit(3).
pluck(:path,:title,:comments_count, :created_at).
each do |plucked_article| %>
<%= render "articles/widget_list_item", plucked_article: plucked_article, show_comment_count: true %>
<% end %>
</div>
<p><center><a class="cta cta-button" href="/new/explainlikeimfive">ASK FOR AN EXPLANATION</a></center></p>
</div>
</div>
<div class="widget" id="podcast-widget">
<header>
&lt;LATEST PODCASTS&gt;
</header>
<div class="widget-body">
<% @podcast_episodes.each do |ep| %>
<div class="widget-podcast-ep">
<a href="<%= ep.path %>"><%= ep.title %>
<div class="widget-podcast-title">
<a href="<%= ep.podcast.path %>"><%= ep.podcast.title %>
</div>
</div>
<% end %>
<p><center><a class="cta cta-button" href="/pod">VIEW ALL</a></center></p>
</div>
</div>
<% end %>
</div>
</div>