* Add new sidebar billboard locations * Remove some specs * Remove campaign tests * Adjust tag-allowed billboards * Fix up targeting functionality * Fix sidebar third render
88 lines
4 KiB
Text
88 lines
4 KiB
Text
<% @billboards = get_homepage_sidebar_billboards %>
|
|
<aside class="side-bar sidebar-additional showing grid gap-4" id="sidebar-additional">
|
|
<% if @billboards.first %>
|
|
<%= render partial: "shared/billboard", locals: { billboard: @billboards.first, data_context_type: BillboardEvent::CONTEXT_TYPE_HOME } %>
|
|
<% end %>
|
|
<% if user_signed_in? && @active_discussions.any? %>
|
|
<% if Settings::General.display_sidebar_active_discussions %>
|
|
<section class="crayons-card crayons-card--secondary crayons-layout__content" id="active-discussions">
|
|
<header class="crayons-card__header">
|
|
<h3 class="crayons-subtitle-2">
|
|
<%= t("views.main.side.active_discussions") %>
|
|
</h3>
|
|
</header>
|
|
<div>
|
|
<% @active_discussions.each do |plucked_article| %>
|
|
<%= render "articles/widget_list_item", plucked_article: plucked_article, show_comment_count: true %>
|
|
<% end %>
|
|
</div>
|
|
</section>
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<% if @billboards.second %>
|
|
<%= render partial: "shared/billboard", locals: { billboard: @billboards.second, data_context_type: BillboardEvent::CONTEXT_TYPE_HOME } %>
|
|
<% end %>
|
|
|
|
<% cache(release_adjusted_cache_key("main-article-right-sidebar-discussions-#{params[:timeframe]}-#{user_signed_in?}"), expires_in: (params[:timeframe].blank? ? 120 : 360).seconds) do %>
|
|
|
|
<% Tag.where(name: Settings::General.sidebar_tags).find_each do |tag| %>
|
|
<section class="crayons-card crayons-card--secondary crayons-layout__content">
|
|
<header class="crayons-card__header">
|
|
<h3 class="crayons-subtitle-2"><a href="/t/<%= tag.name %>" class="crayons-link">#<%= tag.name %></a></h3>
|
|
<div class="fs-xs color-base-70">
|
|
<%= tag.short_summary %>
|
|
</div>
|
|
</header>
|
|
<div>
|
|
<% if tag.name == "help" %>
|
|
<% Article.active_help.limit(5).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 %>
|
|
<% else %>
|
|
<% active_threads(tags: [tag.name], time_ago: Timeframe.datetime(params[:timeframe]), count: 5).each do |plucked_article| %>
|
|
<%= render "articles/widget_list_item", plucked_article: plucked_article, show_comment_count: true %>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
</section>
|
|
<% end %>
|
|
<% end %>
|
|
<% if @billboards.third %>
|
|
<%= render partial: "shared/billboard", locals: { billboard: @billboards.third, data_context_type: BillboardEvent::CONTEXT_TYPE_HOME } %>
|
|
<% end %>
|
|
<% unless user_signed_in? %>
|
|
<% cache("seo-boostable-posts-homepage-#{params[:timeframe]}", expires_in: 18.hours) do %>
|
|
<% boostable_posts = Article.seo_boostable(nil, Timeframe.datetime(params[:timeframe])) %>
|
|
<% if boostable_posts.present? %>
|
|
<section class="widget">
|
|
<header>
|
|
<h4><%= t("views.main.side.trend") %></h4>
|
|
</header>
|
|
<div class="widget-body">
|
|
<div class="widget-link-list">
|
|
<% boostable_posts.each do |plucked_article| %>
|
|
<%= render "articles/widget_list_item", plucked_article: plucked_article, show_comment_count: false %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
<% end %>
|
|
<% recent_preamble_optimized_posts = Article.search_optimized(nil) %>
|
|
<% if params[:timeframe].blank? && recent_preamble_optimized_posts.present? %>
|
|
<section class="widget">
|
|
<header>
|
|
<h4><%= t("views.main.side.recent") %></h4>
|
|
</header>
|
|
<div class="widget-body">
|
|
<div class="widget-link-list">
|
|
<% recent_preamble_optimized_posts.each do |plucked_article| %>
|
|
<%= render "articles/widget_list_item", plucked_article: plucked_article, show_comment_count: false %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
<% end %>
|
|
<% end %>
|
|
<% end %>
|
|
</aside>
|