diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2022-02-11 12:25:52 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2022-02-11 12:25:52 -0800 |
commit | 526e291f71b4f7018708de61b9e698b0ee9d894c (patch) | |
tree | e152456b01fb5aaae5c884abfca0a3c45adaec9c /python/fatcat_web/templates | |
parent | 9b9ede257753b1e3fd19bbf90a5895de5db18504 (diff) | |
download | fatcat-526e291f71b4f7018708de61b9e698b0ee9d894c.tar.gz fatcat-526e291f71b4f7018708de61b9e698b0ee9d894c.zip |
containers: iterate on browse interface, showing year/volume/issue
Diffstat (limited to 'python/fatcat_web/templates')
-rw-r--r-- | python/fatcat_web/templates/container_view_browse.html | 74 |
1 files changed, 54 insertions, 20 deletions
diff --git a/python/fatcat_web/templates/container_view_browse.html b/python/fatcat_web/templates/container_view_browse.html index aa88b666..f6a74a2d 100644 --- a/python/fatcat_web/templates/container_view_browse.html +++ b/python/fatcat_web/templates/container_view_browse.html @@ -4,25 +4,50 @@ {% import "entity_macros.html" as entity_macros %} {% extends "entity_base.html" %} -{% macro browse_year_volume_table(entity, data) %} +{% macro browse_year_volume_issue_table(entity, data) %} <table class="ui basic compact structured table"> + <thead> + <tr> + <th>Year + <th>Volume + <th>Issue + <th class="right aligned">Indexed Content + </tr> + </thead> <tbody> {% for year in data.keys()|sort|reverse %} + {% set year_loop = loop %} {% for volume in data[year].keys()|sort|reverse %} - <tr> - {% if loop.first %} - <td rowspan="{{ data[year]|length }}" class="top aligned"> - <a href="/container/{{ entity.ident }}/browse?year={{ year }}">{{ year }}</a> - </td> - {% endif %} - {% if volume == '000_unknown' %} - <td>{% if data[year]|length > 1 %}<i>n/a</i>{% endif %}</td> - <td><a href="/container/{{ entity.ident }}/browse?year={{ year }}&volume=">{{ data[year][volume] }} releases</a> - {% else %} - <td><a href="/container/{{ entity.ident }}/browse?volume={{ volume }}">Vol. {{ volume }}</a></td> - <td><a href="/container/{{ entity.ident }}/browse?year={{ year }}&volume={{ volume }}">{{ data[year][volume] }} releases</a> - {% endif %} - </tr> + {% set volume_loop = loop %} + {% for issue in data[year][volume].keys()|sort|reverse %} + {% set issue_loop = loop %} + <tr> + {% if volume_loop.first and issue_loop.first %} + {% set year_rowspan = data[year].values()|map('length')|sum %} + <td rowspan="{{ year_rowspan }}" class="top aligned"> + <a href="/container/{{ entity.ident }}/browse?year={{ year }}">{{ year }}</a> + </td> + {% endif %} + + {% if issue_loop.first %} + <td rowspan="{{ data[year][volume]|length }}" class="top aligned"> + {% if volume != '000_unknown' %} + <a href="/container/{{ entity.ident }}/browse?volume={{ volume }}">Vol. {{ volume }}</a> + {% endif %} + </td> + {% endif %} + + <td> + {% if issue != '000_unknown' %} + <a href="/container/{{ entity.ident }}/browse?year={{ year }}&volume={{ volume }}&issue={{ issue }}">Issue {{ issue }}</a> + {% endif %} + </td> + + <td class="right aligned"> + <a href="/container/{{ entity.ident }}/browse?year={{ year }}&volume={{ volume }}&issue={{ issue }}">{{ data[year][volume][issue] }} releases</a> + </td> + </tr> + {% endfor %} {% endfor %} {% endfor %} </tbody> @@ -30,15 +55,24 @@ {% endmacro %} {% macro browse_releases(found) %} + <h2> + Browsing: + {% if request.args.volume %}Volume {{ request.args.volume }} {% endif %} + {% if request.args.issue %}Issue {{ request.args.issue }} {% endif %} + {% if request.args.year %}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 release_doc.pages %} - {{ release_doc.pages }} - {# + {% if request.args.volume %} + {% if release_doc.pages %} + {{ release_doc.pages }} + {% else %} + {# blank #} + {% endif %} {% elif release_doc.release_date %} {{ release_doc.release_date }} - #} {% endif %} </div> <div class="fourteen wide column"> @@ -55,7 +89,7 @@ {% elif entity._browse_volume_year %} <div class="ui container text"> <h3>Contents by Year and Volume</h3> - {{ browse_year_volume_table(entity, entity._browse_volume_year) }} + {{ browse_year_volume_issue_table(entity, entity._browse_volume_year) }} </div> {% endif %} |