summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2021-04-15 23:25:00 -0700
committerBryan Newbold <bnewbold@robocracy.org>2021-07-23 10:55:09 -0700
commit7186a379f335dd2731d5db79ab85abf3506cee88 (patch)
tree319ef6bd07a147e416b5de395e81845db631b9bf
parentd5b24df069fc96d396afbb302633a077e5dbfb39 (diff)
downloadfatcat-7186a379f335dd2731d5db79ab85abf3506cee88.tar.gz
fatcat-7186a379f335dd2731d5db79ab85abf3506cee88.zip
web: template macro to display release entry summary
-rw-r--r--python/fatcat_web/templates/entity_macros.html52
1 files changed, 52 insertions, 0 deletions
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
</table>
{%- endmacro %}
+
+{# this is useful for things like showing lists of releases in tables #}
+{% macro release_summary(release) %}
+<b><a href="/release/{{ release.ident }}">{{ release.title }}</a></b>
+ {% if release.release_type not in ["article-journal", "conference-paper"] %}
+ <b>[{{ release.release_type or "unknown-type" }}]</b>
+ {% endif %}
+<br>
+ {% 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 %}
+<br>
+ {% if release.release_year %}{{ release.release_year }} &nbsp;{% endif %}
+ {% if release.container %}
+ <i>{{ release.container.name }}</i>
+ {% elif release.extra and release.extra.container_name %}
+ <i>{{ release.extra.container_name }}</i>
+ {% endif %}
+ {% if release.release_stage != "published" %}
+ &nbsp;<span style="color: brown; font-weight: bold;">{{ release.release_stage or "unpublished" }}</span>
+ {% endif %}
+</small>
+<br>
+ {% if release.version %}
+ <span style="color:green">version:{{ release.release_year }}</span>&nbsp;
+ {% endif %}
+ {% if release.number %}
+ <span style="color:green">number:{{ release.number }}</span>&nbsp;
+ {% endif %}
+ {% if release.ext_ids.doi %}
+ <a href="https://doi.org/{{ release.ext_ids.doi }}" style="color:green;">doi:{{ release.ext_ids.doi }}</a>&nbsp;
+ {% endif %}
+ {# TODO: links #}
+ {% if release.ext_ids.arxiv %}
+ <a href="#" style="color:green;">arXiv:{{ release.ext_ids.arxiv }}</a>&nbsp;
+ {% endif %}
+ {% if release.ext_ids.pmcid %}
+ <a href="#" style="color:green;">pmcid:{{ release.ext_ids.pmcid }}</a>&nbsp;
+ {% endif %}
+ {% if release.ext_ids.pmid %}
+ <a href="#" style="color:green;">pmid:{{ release.ext_ids.pmid }}</a>&nbsp;
+ {% endif %}
+ {% if release.ext_ids.dblp %}
+ <a href="#" style="color:green;">dblp:{{ release.ext_ids.dblp }}</a>&nbsp;
+ {% endif %}
+{% endmacro %}