aboutsummaryrefslogtreecommitdiffstats
path: root/fatcat_covid19/templates/entity_macros.html
blob: 66f0eb290c9b8ccc5ce7a851d9db012844376143 (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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159

{% macro fulltext_search_result_row(paper) -%}
<div class="row">
<div class="four wide right aligned column" style="padding: 1em;">
  {% if paper.fulltext.t_thumbnail_url %}
    <a href="{{ config.COVID19_FULLTEXT_HOST }}{{ paper.fulltext.pdf_url.replace('//', '/') }}">
      <img src="{{ config.COVID19_FULLTEXT_HOST }}{{ paper.fulltext.t_thumbnail_url.replace('//', '/') }}" style="border: 1px solid grey; max-height: 12em;">
    </a>
  {% else %}
    No Fulltext
  {% endif %}
</div>
<div class="twelve wide column">
  {# ### TITLE ROW #}
  <h4 style="margin-top: 1em; margin-bottom: 0px; font-size: 1.2em;">

    {# "best URL" calculation #}
    {% if paper.pmcid %}
    <a href="https://www.ncbi.nlm.nih.gov/pmc/articles/{{ paper.pmcid }}/"
    {% elif paper.pmid %}
    <a href="https://pubmed.ncbi.nlm.nih.gov/{{ paper.pmid }}/"
    {% else %}
    <a href="https://fatcat.wiki/release/{{ paper.fatcat_ident }}"
    {% endif %}
    style="color: #2224c7;">
      {% if paper.title %}
        {{ paper.title[:512] }}
        {% if paper.title|length > 512 %}...{% endif %}
      {% else %}
        [blank]
      {% endif %}
    </a>

    {% if paper.release_type in ("article-journal", "paper-conference") %}
      {# pass #}
    {% elif paper.release_type in ("book", "chapter", "dataset") %}
      <b style="text-transform: uppercase;">[{{ paper.release_type }}]</b>
    {% elif not paper.release_type %}
      <b style="text-transform: uppercase; color: red;">[media?]</b>
    {% else %}
      <b style="text-transform: uppercase;">[{{ paper.release_type }}]</b>
    {% endif %}
  </h4>
  <div style="float: right; padding: 4px;">
  &nbsp;&nbsp;<a href="{{ config.ELASTICSEARCH_BACKEND }}/{{ config.ELASTICSEARCH_FULLTEXT_INDEX }}/release/{{ paper.fatcat_ident }}" class="ui grey tag label"><i class="file icon"></i>json</a>
  </div>
  {% if paper.best_pdf_url %}
  <div style="float: right; padding: 4px;">
  &nbsp;&nbsp;<a href="{{ paper.best_pdf_url }}" class="ui violet tag label"><i class="file icon"></i>fulltext</a>
  </div>
  {% endif %}


  {# ### AUTHOR ROW #}
  {% if paper.contrib_names %}
    <div style="margin-top: 0.1em; margin-bottom: 0.1em; font-size: 1.1em;">
    <b>
    {{ ", ".join(paper.contrib_names[:12]) }}
    {% if paper.contrib_names|length > 12 %}<i>(+{{ paper.contrib_names|length - 12 }} others)</i>{% endif %}
    </b>
    </div>
  {% endif %}


  {# ### JOURNAL ROW #}
  {% if paper.release_year %}
    {{ paper.release_year }}
  {% endif %}
  {% if paper.release_year and paper.container_name %}
    |
  {% endif %}
  {% if paper.container_name %}
    {% if paper.container_id %}
      <a href="https://fatcat.wiki/container/{{ paper.container_id }}" style="color: black;">{{ paper.container_name }}</a>
    {% else %}
      {{ paper.container_name }}
    {% endif %}
    {% if paper.container_is_oa %}<i class="icon unlock orange small"></i>{% endif %}
  {% endif %}
  {% if paper.withdrawn_status %}
    <b style="color: red;"><code>[{{ paper.withdrawn_status }}]</code></b>
  {% endif %}
  {% if paper.release_stage and paper.release_stage != "published" %}
    <b style="color: pink;"><code>[{{ paper.release_stage }}]</code></b>
  {% elif not paper.release_stage %}
    <b style="color: red;"><code>[unpublished?]</code></b>
  {% endif %}

  {# ### ABSTRACT / QUERY HIGHLIGHT #}
  {% if paper.abstract %}
    <div style="padding: 1em;">
      {% if paper.abstract[0]|length > 500 %}
        {{ paper.abstract[0][:500] }}...
      {% else %}
        {{ paper.abstract[0][:500] }}...
      {% endif %}
    </div>
  {% endif %}

  {# ### IDENTIFIERS #}
  {% if paper.doi or paper.pmid or paper.arxiv_id or paper.jstor_id %}
  <br>
  {% endif %}
  {% if paper.doi %}
    <a href="https://doi.org/{{paper.doi }}" style="color: green;">doi:{{ paper.doi }}</a> &nbsp;
  {% endif %}
  {% if paper.pmid %}
    <a href="https://www.ncbi.nlm.nih.gov/pubmed/{{paper.pmid }}" style="color: green;">pmid:{{ paper.pmid }}</a> &nbsp;
  {% endif %}
  {% if paper.arxiv_id %}
    <a href="https://arxiv.org/abs/{{paper.arxiv_id }}" style="color: green;">arXiv:{{ paper.arxiv_id }}</a> &nbsp;
  {% endif %}
  {% if False %} {# XXX: elastic release work grouping searches #}
  <br>
  <a href="/work/{{ paper.work_id }}"><i class="sitemap icon"></i> and 5 other versions of the same work!</a>
  {% endif %}
</div>
</div>
{% endmacro %}


{% macro top_results(found) -%}

<i>Showing
  {% if found.offset == 0 %}
  first
  {% else %}
  results {{ found.offset }} &mdash;
  {% endif %}

  {{ found.offset + found.count_returned }}
  out of {{ found.count_found }} results
</i>

{%- endmacro %}


{% macro bottom_results(found, endpoint='search.fulltext_search') -%}

{% if found.offset > 0 %}
  {% if found.offset - found.limit < 0 %}
    <a href="{{ url_for(endpoint, q=found.query.q, offset=0) }}">&#xab; Previous</a>
  {% else %}
    <a href="{{ url_for(endpoint, q=found.query.q, offset=found.offset - found.limit) }}">&#xab; Previous</a>
  {% endif %}
{% else %}
  <span style="color:gray">&#xab; Previous</span>
{% endif %}

&nbsp;&nbsp;<i>Showing results {{ found.offset }} &mdash; {{ found.offset +
found.count_returned }} out of {{ found.count_found }} results</i>&nbsp;&nbsp;

{% if found.offset + found.limit < found.count_found and found.offset + found.limit < found.deep_page_limit %}
  <a href="{{ url_for(endpoint, q=found.query.q, offset=found.offset + found.limit) }}">Next &#xbb;</a>
  {% else %}
  <span style="color:gray">Next &#xbb;</span>
{% endif %}

{%- endmacro %}