mirror of
https://git.nadeko.net/Fijxu/invidious.git
synced 2025-12-20 18:08:54 +00:00
HTML: Use the new pagination component for search results
This commit is contained in:
@@ -59,17 +59,21 @@ module Invidious::Routes::Search
|
||||
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: (videos.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
|
||||
@@ -96,11 +100,13 @@ module Invidious::Routes::Search
|
||||
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: (videos.size >= 60)
|
||||
)
|
||||
|
||||
templated "hashtag"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user