aboutsummaryrefslogtreecommitdiffstats
path: root/python/fatcat_web/templates/container_view_browse.html
blob: f6a74a2df32b7a458d2df22a3119456bac1227bd (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
{% 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>
  {% for year in data.keys()|sort|reverse %}
    {% set year_loop = loop %}
    {% for volume in data[year].keys()|sort|reverse %}
      {% 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>
</table>
{% endmacro %}

{% macro browse_releases(found) %}
  <h2>
    Browsing: 
    {% if request.args.volume %}Volume {{ request.args.volume }} &nbsp;{% endif %}
    {% if request.args.issue %}Issue {{ request.args.issue }} &nbsp;{% endif %}
    {% if request.args.year %}Year {{ request.args.year }} &nbsp;{% 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 }}
          {% 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 %}
{% 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_issue_table(entity, entity._browse_volume_year) }}
  </div>
{% endif %}

{% endblock %}