mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-08-14.git
synced 2024-08-15 00:53:20 +00:00
Hide playlist widget when user has no playlists
This commit is contained in:
parent
61150c74d2
commit
408f3852ec
1 changed files with 24 additions and 21 deletions
|
@ -102,28 +102,31 @@
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<% if user %>
|
<% if user %>
|
||||||
<form data-onsubmit="return_false" class="pure-form pure-form-stacked" action="/playlist_ajax" method="post">
|
<% playlists = PG_DB.query_all("SELECT id,title FROM playlists WHERE author = $1", user.email, as: {String, String}) %>
|
||||||
<div class="pure-control-group">
|
<% if !playlists.empty? %>
|
||||||
<label for="playlist_id"><%= translate(locale, "Add to playlist: ") %></label>
|
<form data-onsubmit="return_false" class="pure-form pure-form-stacked" action="/playlist_ajax" method="post">
|
||||||
<select style="width:100%" name="playlist_id" id="playlist_id">
|
<div class="pure-control-group">
|
||||||
<% PG_DB.query_all("SELECT id,title FROM playlists WHERE author = $1", user.email, as: {String, String}).each do |plid, title| %>
|
<label for="playlist_id"><%= translate(locale, "Add to playlist: ") %></label>
|
||||||
<option data-plid="<%= plid %>" value="<%= plid %>"><%= title %></option>
|
<select style="width:100%" name="playlist_id" id="playlist_id">
|
||||||
<% end %>
|
<% playlists.each do |plid, title| %>
|
||||||
</select>
|
<option data-plid="<%= plid %>" value="<%= plid %>"><%= title %></option>
|
||||||
</div>
|
<% end %>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
<button data-onclick="add_playlist_video" data-id="<%= video.id %>" type="submit" class="pure-button pure-button-primary">
|
<button data-onclick="add_playlist_video" data-id="<%= video.id %>" type="submit" class="pure-button pure-button-primary">
|
||||||
<b><%= translate(locale, "Add to playlist") %></b>
|
<b><%= translate(locale, "Add to playlist") %></b>
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
<script id="playlist_data" type="application/json">
|
<script id="playlist_data" type="application/json">
|
||||||
<%=
|
<%=
|
||||||
{
|
{
|
||||||
"csrf_token" => URI.encode_www_form(env.get?("csrf_token").try &.as(String) || "")
|
"csrf_token" => URI.encode_www_form(env.get?("csrf_token").try &.as(String) || "")
|
||||||
}.to_pretty_json
|
}.to_pretty_json
|
||||||
%>
|
%>
|
||||||
</script>
|
</script>
|
||||||
<script src="/js/playlist_widget.js?v=<%= Time.utc.to_unix_ms %>"></script>
|
<script src="/js/playlist_widget.js?v=<%= Time.utc.to_unix_ms %>"></script>
|
||||||
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if CONFIG.dmca_content.includes?(video.id) || CONFIG.disabled?("downloads") %>
|
<% if CONFIG.dmca_content.includes?(video.id) || CONFIG.disabled?("downloads") %>
|
||||||
|
|
Loading…
Reference in a new issue