From 991f27f75ce0a4381e417a274f08a65c5ddf678b Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Tue, 15 Feb 2022 18:15:58 -0800 Subject: container browse: more polish --- python/fatcat_web/routes.py | 10 ++-- python/fatcat_web/search.py | 4 +- .../templates/container_view_browse.html | 59 ++++++++++++++-------- 3 files changed, 48 insertions(+), 25 deletions(-) (limited to 'python') diff --git a/python/fatcat_web/routes.py b/python/fatcat_web/routes.py index 0f847cca..f229a572 100644 --- a/python/fatcat_web/routes.py +++ b/python/fatcat_web/routes.py @@ -376,7 +376,7 @@ def container_view_browse(ident: str) -> AnyResponse: else: issue = "!issue:*" query_string = f"year:{year} {volume} {issue}" - query_sort = ["first_page", "release_date"] + query_sort = ["first_page", "pages", "release_date"] elif request.args.get("year") and "volume" in request.args: # year, volume specified (no issue); browse-by-page year = int(request.args.get("year")) @@ -386,12 +386,16 @@ def container_view_browse(ident: str) -> AnyResponse: else: volume = "!volume:*" query_string = f"year:{year} {volume}" - query_sort = ["issue", "first_page", "release_date"] + query_sort = ["issue", "first_page", "pages", "release_date"] elif request.args.get("year"): # year specified, not anything else; browse-by-date year = int(request.args.get("year")) query_string = f"year:{year}" query_sort = ["release_date"] + elif request.args.get("volume"): + # volume specified, not anything else; browse-by-page + query_string = f'volume:{request.args["volume"]}' + query_sort = ["issue", "first_page", "pages", "release_date"] else: entity._browse_year_volume_issue = get_elastic_container_browse_year_volume_issue( entity.ident @@ -407,7 +411,7 @@ def container_view_browse(ident: str) -> AnyResponse: # print(query_string) query = ReleaseQuery( q=query_string, - limit=200, + limit=300, offset=0, container_id=ident, fulltext_only=False, diff --git a/python/fatcat_web/search.py b/python/fatcat_web/search.py index 7528c3d4..b48302b0 100644 --- a/python/fatcat_web/search.py +++ b/python/fatcat_web/search.py @@ -110,7 +110,7 @@ def do_container_search(query: GenericQuery, deep_page_limit: int = 2000) -> Sea ) # Sanity checks - limit = min((int(query.limit or 25), 100)) + limit = min((int(query.limit or 25), 300)) offset = max((int(query.offset or 0), 0)) if offset > deep_page_limit: # Avoid deep paging problem. @@ -188,7 +188,7 @@ def do_release_search(query: ReleaseQuery, deep_page_limit: int = 2000) -> Searc search = search.sort(*query.sort) # Sanity checks - limit = min((int(query.limit or 25), 100)) + limit = min((int(query.limit or 25), 300)) offset = max((int(query.offset or 0), 0)) if offset > deep_page_limit: # Avoid deep paging problem. diff --git a/python/fatcat_web/templates/container_view_browse.html b/python/fatcat_web/templates/container_view_browse.html index 6ea06df8..d16502d0 100644 --- a/python/fatcat_web/templates/container_view_browse.html +++ b/python/fatcat_web/templates/container_view_browse.html @@ -35,18 +35,22 @@ {% if volume.volume %} Vol. {{ volume.volume }} + {% else %} + - {% endif %} {% endif %} {% if issue.issue %} - Issue {{ issue.issue }} + Issue {{ issue.issue }} + {% else %} + - {% endif %} - {{ "{:,}".format(issue.count) }} releases + {{ "{:,}".format(issue.count) }} releases {% endfor %} @@ -57,7 +61,7 @@ {% endmacro %} {% macro browse_releases(found) %} -

+

{% if request.args.volume %} Volume {{ request.args.volume }} {%- if request.args.issue %}, Issue {{ request.args.issue }}{% endif -%} @@ -66,25 +70,40 @@ Year {{ request.args.year }} {% endif %}

-
- {% for release_doc in found.results %} -
-
- {% if request.args.volume %} - {% if release_doc.pages %} - {{ release_doc.pages }} + {% if not found.results %} +

No publications found! + {% else %} + + + + + + + {% for release_doc in found.results %} + + + {% endfor %} + +
{% if request.args.volume %}Page(s){% else %}Date{% endif %}Publication
+ {% if request.args.volume %} + {% if release_doc.pages %} + {{ release_doc.pages }} + {% else %} + - + {% endif %} + {% elif release_doc.release_date %} + {{ release_doc.release_date }} {% else %} - {# blank #} + - {% endif %} - {% elif release_doc.release_date %} - {{ release_doc.release_date }} - {% endif %} - -
- {{ entity_macros.release_search_result_row(release_doc, margin_top=False) }} -
- - {% endfor %} +
+ {{ entity_macros.release_search_result_row(release_doc, margin_top=False) }} +
+ {% if found.count_found > found.count_returned %} +

Showing only the first {{ found.count_returned }} out of {{ found.count_found }} releases + {% endif %} +

Back to full listing + {% endif %} {% endmacro %} {% block entity_main %} -- cgit v1.2.3