Add erc for viewing one compliation

This commit is contained in:
broquemonsieur 2023-06-16 02:49:43 -07:00
parent 74d42c18dd
commit ea48239543
4 changed files with 59 additions and 2 deletions

View File

@ -23,6 +23,12 @@ module Invidious::Routes::Misc
else
env.redirect "/feed/popular"
end
when "Compilations"
if user
env.redirect "/feed/compilations"
else
env.redirect "/feed/popyular"
end
else
templated "search_homepage", navbar_search: false
end

View File

@ -99,7 +99,7 @@ module Invidious::Routes::PreferencesRoute
default_home = env.params.body["default_home"]?.try &.as(String) || CONFIG.default_user_preferences.default_home
feed_menu = [] of String
4.times do |index|
5.times do |index|
option = env.params.body["feed_menu[#{index}]"]?.try &.as(String) || ""
if !option.empty?
feed_menu << option

View File

@ -0,0 +1,51 @@
<% title = HTML.escape(compilation.title) %>
<% author = HTML.escape(compilation.author) %>
<% content_for "header" do %>
<title><%= title %> - Invidious</title>
<link rel="alternate" type="application/rss+xml" title="RSS" href="/feed/playlist/<%= plid %>" />
<% end %>
<div class="pure-g h-box">
<div class="pure-u-2-3">
<h3><%= title %></h3>
<% if compilation.is_a? InvidiousCompilation %>
<b>
<% if compilation.author == user.try &.email %>
<a href="/feed/compilations"><%= author %></a> |
<% else %>
<%= author %> |
<% end %>
<%= translate_count(locale, "generic_videos_count", compilation.video_count) %> |
<%= translate(locale, "Updated `x` ago", recode_date(compilation.updated, locale)) %> |
<% case compilation.as(InvidiousCompilation).privacy when %>
<% when CompilationPrivacy::Unlisted %>
<i class="icon ion-ios-unlock"></i> <%= translate(locale, "Unlisted") %>
<% when CompilationPrivacy::Private %>
<i class="icon ion-ios-lock"></i> <%= translate(locale, "Private") %>
<% end %>
</b>
<% else %>
<b>
<a href="/channel/<%= compilation.ucid %>"><%= author %></a> |
<%= translate_count(locale, "generic_videos_count", compilation.video_count) %> |
<%= translate(locale, "Updated `x` ago", recode_date(compilation.updated, locale)) %>
</b>
<% end %>
</div>
<div class="pure-u-1-3" style="text-align:right">
<h3>
<div class="pure-g user-field">
<% if compilation.is_a?(InvidiousCompilation) && compilation.author == user.try &.email %>
<div class="pure-u-1-3"><a href="/edit_compilation?list=<%= compid %>"><i class="icon ion-md-create"></i></a></div>
<div class="pure-u-1-3"><a href="/delete_compilation?list=<%= compid %>"><i class="icon ion-md-trash"></i></a></div>
<% else %>
<% if !Invidious::Database::Compilations.exists?(compilation.id) %>
<div class="pure-u-1-3"><a href="/delete_compilation?list=<%= compid %>"><i class="icon ion-md-trash"></i></a></div>
<% end %>
<% end %>
<div class="pure-u-1-3"><a href="/feed/playlist/<%= plid %>"><i class="icon ion-logo-rss"></i></a></div>
</div>
</h3>
</div>
</div>

View File

@ -165,7 +165,7 @@
</div>
<% if env.get?("user") %>
<% feed_options = {"", "Popular", "Trending", "Subscriptions", "Playlists"} %>
<% feed_options = {"", "Popular", "Trending", "Subscriptions", "Playlists", "Compilations"} %>
<% else %>
<% feed_options = {"", "Popular", "Trending"} %>
<% end %>