From 7186a379f335dd2731d5db79ab85abf3506cee88 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 15 Apr 2021 23:25:00 -0700 Subject: web: template macro to display release entry summary --- python/fatcat_web/templates/entity_macros.html | 52 ++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 'python/fatcat_web') diff --git a/python/fatcat_web/templates/entity_macros.html b/python/fatcat_web/templates/entity_macros.html index 50f45753..94770afb 100644 --- a/python/fatcat_web/templates/entity_macros.html +++ b/python/fatcat_web/templates/entity_macros.html @@ -387,3 +387,55 @@ yellow {%- endmacro %} + +{# this is useful for things like showing lists of releases in tables #} +{% macro release_summary(release) %} +{{ release.title }} + {% if release.release_type not in ["article-journal", "conference-paper"] %} + [{{ release.release_type or "unknown-type" }}] + {% endif %} +
+ {% for contrib in release.contribs[:5] %} + {% if contrib.creator %} + {{ contrib.creator.display_name }} + {% else %} + {{ contrib.raw_name }} + {% endif %} + {% if not loop.last %}, {% endif %} + {% endfor %} + {% if release.contribs | length > 5 %}(+ more) {%endif %} +
+ {% if release.release_year %}{{ release.release_year }}  {% endif %} + {% if release.container %} + {{ release.container.name }} + {% elif release.extra and release.extra.container_name %} + {{ release.extra.container_name }} + {% endif %} + {% if release.release_stage != "published" %} +  {{ release.release_stage or "unpublished" }} + {% endif %} + +
+ {% if release.version %} + version:{{ release.release_year }}  + {% endif %} + {% if release.number %} + number:{{ release.number }}  + {% endif %} + {% if release.ext_ids.doi %} + doi:{{ release.ext_ids.doi }}  + {% endif %} + {# TODO: links #} + {% if release.ext_ids.arxiv %} + arXiv:{{ release.ext_ids.arxiv }}  + {% endif %} + {% if release.ext_ids.pmcid %} + pmcid:{{ release.ext_ids.pmcid }}  + {% endif %} + {% if release.ext_ids.pmid %} + pmid:{{ release.ext_ids.pmid }}  + {% endif %} + {% if release.ext_ids.dblp %} + dblp:{{ release.ext_ids.dblp }}  + {% endif %} +{% endmacro %} -- cgit v1.2.3