Split content sorting bar from channel-information

(cherry picked from commit 07d3f6fb12)
This commit is contained in:
syeopite 2021-06-26 18:54:31 -07:00
parent 3c9fac0bf4
commit fb62ebae28
No known key found for this signature in database
GPG key ID: 6FA616E5A5294A82
7 changed files with 38 additions and 37 deletions

View file

@ -3,9 +3,8 @@
<link rel="stylesheet" href="/css/channel.css?v=<%= ASSET_COMMIT %>">
<% end %>
<% content_type = 4 %>
<% sort_options = Tuple.new %>
<%= rendered "components/channel-information" %>
<% content_type = 5 %>
<%= rendered "components/channels/channel-information" %>
<div class="pure-g">
<% stats_style_append = ""%>

View file

@ -4,8 +4,9 @@
<link rel="alternate" type="application/rss+xml" title="RSS" href="/feed/channel/<%= channel.ucid %>" >
<% end %>
<% content_type = 0 %>
<%= rendered "components/channel-information" %>
<% content_type = 1 %>
<%= rendered "components/channels/channel-information" %>
<%= rendered "components/channels/content-sorting-bar" %>
<div class="pure-g">
<% items.each do |item| %>

View file

@ -3,9 +3,8 @@
<link rel="stylesheet" href="/css/channel.css?v=<%= ASSET_COMMIT %>">
<% end %>
<% content_type = 2 %>
<% sort_options = Tuple.new %>
<%= rendered "components/channel-information" %>
<% content_type = 3 %>
<%= rendered "components/channels/channel-information" %>
<% if error_message %>
<div class="h-box">

View file

@ -3,8 +3,9 @@
<link rel="stylesheet" href="/css/channel.css?v=<%= ASSET_COMMIT %>">
<% end %>
<% content_type = 1 %>
<%= rendered "components/channel-information" %>
<% content_type = 2 %>
<%= rendered "components/channels/channel-information" %>
<%= rendered "components/channels/content-sorting-bar" %>
<div class="pure-g">
<% items.each do |item| %>

View file

@ -173,31 +173,5 @@
</div>
<div class="h-box">
<% if content_type == 1 || content_type == 2 %>
<% # We really only need a single <hr> (handled below) outside of content_type 1 or 2 %>
<hr>
<% route = content_type == 1 ? "/videos" : "/playlists" %>
<% url = "/channel/#{channel.ucid + route}" %>
<div class="pure-menu pure-menu-horizontal" id="sort-options" style="display: flex;">
<ul class="pure-menu-list" style="margin-left: auto;">
<% 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>
<% end %>
<hr>
</div>

View file

@ -0,0 +1,27 @@
<div class="h-box">
<% route = content_type == 1 ? "/videos" : "/playlists" %>
<% url = "/channel/#{channel.ucid + route}" %>
<div class="pure-menu pure-menu-horizontal" id="sort-options" style="display: flex;">
<ul class="pure-menu-list" style="margin-left: auto;">
<% 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>
<hr>
</div>

View file

@ -13,7 +13,7 @@
<% if is_channel_search && channel.is_a? AboutChannel && !subscriptions.nil? %>
<% content_type = 7 %>
<% sort_options = Tuple.new %>
<%= rendered "components/channel-information" %>
<%= rendered "components/channels/channel-information" %>
<% end %>
<% search_query_encoded = env.get?("search").try { |x| URI.encode_www_form(x.as(String), space_to_plus: true) } %>