From 123d0bfa2ec9a74073364f2c4169042948ea7308 Mon Sep 17 00:00:00 2001 From: h3ri0s Date: Fri, 4 Oct 2024 00:43:01 +0530 Subject: [PATCH 1/4] feat: UX change in Author Page --- openlibrary/templates/type/author/view.html | 40 ++++++++++++--------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/openlibrary/templates/type/author/view.html b/openlibrary/templates/type/author/view.html index 2c42e86c041..a6291406d2c 100644 --- a/openlibrary/templates/type/author/view.html +++ b/openlibrary/templates/type/author/view.html @@ -118,25 +118,31 @@

$ungettext("%(count)d work", "%(count)d works", books_count, count=books_count) $_('Add another?')

+
+ + $if (query_param('sort')): + + $if (query_param('mode')): + + $:render_template("search/searchbox", q=query_param('q'), placeholder=_('Search %(author)s books', author=title)) +
+ + $if books_count > 1: -
- $:render_template("search/sort_options.html", books.sort, exclude='relevance', default_sort='editions') -
-

- $if input(mode="everything").mode == "everything": - $:_('Showing all works by author. Would you like to see only ebooks?', url=changequery(mode='ebooks')) - $else: - $:_('Showing ebooks only. Would you like to see everything by this author?', url=changequery(mode='everything')) -

+
+
+ + $:render_template("search/sort_options.html", books.sort, exclude='relevance', default_sort='editions') +
+ + + $if input(mode="everything").mode == "everything": + $:_('— Show only ebooks?', url=changequery(mode='ebooks')) + $else: + $:_('-- Showing ebooks only. Would you like to see everything by this author?', url=changequery(mode='everything')) + +
-
- - $if (query_param('sort')): - - $if (query_param('mode')): - - $:render_template("search/searchbox", q=query_param('q'), placeholder=_('Search %(author)s books', author=title)) -
$:macros.Pager(page=safeint(query_param('page'), default=1), num_found=books_count) From d9850430012d12cea40952cdeba73787b2c700f4 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 3 Oct 2024 19:41:37 +0000 Subject: [PATCH 2/4] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- openlibrary/i18n/messages.pot | 12 +++++------- openlibrary/templates/type/author/view.html | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/openlibrary/i18n/messages.pot b/openlibrary/i18n/messages.pot index 4d67d3b642c..8a81ab2bd4f 100644 --- a/openlibrary/i18n/messages.pot +++ b/openlibrary/i18n/messages.pot @@ -6504,21 +6504,19 @@ msgstr "" #: type/author/view.html #, python-format -msgid "" -"Showing all works by author. Would you like to see only ebooks?" +msgid "Search %(author)s books" msgstr "" #: type/author/view.html #, python-format -msgid "" -"Showing ebooks only. Would you like to see everything by this author?" +msgid "— Show only ebooks?" msgstr "" #: type/author/view.html #, python-format -msgid "Search %(author)s books" +msgid "" +"-- Showing ebooks only. Would you like to see everything by this author?" msgstr "" #: RelatedSubjects.html SubjectTags.html type/author/view.html diff --git a/openlibrary/templates/type/author/view.html b/openlibrary/templates/type/author/view.html index a6291406d2c..042908e0595 100644 --- a/openlibrary/templates/type/author/view.html +++ b/openlibrary/templates/type/author/view.html @@ -134,7 +134,7 @@

$:render_template("search/sort_options.html", books.sort, exclude='relevance', default_sort='editions') - + $if input(mode="everything").mode == "everything": $:_('— Show only ebooks?', url=changequery(mode='ebooks')) From 37e2c600914c886727365c546e66fc89bec09ddb Mon Sep 17 00:00:00 2001 From: h3ri0s Date: Fri, 4 Oct 2024 08:01:23 +0530 Subject: [PATCH 3/4] fix missing i18 reference issue --- openlibrary/templates/type/author/view.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlibrary/templates/type/author/view.html b/openlibrary/templates/type/author/view.html index 042908e0595..c5b04c66f07 100644 --- a/openlibrary/templates/type/author/view.html +++ b/openlibrary/templates/type/author/view.html @@ -131,7 +131,7 @@

$if books_count > 1:
- + $:render_template("search/sort_options.html", books.sort, exclude='relevance', default_sort='editions')
From 35a048a6f7bd5be15525773dff4524836917ece4 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 4 Oct 2024 02:33:00 +0000 Subject: [PATCH 4/4] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- openlibrary/i18n/messages.pot | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/openlibrary/i18n/messages.pot b/openlibrary/i18n/messages.pot index 8a81ab2bd4f..eb406c928c1 100644 --- a/openlibrary/i18n/messages.pot +++ b/openlibrary/i18n/messages.pot @@ -6507,6 +6507,10 @@ msgstr "" msgid "Search %(author)s books" msgstr "" +#: type/author/view.html +msgid "Sort by: " +msgstr "" + #: type/author/view.html #, python-format msgid "— Show only ebooks?"