diff options
-rw-r--r-- | python/fatcat_web/routes.py | 10 | ||||
-rw-r--r-- | python/fatcat_web/search.py | 4 | ||||
-rw-r--r-- | python/fatcat_web/templates/container_view_browse.html | 59 |
3 files changed, 48 insertions, 25 deletions
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 @@ <td rowspan="{{ volume.issues|length }}" class="top aligned"> {% if volume.volume %} <a href="/container/{{ entity.ident }}/browse?volume={{ volume.volume }}">Vol. {{ volume.volume }}</a> + {% else %} + - {% endif %} </td> {% endif %} <td> {% if issue.issue %} - <a href="/container/{{ entity.ident }}/browse?year={{ year.year }}{% if volume.volume %}&volume={{ volume.volume }}{% endif %}&issue={{ issue.issue }}">Issue {{ issue.issue }}</a> + <a href="/container/{{ entity.ident }}/browse?year={{ year.year }}&volume={{ volume.volume or '' }}&issue={{ issue.issue or '' }}">Issue {{ issue.issue }}</a> + {% else %} + - {% endif %} </td> <td class="right aligned"> - <a href="/container/{{ entity.ident }}/browse?year={{ year.year }}{% if volume.volume %}&volume={{ volume.volume }}{% endif %}{% if issue.issue %}&issue={{ issue.issue }}{% endif %}">{{ "{:,}".format(issue.count) }} releases</a> + <a href="/container/{{ entity.ident }}/browse?year={{ year.year }}&volume={{ volume.volume or '' }}&issue={{ issue.issue or '' }}">{{ "{:,}".format(issue.count) }} releases</a> </td> </tr> {% endfor %} @@ -57,7 +61,7 @@ {% endmacro %} {% macro browse_releases(found) %} - <h2> + <h2 style="margin-bottom: 1em;"> {% 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 %} </h2> - <br> - {% for release_doc in found.results %} - <div class="ui grid"> - <div class="two wide center aligned column"> - {% if request.args.volume %} - {% if release_doc.pages %} - {{ release_doc.pages }} + {% if not found.results %} + <p><i>No publications found!</i> + {% else %} + <table class="ui very basic compact structured table"> + <thead> + <tr><th class="one wide center aligned">{% if request.args.volume %}Page(s){% else %}Date{% endif %}</th> + <th class="nine wide">Publication</th> + </thead> + <tbody> + {% for release_doc in found.results %} + <tr><td class="center aligned"> + {% 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 %} - </div> - <div class="fourteen wide column"> - {{ entity_macros.release_search_result_row(release_doc, margin_top=False) }} - </div> - </div> - {% endfor %} + </td> + <td> + {{ entity_macros.release_search_result_row(release_doc, margin_top=False) }} + </td> + {% endfor %} + </tbody> + </table> + {% if found.count_found > found.count_returned %} + <p><i>Showing only the first {{ found.count_returned }} out of {{ found.count_found }} releases</i> + {% endif %} + <p><i><a href="/container/{{ entity.ident }}/browse">Back to full listing</a></i> + {% endif %} {% endmacro %} {% block entity_main %} |