mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-04-11.git
synced 2024-08-15 00:43:26 +00:00
Add content sections to trending feed
This commit is contained in:
parent
bbfbe70930
commit
e485bc2ef3
3 changed files with 50 additions and 4 deletions
|
@ -631,3 +631,20 @@ p,
|
|||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.category {
|
||||
margin: 3em 0px 4em 0px;
|
||||
}
|
||||
|
||||
.category .heading > p {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.category .badge.featured {
|
||||
background: #005aa7;
|
||||
color: white;
|
||||
padding: 3px 4px 1px 4px;
|
||||
border-radius: 5px;
|
||||
font-size: 14px;
|
||||
margin-left: 10px;
|
||||
}
|
|
@ -16,7 +16,7 @@ def fetch_trending(trending_type, region, locale)
|
|||
|
||||
client_config = YoutubeAPI::ClientConfig.new(region: region)
|
||||
initial_data = YoutubeAPI.browse("FEtrending", params: params, client_config: client_config)
|
||||
trending = extract_videos(initial_data)
|
||||
trending = extract_items(initial_data)
|
||||
|
||||
return {trending, plid}
|
||||
end
|
||||
|
|
|
@ -37,7 +37,36 @@
|
|||
</div>
|
||||
|
||||
<div class="pure-g">
|
||||
<% trending.each do |item| %>
|
||||
<% trending.each do |category| %>
|
||||
<% if category.is_a? Category %>
|
||||
<%# We don't need to differinate between a category that only
|
||||
# contains videos and no metadata %>
|
||||
<% if category.title.empty? %>
|
||||
<% category.contents.each do |item| %>
|
||||
<%= rendered "components/item" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div class="category pure-u-1">
|
||||
<div class="category-heading h-box">
|
||||
<p> <%= category.title %> </p>
|
||||
<% if (badges = category.badges).is_a? Array %>
|
||||
<% badges.each do | badge |%>
|
||||
<% if badge[0] == "BADGE_STYLE_TYPE_FEATURED" %>
|
||||
<div class="badge featured">
|
||||
<span> <%=badge[1] %><span>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="pure-g">
|
||||
<% category.contents.each do |item| %>
|
||||
<%= rendered "components/item" %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue