summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRadoslavL <rlelchev@abv.bg>2023-09-27 11:28:47 +0300
committerRadoslavL <rlelchev@abv.bg>2023-09-27 11:28:47 +0300
commit905582db6684233645a05bca0094b597499cbbbb (patch)
tree939b51c831715569ec83423def3de5041dd20601
parentbb14f794969f62582917a39c2dd57bf92fa146a7 (diff)
downloadinvidious-905582db6684233645a05bca0094b597499cbbbb.tar.gz
invidious-905582db6684233645a05bca0094b597499cbbbb.tar.bz2
invidious-905582db6684233645a05bca0094b597499cbbbb.zip
Added a first page button
-rw-r--r--locales/de.json1
-rw-r--r--locales/en-US.json1
-rw-r--r--locales/ru.json1
-rw-r--r--src/invidious/frontend/pagination.cr19
-rw-r--r--src/invidious/views/channel.ecr3
5 files changed, 22 insertions, 3 deletions
diff --git a/locales/de.json b/locales/de.json
index 6ceaa44b..309d1e49 100644
--- a/locales/de.json
+++ b/locales/de.json
@@ -11,6 +11,7 @@
"last": "neueste",
"Next page": "Nächste Seite",
"Previous page": "Vorherige Seite",
+ "First page": "Erste Seite",
"Clear watch history?": "Verlauf löschen?",
"New password": "Neues Passwort",
"New passwords must match": "Neue Passwörter müssen übereinstimmen",
diff --git a/locales/en-US.json b/locales/en-US.json
index 06d095dc..b8264bc4 100644
--- a/locales/en-US.json
+++ b/locales/en-US.json
@@ -28,6 +28,7 @@
"last": "last",
"Next page": "Next page",
"Previous page": "Previous page",
+ "First page": "First page",
"Clear watch history?": "Clear watch history?",
"New password": "New password",
"New passwords must match": "New passwords must match",
diff --git a/locales/ru.json b/locales/ru.json
index 5325a9b6..ec615fac 100644
--- a/locales/ru.json
+++ b/locales/ru.json
@@ -11,6 +11,7 @@
"last": "недавние",
"Next page": "Следующая страница",
"Previous page": "Предыдущая страница",
+ "First page": "Первая страница",
"Clear watch history?": "Очистить историю просмотров?",
"New password": "Новый пароль",
"New passwords must match": "Новые пароли не совпадают",
diff --git a/src/invidious/frontend/pagination.cr b/src/invidious/frontend/pagination.cr
index 3f931f4e..85e588ff 100644
--- a/src/invidious/frontend/pagination.cr
+++ b/src/invidious/frontend/pagination.cr
@@ -3,6 +3,15 @@ require "uri"
module Invidious::Frontend::Pagination
extend self
+ private def first_page(str : String::Builder, locale : String?, url : String)
+ str << %(<a href=") << url << %(" class="pure-button pure-button-secondary">)
+
+ str << translate(locale, "First page")
+ str << "&nbsp;&nbsp;"
+ str << %(<i class="icon ion-ios-arrow-back"></i>)
+ str << "</a>"
+ end
+
private def previous_page(str : String::Builder, locale : String?, url : String)
# Link
str << %(<a href=") << url << %(" class="pure-button pure-button-secondary">)
@@ -72,12 +81,18 @@ module Invidious::Frontend::Pagination
end
end
- def nav_ctoken(locale : String?, *, base_url : String | URI, ctoken : String?)
+ def nav_ctoken(locale : String?, *, base_url : String | URI, ctoken : String?, first_page : String?)
return String.build do |str|
str << %(<div class="h-box">\n)
str << %(<div class="page-nav-container flexible">\n)
- str << %(<div class="page-prev-container flex-left"></div>\n)
+ str << %(<div class="page-prev-container flex-left">)
+
+ if !first_page.nil?
+ self.first_page(str, locale, base_url.to_s)
+ end
+
+ str << %(</div>\n)
str << %(<div class="page-next-container flex-right">)
diff --git a/src/invidious/views/channel.ecr b/src/invidious/views/channel.ecr
index 09df106d..7625a152 100644
--- a/src/invidious/views/channel.ecr
+++ b/src/invidious/views/channel.ecr
@@ -20,7 +20,8 @@
page_nav_html = IV::Frontend::Pagination.nav_ctoken(locale,
base_url: relative_url,
- ctoken: next_continuation
+ ctoken: next_continuation,
+ first_page: continuation
)
%>