Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: UX change in Author Page #9934

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions openlibrary/i18n/messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -6504,21 +6504,23 @@ msgstr ""

#: type/author/view.html
#, python-format
msgid ""
"Showing all works by author. Would you like to see <a "
"href=\"%(url)s\">only ebooks</a>?"
msgid "Search %(author)s books"
msgstr ""

#: type/author/view.html
msgid "Sort by: "
msgstr ""

#: type/author/view.html
#, python-format
msgid ""
"Showing ebooks only. Would you like to see <a "
"href=\"%(url)s\">everything</a> by this author?"
msgid "— Show <a href=\"%(url)s\">only ebooks</a>?"
msgstr ""

#: type/author/view.html
#, python-format
msgid "Search %(author)s books"
msgid ""
"-- Showing ebooks only. Would you like to see <a "
"href=\"%(url)s\">everything</a> by this author?"
msgstr ""

#: RelatedSubjects.html SubjectTags.html type/author/view.html
Expand Down
40 changes: 23 additions & 17 deletions openlibrary/templates/type/author/view.html
Original file line number Diff line number Diff line change
Expand Up @@ -118,25 +118,31 @@ <h2 class="collapse">
$ungettext("%(count)d work", "%(count)d works", books_count, count=books_count)
<span class="count smaller"><a href="/books/add?author=$page.key">$_('Add another?')</a></span>
</h2>
<form method="GET" class="olform pagesearchbox">
<input type="hidden" name="has_fulltext" value="true"/>
$if (query_param('sort')):
<input type="hidden" name="sort" value="$query_param('sort')"/>
$if (query_param('mode')):
<input type="hidden" name="mode" value="$query_param('mode')"/>
$:render_template("search/searchbox", q=query_param('q'), placeholder=_('Search %(author)s books', author=title))
</form>


$if books_count > 1:
<div id="books">
$:render_template("search/sort_options.html", books.sort, exclude='relevance', default_sort='editions')
</div>
<p>
$if input(mode="everything").mode == "everything":
$:_('Showing all works by author. Would you like to see <a href="%(url)s">only ebooks</a>?', url=changequery(mode='ebooks'))
$else:
$:_('Showing ebooks only. Would you like to see <a href="%(url)s">everything</a> by this author?', url=changequery(mode='everything'))
</p>
<div style="display: flex; align-items: center;">
<div style="margin-right: 15px; margin-top:10px ">
Comment on lines +132 to +133
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please avoid inline styles :)

<label for="sortOptions">$_('Sort by: ')</label>
$:render_template("search/sort_options.html", books.sort, exclude='relevance', default_sort='editions')
</div>

<span style="margin-top:10px">
$if input(mode="everything").mode == "everything":
$:_('— Show <a href="%(url)s">only ebooks</a>?', url=changequery(mode='ebooks'))
$else:
$:_('-- Showing ebooks only. Would you like to see <a href="%(url)s">everything</a> by this author?', url=changequery(mode='everything'))
</span>
</div>

<form method="GET" class="olform pagesearchbox">
<input type="hidden" name="has_fulltext" value="true"/>
$if (query_param('sort')):
<input type="hidden" name="sort" value="$query_param('sort')"/>
$if (query_param('mode')):
<input type="hidden" name="mode" value="$query_param('mode')"/>
$:render_template("search/searchbox", q=query_param('q'), placeholder=_('Search %(author)s books', author=title))
</form>

$:macros.Pager(page=safeint(query_param('page'), default=1), num_found=books_count)

Expand Down
Loading