mirror of
https://github.com/iv-org/invidious
synced 2024-11-27 21:43:28 +01:00
HTML: Use the new pagination component for playlists
This commit is contained in:
parent
77d401cec2
commit
c4ef3bed95
@ -170,6 +170,13 @@ module Invidious::Routes::Playlists
|
||||
|
||||
csrf_token = generate_response(sid, {":edit_playlist"}, HMAC_KEY)
|
||||
|
||||
# Pagination
|
||||
page_nav_html = Frontend::Pagination.nav_numeric(locale,
|
||||
base_url: "/playlist?list=#{playlist.id}",
|
||||
current_page: page,
|
||||
show_next: (videos.size == 100)
|
||||
)
|
||||
|
||||
templated "edit_playlist"
|
||||
end
|
||||
|
||||
@ -252,6 +259,14 @@ module Invidious::Routes::Playlists
|
||||
videos = [] of SearchVideo
|
||||
end
|
||||
|
||||
# Pagination
|
||||
query_encoded = URI.encode_www_form(query.try &.text || "", space_to_plus: true)
|
||||
page_nav_html = Frontend::Pagination.nav_numeric(locale,
|
||||
base_url: "/add_playlist_items?list=#{playlist.id}&q=#{query_encoded}",
|
||||
current_page: page,
|
||||
show_next: (videos.size >= 20)
|
||||
)
|
||||
|
||||
env.set "add_playlist_items", plid
|
||||
templated "add_playlist_items"
|
||||
end
|
||||
@ -427,6 +442,13 @@ module Invidious::Routes::Playlists
|
||||
env.set "remove_playlist_items", plid
|
||||
end
|
||||
|
||||
# Pagination
|
||||
page_nav_html = Frontend::Pagination.nav_numeric(locale,
|
||||
base_url: "/playlist?list=#{playlist.id}",
|
||||
current_page: page,
|
||||
show_next: (page_count != 1 && page < page_count)
|
||||
)
|
||||
|
||||
templated "playlist"
|
||||
end
|
||||
|
||||
|
@ -31,33 +31,5 @@
|
||||
</script>
|
||||
<script src="/js/playlist_widget.js?v=<%= ASSET_COMMIT %>"></script>
|
||||
|
||||
<div class="pure-g">
|
||||
<% videos.each_slice(4) do |slice| %>
|
||||
<% slice.each do |item| %>
|
||||
<%= rendered "components/item" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<script src="/js/watched_indicator.js"></script>
|
||||
|
||||
<% if query %>
|
||||
<%- query_encoded = URI.encode_www_form(query.text, space_to_plus: true) -%>
|
||||
<div class="pure-g h-box">
|
||||
<div class="pure-u-1 pure-u-lg-1-5">
|
||||
<% if query.page > 1 %>
|
||||
<a href="/add_playlist_items?list=<%= plid %>&q=<%= query_encoded %>&page=<%= page - 1 %>">
|
||||
<%= translate(locale, "Previous page") %>
|
||||
</a>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="pure-u-1 pure-u-lg-3-5"></div>
|
||||
<div class="pure-u-1 pure-u-lg-1-5" style="text-align:right">
|
||||
<% if videos.size >= 20 %>
|
||||
<a href="/add_playlist_items?list=<%= plid %>&q=<%= query_encoded %>&page=<%= page + 1 %>">
|
||||
<%= translate(locale, "Next page") %>
|
||||
</a>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<%= rendered "components/items_paginated" %>
|
||||
|
@ -56,28 +56,5 @@
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<div class="pure-g">
|
||||
<% videos.each do |item| %>
|
||||
<%= rendered "components/item" %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<script src="/js/watched_indicator.js"></script>
|
||||
|
||||
<div class="pure-g h-box">
|
||||
<div class="pure-u-1 pure-u-lg-1-5">
|
||||
<% if page > 1 %>
|
||||
<a href="/playlist?list=<%= playlist.id %>&page=<%= page - 1 %>">
|
||||
<%= translate(locale, "Previous page") %>
|
||||
</a>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="pure-u-1 pure-u-lg-3-5"></div>
|
||||
<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 %>
|
||||
</div>
|
||||
</div>
|
||||
<%= rendered "components/items_paginated" %>
|
||||
|
@ -100,28 +100,5 @@
|
||||
<script src="/js/playlist_widget.js?v=<%= ASSET_COMMIT %>"></script>
|
||||
<% end %>
|
||||
|
||||
<div class="pure-g">
|
||||
<% videos.each do |item| %>
|
||||
<%= rendered "components/item" %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<script src="/js/watched_indicator.js"></script>
|
||||
|
||||
<div class="pure-g h-box">
|
||||
<div class="pure-u-1 pure-u-lg-1-5">
|
||||
<% if page > 1 %>
|
||||
<a href="/playlist?list=<%= playlist.id %>&page=<%= page - 1 %>">
|
||||
<%= translate(locale, "Previous page") %>
|
||||
</a>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="pure-u-1 pure-u-lg-3-5"></div>
|
||||
<div class="pure-u-1 pure-u-lg-1-5" style="text-align:right">
|
||||
<% if page_count != 1 && page < page_count %>
|
||||
<a href="/playlist?list=<%= playlist.id %>&page=<%= page + 1 %>">
|
||||
<%= translate(locale, "Next page") %>
|
||||
</a>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<%= rendered "components/items_paginated" %>
|
||||
|
Loading…
Reference in New Issue
Block a user