aboutsummaryrefslogtreecommitdiffstats
path: root/python/fatcat_web/templates/container_view_browse.html
diff options
context:
space:
mode:
authorbnewbold <bnewbold@archive.org>2022-03-10 00:08:11 +0000
committerbnewbold <bnewbold@archive.org>2022-03-10 00:08:11 +0000
commite4cbe43692a9c26911ea54ee88d7df0980e1d9fe (patch)
tree66090d73714ed043bf6eec608aebe136704320c7 /python/fatcat_web/templates/container_view_browse.html
parent72e3825893ae614fcd6c6ae8a513745bfefe36b2 (diff)
parentf9b69d0b4343403ecf9318dc6d66725f6144edad (diff)
downloadfatcat-e4cbe43692a9c26911ea54ee88d7df0980e1d9fe.tar.gz
fatcat-e4cbe43692a9c26911ea54ee88d7df0980e1d9fe.zip
Merge branch 'bnewbold-container-web' into 'master'
container web interface improvements See merge request webgroup/fatcat!140
Diffstat (limited to 'python/fatcat_web/templates/container_view_browse.html')
-rw-r--r--python/fatcat_web/templates/container_view_browse.html124
1 files changed, 124 insertions, 0 deletions
diff --git a/python/fatcat_web/templates/container_view_browse.html b/python/fatcat_web/templates/container_view_browse.html
new file mode 100644
index 00000000..d16502d0
--- /dev/null
+++ b/python/fatcat_web/templates/container_view_browse.html
@@ -0,0 +1,124 @@
+{% set container = entity %}
+{% set entity_view = "browse" %}
+{% set entity_type = "container" %}
+{% import "entity_macros.html" as entity_macros %}
+{% extends "entity_base.html" %}
+
+{% 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>
+ {# NOTE: this section is pretty nested, with complex behavior; it could be hard to edit and understand #}
+ {# TODO: these "sorts" are lexical, not numeric, which causes problems #}
+ {% for year in data %}
+ {% set year_loop = loop %}
+ {% for volume in year.volumes %}
+ {% set volume_loop = loop %}
+ {% for issue in volume.issues %}
+ {% set issue_loop = loop %}
+ <tr>
+ {% if volume_loop.first and issue_loop.first %}
+ {% set year_rowspan = year.volumes|map(attribute='issues')|map('length')|sum %}
+ <td rowspan="{{ year_rowspan }}" class="top aligned">
+ <a href="/container/{{ entity.ident }}/browse?year={{ year.year }}">{{ year.year }}</a>
+ </td>
+ {% endif %}
+
+ {% if issue_loop.first %}
+ <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 }}&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 }}&volume={{ volume.volume or '' }}&issue={{ issue.issue or '' }}">{{ "{:,}".format(issue.count) }} releases</a>
+ </td>
+ </tr>
+ {% endfor %}
+ {% endfor %}
+ {% endfor %}
+ </tbody>
+</table>
+{% endmacro %}
+
+{% macro browse_releases(found) %}
+ <h2 style="margin-bottom: 1em;">
+ {% if request.args.volume %}
+ Volume {{ request.args.volume }}
+ {%- if request.args.issue %}, Issue {{ request.args.issue }}{% endif -%}
+ {%- if request.args.year %} ({{ request.args.year }}){% endif %}
+ {% else %}
+ Year {{ request.args.year }}
+ {% endif %}
+ </h2>
+ {% 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 %}
+ -
+ {% endif %}
+ </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 %}
+
+{% if releases_found %}
+ {{ browse_releases(releases_found) }}
+{% elif entity._browse_year_volume_issue %}
+ <div class="ui container text">
+ <h3>Publications by Year, Volume, and Issue</h3>
+ <p>This table includes content which does not have article-level metadata
+ about volume or issue, but at least the year of publication must be known.
+ "Stub" releases (eg, spam or duplicate DOIs) are not listed.
+ {{ browse_year_volume_issue_table(entity, entity._browse_year_volume_issue) }}
+ </div>
+{% endif %}
+
+{% endblock %}
+