aboutsummaryrefslogtreecommitdiffstats
path: root/python/fatcat_web/templates/entity_macros.html
blob: 8f1706ae2be20cd4f3ed3def591ae926b1268261 (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

{% macro fatcat_bits(entity, entity_type, expand="") -%}
<div class="ui segment attached">
  <b>Fatcat Bits</b>
  <p>State is "{{ entity.state }}".
  {% if entity.state != "deleted" %}
    Revision:
    <br><small><code>{{ entity.revision }}</code></small>
  {% endif %}
  <br><a href="https://api.{{ config.FATCAT_DOMAIN }}/v0/{{ entity_type }}/{{ entity.ident }}{% if expand %}?expand={{ expand}}{% endif %}">As JSON object via API</a>
</div>

<div class="two ui buttons bottom attached">
  <a href="/{{ entity_type }}/{{ entity.ident }}/edit" class="ui blue button">Edit Metadata</a>
  <a href="/{{ entity_type }}/{{ entity.ident }}/history" class="ui button">View History</a>
</div>
{%- endmacro %}


{% macro extra_metadata(extra) -%}
<h3>Extra Metadata (raw JSON)</h3>
<table class="ui definition single line fixed compact small unstackable table">
<tbody>
{% for (key, value) in extra.items() %}
  {% if key in ("ia", "crossref", "kbart") and value is mapping and value %}
    {% for (inner_key, inner_value) in value.items() %}
      <tr><td class="three wide right aligned"><code>{{ key }}.{{ inner_key }}</code></td>
          <td class="seven wide"><code>{{ inner_value }}</code>
    {% endfor %}
  {% else %}
    <tr><td class="three wide right aligned"><code>{{ key }}</code></td>
        <td class="seven wide"><code>{{ value }}</code>
  {% endif %}
{% endfor %}
</tbody>
</table>
{%- endmacro %}


{% macro release_list(releases) -%}
<table class="ui very basic celled table">
<tbody>
{% for release in releases %}
  <tr><td class="collapsing center aligned">
        {% if release.release_date %}{{ release.release_date }}{% elif release.release_year %}{{ release.release_year }}{% endif %}
      <td class="">
        <b><a href="/release/{{ release.ident }}">{{ release.title }}</a></b>
        <br>{{ release.release_status or "unknown status" }}
            | {{ release.release_type or "unknown type" }}
            {% if release.license_slug %} | {{ release.license_slug }}{% endif %}
        {% if release.doi %}
          <br><a href="https://doi.org/{{ release.doi }}" style="color:green;">doi:{{ release.doi }}</a>
        {% endif %}
{% endfor %}
</tbody>
</table>
{%- endmacro %}


{% macro url_list(urls) -%}
<table class="ui very basic compact single line fixed table">
<tbody>
  {% for url in urls %}
    <tr><td class="two wide right aligned">{{ url.rel }}
        <td class="eight wide"><small><code><a href="{{ url.url }}">
        {% if url.url.count('/') >= 3 %}
          {{ '/'.join(url.url.split('/')[0:2]) }}/<b>{{ ''.join(url.url.split('/')[2]) }}</b>/{{ '/'.join(url.url.split('/')[3:]) }}
        {% else %}
          {{ url.url }}
        {% endif %}
        </a></code></small>
  {% endfor %}
</tbody>
</table>
{%- endmacro %}