aboutsummaryrefslogtreecommitdiffstats
path: root/python/fatcat_web/templates/container_view_browse.html
blob: aa88b666506d18be0ae53acb4b3a25d1f0bcfe8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
{% 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_table(entity, data) %}
<table class="ui basic compact structured table">
  <tbody>
  {% for year in data.keys()|sort|reverse %}
    {% 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>
    {% endfor %}
  {% endfor %}
  </tbody>
</table>
{% endmacro %}

{% macro browse_releases(found) %}
  {% for release_doc in found.results %}
    <div class="ui grid">
      <div class="two wide center aligned column">
        {% if release_doc.pages %}
          {{ release_doc.pages }}
        {#
        {% 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 %}
{% endmacro %}

{% block entity_main %}

{% if releases_found %}
  {{ browse_releases(releases_found) }}
{% 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) }}
  </div>
{% endif %}

{% endblock %}