mirror of
https://git.nadeko.net/Fijxu/invidious.git
synced 2025-12-20 18:08:54 +00:00
UI: Nicer buttons (#3763)
This commit is contained in:
@@ -102,6 +102,10 @@ module Invidious::Routes::Feeds
|
||||
end
|
||||
env.set "user", user
|
||||
|
||||
# Used for pagination links
|
||||
base_url = "/feed/subscriptions"
|
||||
base_url += "?max_results=#{max_results}" if env.params.query.has_key?("max_results")
|
||||
|
||||
templated "feeds/subscriptions"
|
||||
end
|
||||
|
||||
@@ -129,6 +133,10 @@ module Invidious::Routes::Feeds
|
||||
end
|
||||
watched ||= [] of String
|
||||
|
||||
# Used for pagination links
|
||||
base_url = "/feed/history"
|
||||
base_url += "?max_results=#{max_results}" if env.params.query.has_key?("max_results")
|
||||
|
||||
templated "feeds/history"
|
||||
end
|
||||
|
||||
|
||||
@@ -163,13 +163,20 @@ module Invidious::Routes::Playlists
|
||||
end
|
||||
|
||||
begin
|
||||
videos = get_playlist_videos(playlist, offset: (page - 1) * 100)
|
||||
items = get_playlist_videos(playlist, offset: (page - 1) * 100)
|
||||
rescue ex
|
||||
videos = [] of PlaylistVideo
|
||||
items = [] of PlaylistVideo
|
||||
end
|
||||
|
||||
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: (items.size == 100)
|
||||
)
|
||||
|
||||
templated "edit_playlist"
|
||||
end
|
||||
|
||||
@@ -247,11 +254,19 @@ module Invidious::Routes::Playlists
|
||||
|
||||
begin
|
||||
query = Invidious::Search::Query.new(env.params.query, :playlist, region)
|
||||
videos = query.process.select(SearchVideo).map(&.as(SearchVideo))
|
||||
items = query.process.select(SearchVideo).map(&.as(SearchVideo))
|
||||
rescue ex
|
||||
videos = [] of SearchVideo
|
||||
items = [] 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: (items.size >= 20)
|
||||
)
|
||||
|
||||
env.set "add_playlist_items", plid
|
||||
templated "add_playlist_items"
|
||||
end
|
||||
@@ -418,7 +433,7 @@ module Invidious::Routes::Playlists
|
||||
end
|
||||
|
||||
begin
|
||||
videos = get_playlist_videos(playlist, offset: (page - 1) * 200)
|
||||
items = get_playlist_videos(playlist, offset: (page - 1) * 200)
|
||||
rescue ex
|
||||
return error_template(500, "Error encountered while retrieving playlist videos.<br>#{ex.message}")
|
||||
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
|
||||
|
||||
|
||||
@@ -52,24 +52,28 @@ module Invidious::Routes::Search
|
||||
user = env.get? "user"
|
||||
|
||||
begin
|
||||
videos = query.process
|
||||
items = query.process
|
||||
rescue ex : ChannelSearchException
|
||||
return error_template(404, "Unable to find channel with id of '#{HTML.escape(ex.channel)}'. Are you sure that's an actual channel id? It should look like 'UC4QobU6STFB0P71PMvOGN5A'.")
|
||||
rescue ex
|
||||
return error_template(500, ex)
|
||||
end
|
||||
|
||||
params = query.to_http_params
|
||||
url_prev_page = "/search?#{params}&page=#{query.page - 1}"
|
||||
url_next_page = "/search?#{params}&page=#{query.page + 1}"
|
||||
|
||||
redirect_url = Invidious::Frontend::Misc.redirect_url(env)
|
||||
|
||||
# Pagination
|
||||
page_nav_html = Frontend::Pagination.nav_numeric(locale,
|
||||
base_url: "/search?#{query.to_http_params}",
|
||||
current_page: query.page,
|
||||
show_next: (items.size >= 20)
|
||||
)
|
||||
|
||||
if query.type == Invidious::Search::Query::Type::Channel
|
||||
env.set "search", "channel:#{query.channel} #{query.text}"
|
||||
else
|
||||
env.set "search", query.text
|
||||
end
|
||||
|
||||
templated "search"
|
||||
end
|
||||
end
|
||||
@@ -91,16 +95,18 @@ module Invidious::Routes::Search
|
||||
end
|
||||
|
||||
begin
|
||||
videos = Invidious::Hashtag.fetch(hashtag, page)
|
||||
items = Invidious::Hashtag.fetch(hashtag, page)
|
||||
rescue ex
|
||||
return error_template(500, ex)
|
||||
end
|
||||
|
||||
params = env.params.query.empty? ? "" : "&#{env.params.query}"
|
||||
|
||||
# Pagination
|
||||
hashtag_encoded = URI.encode_www_form(hashtag, space_to_plus: false)
|
||||
url_prev_page = "/hashtag/#{hashtag_encoded}?page=#{page - 1}#{params}"
|
||||
url_next_page = "/hashtag/#{hashtag_encoded}?page=#{page + 1}#{params}"
|
||||
page_nav_html = Frontend::Pagination.nav_numeric(locale,
|
||||
base_url: "/hashtag/#{hashtag_encoded}",
|
||||
current_page: page,
|
||||
show_next: (items.size >= 60)
|
||||
)
|
||||
|
||||
templated "hashtag"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user