invidious-copy-2022-08-14/src/invidious/views/playlist.ecr

113 lines
4.5 KiB
Text
Raw Normal View History

2018-08-15 15:22:36 +00:00
<% content_for "header" do %>
<title><%= playlist.title %> - Invidious</title>
<link rel="alternate" type="application/rss+xml" title="RSS" href="/feed/playlist/<%= plid %>" />
2018-08-15 15:22:36 +00:00
<% end %>
<div class="pure-g h-box">
<div class="pure-u-2-3">
<h3><%= playlist.title %></h3>
2019-08-05 23:49:13 +00:00
<% if playlist.is_a? InvidiousPlaylist %>
<b>
<% if playlist.author == user.try &.email %>
<a href="/view_all_playlists"><%= playlist.author %></a> |
<% else %>
<%= playlist.author %> |
<% end %>
<%= translate(locale, "`x` videos", "#{playlist.video_count}") %> |
<%= translate(locale, "Updated `x` ago", recode_date(playlist.updated, locale)) %> |
<% case playlist.as(InvidiousPlaylist).privacy when %>
<% when PlaylistPrivacy::Public %>
<i class="icon ion-md-globe"></i> <%= translate(locale, "Public") %>
<% when PlaylistPrivacy::Unlisted %>
<i class="icon ion-ios-unlock"></i> <%= translate(locale, "Unlisted") %>
<% when PlaylistPrivacy::Private %>
<i class="icon ion-ios-lock"></i> <%= translate(locale, "Private") %>
<% end %>
</b>
<% else %>
<b>
<a href="/channel/<%= playlist.ucid %>"><%= playlist.author %></a> |
<%= translate(locale, "`x` videos", "#{playlist.video_count}") %> |
<%= translate(locale, "Updated `x` ago", recode_date(playlist.updated, locale)) %>
</b>
<% end %>
<% if !playlist.is_a? InvidiousPlaylist %>
<div class="pure-u-2-3">
<a href="https://www.youtube.com/playlist?list=<%= playlist.id %>">
<%= translate(locale, "View playlist on YouTube") %>
</a>
</div>
<% end %>
2018-08-15 15:22:36 +00:00
</div>
2019-05-02 01:03:39 +00:00
<div class="pure-u-1-3" style="text-align:right">
2018-09-17 23:13:24 +00:00
<h3>
2019-08-05 23:49:13 +00:00
<div class="pure-g user-field">
<% if playlist.is_a?(InvidiousPlaylist) && playlist.author == user.try &.email %>
<div class="pure-u-1-3"><a href="/edit_playlist?list=<%= plid %>"><i class="icon ion-md-create"></i></a></div>
<div class="pure-u-1-3"><a href="/delete_playlist?list=<%= plid %>"><i class="icon ion-md-trash"></i></a></div>
<% else %>
<% if PG_DB.query_one?("SELECT id FROM playlists WHERE id = $1", playlist.id, as: String).nil? %>
<div class="pure-u-1-3"><a href="/subscribe_playlist?list=<%= plid %>"><i class="icon ion-md-add"></i></a></div>
<% else %>
<div class="pure-u-1-3"><a href="/delete_playlist?list=<%= plid %>"><i class="icon ion-md-trash"></i></a></div>
<% end %>
2019-08-05 23:49:13 +00:00
<% end %>
<div class="pure-u-1-3"><a href="/feed/playlist/<%= plid %>"><i class="icon ion-logo-rss"></i></a></div>
</div>
2018-09-17 23:13:24 +00:00
</h3>
</div>
2018-08-15 15:22:36 +00:00
</div>
2019-05-02 01:03:39 +00:00
2018-08-15 15:22:36 +00:00
<div class="h-box">
<p><%= playlist.description_html %></p>
2018-08-15 15:22:36 +00:00
</div>
2019-08-05 23:49:13 +00:00
<% if playlist.is_a?(InvidiousPlaylist) && playlist.author == user.try &.email %>
<div class="h-box" style="text-align:right">
<h3>
<a href="/add_playlist_items?list=<%= plid %>"><i class="icon ion-md-add"></i></a>
</h3>
</div>
<% end %>
2019-05-27 19:54:50 +00:00
<div class="h-box">
<hr>
</div>
2019-08-05 23:49:13 +00:00
<% if playlist.is_a?(InvidiousPlaylist) && playlist.author == user.try &.email %>
<script id="playlist_data" type="application/json">
2020-03-29 21:44:45 +00:00
<%=
{
2020-03-29 21:44:45 +00:00
"csrf_token" => URI.encode_www_form(env.get?("csrf_token").try &.as(String) || "")
}.to_pretty_json
%>
2019-08-05 23:49:13 +00:00
</script>
<script src="/js/playlist_widget.js?v=<%= ASSET_COMMIT %>"></script>
2019-08-05 23:49:13 +00:00
<% end %>
2018-08-15 15:22:36 +00:00
<div class="pure-g">
2019-05-02 01:03:39 +00:00
<% videos.each_slice(4) do |slice| %>
<% slice.each do |item| %>
<%= rendered "components/item" %>
<% end %>
2018-08-15 15:22:36 +00:00
<% end %>
</div>
2018-08-15 15:22:36 +00:00
<div class="pure-g h-box">
2019-04-14 22:04:52 +00:00
<div class="pure-u-1 pure-u-lg-1-5">
2019-06-08 21:04:55 +00:00
<% if page > 1 %>
2019-05-02 01:03:39 +00:00
<a href="/playlist?list=<%= playlist.id %>&page=<%= page - 1 %>">
<%= translate(locale, "Previous page") %>
</a>
<% end %>
2018-08-15 15:22:36 +00:00
</div>
2019-04-14 22:04:52 +00:00
<div class="pure-u-1 pure-u-lg-3-5"></div>
2019-05-02 01:03:39 +00:00
<div class="pure-u-1 pure-u-lg-1-5" style="text-align:right">
<% if videos.size == 100 %>
<a href="/playlist?list=<%= playlist.id %>&page=<%= page + 1 %>">
<%= translate(locale, "Next page") %>
</a>
<% end %>
2018-08-15 15:22:36 +00:00
</div>
2018-08-17 16:04:38 +00:00
</div>