Update sidebar to add links and challenge (#207)
* Update sidebar to add links and challenge * Add link on latest podcast sidebar header * Add hover underline to sidebar widget links
This commit is contained in:
parent
db4b7caa0e
commit
936a724ead
3 changed files with 51 additions and 23 deletions
|
|
@ -860,7 +860,7 @@
|
|||
}
|
||||
.widget{
|
||||
width:calc(100% - 30px);
|
||||
padding:14px 12px;
|
||||
padding:10px 12px;
|
||||
margin-bottom:15px;
|
||||
position:relative;
|
||||
overflow:hidden;
|
||||
|
|
@ -934,12 +934,17 @@
|
|||
header{
|
||||
width:100%;
|
||||
margin:auto;
|
||||
padding-bottom:5px;
|
||||
font-weight:800;
|
||||
font-size: 1.3em;
|
||||
font-size: 1.2em;
|
||||
padding-bottom:10px;
|
||||
font-family: $helvetica-condensed;
|
||||
font-stretch:condensed;
|
||||
a{
|
||||
color: $black;
|
||||
&:hover{
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
.emoji{
|
||||
margin-right:3px;
|
||||
margin-left:5px;
|
||||
|
|
@ -1130,11 +1135,19 @@
|
|||
}
|
||||
}
|
||||
.cta-button{
|
||||
padding:5px 18px;
|
||||
border-radius:3px;
|
||||
margin-top:12px;
|
||||
font-weight: bold;
|
||||
display:inline-block;
|
||||
margin-top:8px;
|
||||
padding:17px 5px 8px;
|
||||
margin-left: 3px;
|
||||
font-size:0.93em;
|
||||
color: $sky-blue;
|
||||
background: white;
|
||||
display:block;
|
||||
width:92%;
|
||||
border-top: 3px solid $light-gray;
|
||||
&:hover{
|
||||
text-decoration: underline;
|
||||
opacity:1;
|
||||
}
|
||||
}
|
||||
}
|
||||
.widget-link-list__item {
|
||||
|
|
|
|||
|
|
@ -153,9 +153,9 @@ class Article < ApplicationRecord
|
|||
end
|
||||
end
|
||||
|
||||
def self.active_discuss_threads(tag=nil, time_ago=nil)
|
||||
def self.active_threads(tags=["discuss"], time_ago=nil, number=10)
|
||||
stories = where(published:true).
|
||||
limit(8)
|
||||
limit(number)
|
||||
if time_ago == "latest"
|
||||
stories = stories.order("published_at DESC")
|
||||
elsif time_ago
|
||||
|
|
@ -166,8 +166,7 @@ class Article < ApplicationRecord
|
|||
where("published_at > ?", (tag.present? ? 5 : 2).days.ago)
|
||||
end
|
||||
|
||||
stories = stories.tagged_with(["discuss", tag]) if tag
|
||||
stories = stories.tagged_with("discuss") unless tag
|
||||
stories = stories.tagged_with(tags)
|
||||
|
||||
stories.pluck(:path, :title, :comments_count, :created_at)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -42,14 +42,14 @@
|
|||
<% end %>
|
||||
<% elsif @user && @user.class.name == "Organization" %>
|
||||
<% elsif @tag %>
|
||||
<% if Article.active_discuss_threads(@tag, Timeframer.new(params[:timeframe]).datetime).any? %>
|
||||
<% if Article.active_threads([@tag,"discuss"], Timeframer.new(params[:timeframe]).datetime).any? %>
|
||||
<div class="widget">
|
||||
<header>
|
||||
<#DISCUSS>
|
||||
</header>
|
||||
<div class="widget-body">
|
||||
<div class="widget-link-list">
|
||||
<% Article.active_discuss_threads(@tag, Timeframer.new(params[:timeframe]).datetime).
|
||||
<% Article.active_threads([@tag,"discuss"], Timeframer.new(params[:timeframe]).datetime).
|
||||
each do |plucked_article| %>
|
||||
<%= render "articles/widget_list_item", plucked_article: plucked_article, show_comment_count: true %>
|
||||
<% end %>
|
||||
|
|
@ -110,7 +110,7 @@
|
|||
<% if Article.active_help.any? %>
|
||||
<div class="widget">
|
||||
<header>
|
||||
<#HELP>
|
||||
<a href="/t/help"><#HELP></a>
|
||||
</header>
|
||||
<div class="widget-body">
|
||||
<div class="widget-link-list">
|
||||
|
|
@ -118,27 +118,43 @@
|
|||
<%= render "articles/widget_list_item", plucked_article: plucked_article, show_comment_count: true %>
|
||||
<% end %>
|
||||
</div>
|
||||
<p><center><a class="cta cta-button" href="/new/help">ASK FOR HELP</a></center></p>
|
||||
<a class="cta cta-button" href="/new/help">ASK FOR HELP</a>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if Article.active_threads(["challenge"], Timeframer.new(params[:timeframe]).datetime).any? %>
|
||||
<div class="widget">
|
||||
<header>
|
||||
<#DISCUSS>
|
||||
<a href="/t/challenge"><#CHALLENGE></a>
|
||||
</header>
|
||||
<div class="widget-body">
|
||||
<div class="widget-link-list">
|
||||
<% Article.active_discuss_threads(nil, Timeframer.new(params[:timeframe]).datetime).
|
||||
<% Article.active_threads(["challenge"], Timeframer.new(params[:timeframe]).datetime, 5).
|
||||
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>
|
||||
<a class="cta cta-button" href="/new/challenge">CREATE A CHALLENGE</a>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="widget">
|
||||
<header>
|
||||
<#EXPLAINLIKEIMFIVE>
|
||||
<a href="/t/discuss"><#DISCUSS></a>
|
||||
</header>
|
||||
<div class="widget-body">
|
||||
<div class="widget-link-list">
|
||||
<% Article.active_threads(["discuss"], Timeframer.new(params[:timeframe]).datetime).
|
||||
each do |plucked_article| %>
|
||||
<%= render "articles/widget_list_item", plucked_article: plucked_article, show_comment_count: true %>
|
||||
<% end %>
|
||||
</div>
|
||||
<a class="cta cta-button" href="/new/discuss">START A DISCUSSION</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget">
|
||||
<header>
|
||||
<a href="/t/explainlikeimfive"><#EXPLAINLIKEIMFIVE></a>
|
||||
</header>
|
||||
<div class="widget-body">
|
||||
<div class="widget-link-list">
|
||||
|
|
@ -147,12 +163,12 @@
|
|||
<%= 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>
|
||||
<a class="cta cta-button" href="/new/explainlikeimfive">ASK FOR AN EXPLANATION</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget" id="podcast-widget">
|
||||
<header>
|
||||
<LATEST PODCASTS>
|
||||
<a href="/pod"><LATEST PODCASTS></pod>
|
||||
</header>
|
||||
<div class="widget-body">
|
||||
<% @podcast_episodes.each do |ep| %>
|
||||
|
|
@ -163,7 +179,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<p><center><a class="cta cta-button" href="/pod">VIEW ALL</a></center></p>
|
||||
<a class="cta cta-button" href="/pod">VIEW ALL</a>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue