aboutsummaryrefslogtreecommitdiffstats
path: root/python/fatcat_web/templates/container_view_browse.html
blob: a2ad251b9f3d6555cd28a14a52ef6c79b1b1c5dc (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
98
99
100
101
102
{% 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.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 }}{% if volume != '000_unknown' %}&volume={{ volume }}{% endif %}&issue={{ issue }}">Issue {{ issue }}</a>
            {% endif %}
          </td>

          <td class="right aligned">
            <a href="/container/{{ entity.ident }}/browse?year={{ year }}{% if volume != '000_unknown' %}&volume={{ volume }}{% endif %}{% if issue != '000_unknown' %}&issue={{ issue }}{% endif %}">{{ "{:,}".format(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>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_volume_year) }}
  </div>
{% endif %}

{% endblock %}