aboutsummaryrefslogtreecommitdiffstats
path: root/fatcat_covid19/templates/entity_macros.html
diff options
context:
space:
mode:
Diffstat (limited to 'fatcat_covid19/templates/entity_macros.html')
-rw-r--r--fatcat_covid19/templates/entity_macros.html117
1 files changed, 117 insertions, 0 deletions
diff --git a/fatcat_covid19/templates/entity_macros.html b/fatcat_covid19/templates/entity_macros.html
new file mode 100644
index 0000000..9cded8a
--- /dev/null
+++ b/fatcat_covid19/templates/entity_macros.html
@@ -0,0 +1,117 @@
+
+{% macro fulltext_search_result_row(paper) -%}
+<div>
+ <h4 style="margin-top: 1em; margin-bottom: 0px; font-size: 1.1em;">
+ <a href="/release/{{ paper.ident }}" style="color: #2224c7;">
+ {% if paper.title %}
+ {{ paper.title[:512] }}
+ {% if paper.title|length > 512 %}...{% endif %}
+ {% else %}
+ [blank]
+ {% endif %}
+ </a>
+ </h4>
+ {% 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 %}
+ {#
+ <h5 style="margin-top: 4px; margin-bottom: 4px; font-size: 1em;">{{ ", ".join(paper.contrib_names[:12]) }}
+ {% if paper.contrib_names|length > 12 %}<i>(+{{ paper.contrib_names|length - 12 }} others)</i>{% endif %}
+ </h5>
+ #}
+ {% if paper.contrib_names %}
+ <div style="margin-top: 0px; margin-bottom: 0px; font-size: 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 %}
+ {% if paper.release_year %}
+ {{ paper.release_year }}
+ {% endif %}
+ {% if paper.release_type %}
+ {% if paper.release_type in ("article-journal", "paper-conference") %}
+ <span class="ui black basic label small">{{ paper.release_type }}</span>
+ {% elif paper.release_type in ("book") %}
+ <span class="ui brown basic label small">{{ paper.release_type }}</span>
+ {% else %}
+ <span class="ui grey basic label small">{{ paper.release_type }}</span>
+ {% endif %}
+ {% endif %}
+ {% if paper.withdrawn_status %}
+ <span class="ui red label small">{{ paper.withdrawn_status }}</span>
+ {% endif %}
+ {% if paper.release_stage and paper.release_stage != "published" %}
+ <span class="ui pink basic label small">{{ paper.release_stage }}</span>
+ {% elif not paper.release_stage %}
+ <span class="ui red basic label small">unknown</span>
+ {% endif %}
+ {% if paper.container_name %}
+ {% if paper.container_id %}
+ <a href="/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.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>
+{% 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 %}