This commit adds support for channel home pages and all of the categories within it. However, the frontend code is a mess and thus needs to be refactor soon. Though that would likely require a rework of items.ecr This commit also comes with some general cleanups and improvements. Before this commit channel brand URls would only be supported on the videos page (now home page). It has been improved to be able to handle all channel URLs. The category_type and auxiliary_data property has also been removed from the Category struct. The former was never used and the latter allows for random data to be added to the Struct presenting documentation issues. Since the auxiliary_data variable was mainly used to store values from the browse_endpoint in order to create URLs, its much simpler to instead just get the URL from the webCommandMetadata. As a result of this change the browse_endpoint_data attribute of Category has also been removed.
200 lines
8.4 KiB
Plaintext
200 lines
8.4 KiB
Plaintext
<% if channel.banner %>
|
|
<div class="pure-g" id="channel-banner-container">
|
|
<div class="pure-u-1" id="banner" style='background-image: url(/ggpht<%= URI.parse(channel.banner.not_nil!.gsub("=w1060-", "=w1280-")).request_target %>)'>
|
|
<% if !channel.links.empty? %>
|
|
<div id="link-holder">
|
|
<div id="link-widget-primary" class="link-widget-link">
|
|
<a href="<%=channel.links[0][1]%>" title=<%=channel.links[0][0]%>>
|
|
<img src="/fetch_link_favicon?url=<%=channel.links[0][2]%>">
|
|
<b> <%=channel.links[0][0]%> </b>
|
|
</a>
|
|
</div>
|
|
|
|
<% channel.links[1..4].each do |link_tuple| %>
|
|
<div class="link-widget-link">
|
|
<a href="<%=link_tuple[1]%>" title=<%=link_tuple[0]%>>
|
|
<img src="/fetch_link_favicon?url=<%=link_tuple[2]%>">
|
|
</a>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="h-box">
|
|
<hr>
|
|
</div>
|
|
<% end %>
|
|
|
|
<div class="pure-g h-box">
|
|
<div class="pure-u-2-3">
|
|
<div class="channel-profile">
|
|
<img src="/ggpht<%= URI.parse(channel.author_thumbnail).request_target %>">
|
|
<span><%= channel.author %></span>
|
|
</div>
|
|
</div>
|
|
<div class="pure-u-1-3" style="text-align:right">
|
|
<h3>
|
|
<a href="/feed/channel/<%= channel.ucid %>"><i class="icon ion-logo-rss"></i></a>
|
|
</h3>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="h-box">
|
|
<p><span style="white-space:pre-wrap"><%= channel.description_html %></span></p>
|
|
</div>
|
|
|
|
<div class="h-box">
|
|
<% ucid = channel.ucid %>
|
|
<% author = channel.author %>
|
|
<% sub_count_text = number_to_short_text(channel.sub_count) %>
|
|
<%= rendered "components/subscribe_widget" %>
|
|
</div>
|
|
|
|
<div class="pure-g h-box" id="content-navigation">
|
|
<div class="pure-u-1-3">
|
|
<!-- TODO Add these!
|
|
<a href="https://www.youtube.com/channel/<%= channel.ucid %>"><%= translate(locale, "View channel on YouTube") %></a> -->
|
|
<!-- <a href="/redirect?referer=<%= env.get?("current_page") %>"><%= translate(locale, "Switch Invidious Instance") %></a> -->
|
|
<!-- TODO Refactor this! -->
|
|
<div class="pure-menu pure-menu-horizontal">
|
|
<ui class="pure-menu-list">
|
|
<% if content_type == 0 %>
|
|
<li class="pure-menu-item pure-menu-selected">
|
|
<a class="pure-menu-link" href="/channel/<%= channel.ucid %>">
|
|
<b> <%= translate(locale, "Home") %> </b>
|
|
</a>
|
|
</li>
|
|
<% else %>
|
|
<li class="pure-menu-item">
|
|
<a class="pure-menu-link" href="/channel/<%= channel.ucid %>">
|
|
<%= translate(locale, "Home") %>
|
|
</a>
|
|
</li>
|
|
<% end %>
|
|
|
|
<% if !channel.auto_generated %>
|
|
<% if content_type == 1 %>
|
|
<li class="pure-menu-item pure-menu-selected">
|
|
<a href="/channel/<%= channel.ucid %>/videos" class="pure-menu-link">
|
|
<b><%= translate(locale, "Videos") %></b>
|
|
</a>
|
|
</li>
|
|
<% else %>
|
|
<li class="pure-menu-item pure-menu">
|
|
<a href="/channel/<%= channel.ucid %>/videos" class="pure-menu-link">
|
|
<%= translate(locale, "Videos") %>
|
|
</a>
|
|
</li>
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<% if content_type == 2 %>
|
|
<li class="pure-menu-item pure-menu-selected">
|
|
<a class="pure-menu-link" href="/channel/<%= channel.ucid %>/playlists">
|
|
<b> <%= translate(locale, "Playlists") %> </b>
|
|
</a>
|
|
</li>
|
|
<% else %>
|
|
<li class="pure-menu-item">
|
|
<a class="pure-menu-link" href="/channel/<%= channel.ucid %>/playlists">
|
|
<%= translate(locale, "Playlists") %>
|
|
</a>
|
|
</li>
|
|
<% end %>
|
|
|
|
<% if channel.tabs.has_key?("community") %>
|
|
<% if content_type == 3 %>
|
|
<li class="pure-menu-item pure-menu-selected">
|
|
<a class="pure-menu-link" href="/channel/<%= channel.ucid %>/community">
|
|
<b> <%= translate(locale, "Community") %> </b>
|
|
</a>
|
|
</li>
|
|
<% else %>
|
|
<li class="pure-menu-item">
|
|
<a class="pure-menu-link" href="/channel/<%= channel.ucid %>/community">
|
|
<%= translate(locale, "Community") %>
|
|
</a>
|
|
</li>
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<% if content_type == 4 %>
|
|
<li class="pure-menu-item pure-menu-selected">
|
|
<a class="pure-menu-link" href="/channel/<%= channel.ucid %>/channels">
|
|
<b> <%= translate(locale, "Channels") %> </b>
|
|
</a>
|
|
</li>
|
|
<% else %>
|
|
<li class="pure-menu-item">
|
|
<a class="pure-menu-link" href="/channel/<%= channel.ucid %>/channels">
|
|
<%= translate(locale, "Channels") %>
|
|
</a>
|
|
</li>
|
|
<% end %>
|
|
|
|
<% if content_type == 5 %>
|
|
<li class="pure-menu-item pure-menu-selected">
|
|
<a class="pure-menu-link" href="/channel/<%= channel.ucid %>/about">
|
|
<b> <%= translate(locale, "About") %> </b>
|
|
</a>
|
|
</li>
|
|
<% else %>
|
|
<li class="pure-menu-item">
|
|
<a class="pure-menu-link" href="/channel/<%= channel.ucid %>/about">
|
|
<%= translate(locale, "About") %>
|
|
</a>
|
|
</li>
|
|
<% end %>
|
|
|
|
<% if !channel.auto_generated %>
|
|
<li class="pure-menu-item navbar" style="margin: 0 0 0 0.5em">
|
|
<div class="searchbar">
|
|
<form class="pure-form" action="/search" method="get">
|
|
<fieldset>
|
|
<button class="search-button"><i class="icon ion-md-search"></i></button>
|
|
<input type="search" name="q" placeholder="<%= translate(locale, "search") %>" value="<%= env.get?("search").try {|x| HTML.escape(x.as(String)) } %>">
|
|
<input type="hidden" name="channel" value="<%= channel.ucid %>">
|
|
</fieldset>
|
|
</form>
|
|
</div>
|
|
</li>
|
|
<% end %>
|
|
</ui>
|
|
</div>
|
|
</div>
|
|
<div class="pure-u-1-3"></div>
|
|
|
|
<% if content_type == 1 || content_type == 2 %>
|
|
<% route = content_type == 1 ? "/playlists" : "" %>
|
|
<% url = "/channel/#{channel.ucid + route}" %>
|
|
|
|
<div class="pure-u-1-3"> <!-- Sort by -->
|
|
<div class="pure-menu pure-menu-horizontal" style="">
|
|
<ul class="pure-menu-list" style="float: right">
|
|
<% sort_options.each do |sort| %>
|
|
<% if sort_by == sort %>
|
|
<li class="pure-menu-item pure-menu-selected">
|
|
<a class="pure-menu-link" href="<%= url %>?sort_by=<%= sort %>">
|
|
<b><%= translate(locale, sort) %></b>
|
|
</a>
|
|
</li>
|
|
<% else %>
|
|
<li class="pure-menu-item">
|
|
<a class="pure-menu-link" href="<%= url %>?sort_by=<%= sort %>">
|
|
<%= translate(locale, sort) %>
|
|
</a>
|
|
</li>
|
|
<% end %>
|
|
<% end %>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
|
|
<div class="h-box">
|
|
<hr>
|
|
</div>
|