From ea3b8c33cf53b7e50cb353eac2c6f73f5cb75979 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Tue, 3 Sep 2019 19:35:42 -0700 Subject: include example releases on container landing page Included making release search results an entity macro (in webface templates). --- python/fatcat_web/templates/container_view.html | 6 ++ python/fatcat_web/templates/entity_macros.html | 77 +++++++++++++++++++++++++ python/fatcat_web/templates/release_search.html | 77 +------------------------ 3 files changed, 86 insertions(+), 74 deletions(-) (limited to 'python/fatcat_web/templates') diff --git a/python/fatcat_web/templates/container_view.html b/python/fatcat_web/templates/container_view.html index c2731db2..ac304e95 100644 --- a/python/fatcat_web/templates/container_view.html +++ b/python/fatcat_web/templates/container_view.html @@ -33,6 +33,12 @@ + +{% if container._random_releases %} +

Example Publications

+{% for random_release in container._random_releases %} + {{ entity_macros.release_search_result_row(random_release) }} +{% endfor %} {% endif %} diff --git a/python/fatcat_web/templates/entity_macros.html b/python/fatcat_web/templates/entity_macros.html index 0e3943dd..6124630c 100644 --- a/python/fatcat_web/templates/entity_macros.html +++ b/python/fatcat_web/templates/entity_macros.html @@ -144,3 +144,80 @@ {%- endmacro %} + +{% macro release_search_result_row(paper) -%} +
+

+ + {% if paper.title %} + {{ paper.title[:512] }} + {% if paper.title|length > 512 %}...{% endif %} + {% else %} + [blank] + {% endif %} + +

+ {% if paper.best_pdf_url %} +
+   fulltext +
+ {% endif %} + {# +
{{ ", ".join(paper.contrib_names[:12]) }} + {% if paper.contrib_names|length > 12 %}(+{{ paper.contrib_names|length - 12 }} others){% endif %} +
+ #} + {% if paper.contrib_names %} +
+ + {{ ", ".join(paper.contrib_names[:12]) }} + {% if paper.contrib_names|length > 12 %}(+{{ paper.contrib_names|length - 12 }} others){% endif %} + +
+ {% endif %} + {% if paper.release_year %} + {{ paper.release_year }} + {% endif %} + {% if paper.release_type %} + {% if paper.release_type in ("article-journal", "paper-conference") %} + {{ paper.release_type }} + {% elif paper.release_type in ("book") %} + {{ paper.release_type }} + {% else %} + {{ paper.release_type }} + {% endif %} + {% endif %} + {% if paper.withdrawn_status %} + {{ paper.withdrawn_status }} + {% endif %} + {% if paper.release_stage and paper.release_stage != "published" %} + {{ paper.release_stage }} + {% elif not paper.release_stage %} + unknown + {% endif %} + {% if paper.container_name %} + {% if paper.container_id %} + {{ paper.container_name }} + {% else %} + {{ paper.container_name }} + {% endif %} + {% if paper.container_is_oa %}{% endif %} + {% endif %} + {% if paper.doi or paper.pmid or paper.arxiv_id or paper.jstor_id %} +
+ {% endif %} + {% if paper.doi %} + doi:{{ paper.doi }}   + {% endif %} + {% if paper.pmid %} + pmid:{{ paper.pmid }}   + {% endif %} + {% if paper.arxiv_id %} + arXiv:{{ paper.arxiv_id }}   + {% endif %} + {% if False %} {# XXX: elastic release work grouping searches #} +
+ and 5 other versions of the same work! + {% endif %} +
+{% endmacro %} diff --git a/python/fatcat_web/templates/release_search.html b/python/fatcat_web/templates/release_search.html index 59411c62..7d6b0443 100644 --- a/python/fatcat_web/templates/release_search.html +++ b/python/fatcat_web/templates/release_search.html @@ -1,3 +1,4 @@ +{% import "entity_macros.html" as entity_macros %} {% extends "base.html" %} {% block title %} @@ -8,6 +9,7 @@ {% endif %} {% endblock %} + {% block fullmain %}
@@ -36,80 +38,7 @@ {% if found.results %} Showing top {{ found.count_returned }} out of {{ found.count_found }} results for: {{ found.query.q }} {% for paper in found.results %} -
-

- - {% if paper.title %} - {{ paper.title[:512] }} - {% if paper.title|length > 512 %}...{% endif %} - {% else %} - [blank] - {% endif %} - -

- {% if paper.best_pdf_url %} -
-   fulltext -
- {% endif %} - {# -
{{ ", ".join(paper.contrib_names[:12]) }} - {% if paper.contrib_names|length > 12 %}(+{{ paper.contrib_names|length - 12 }} others){% endif %} -
- #} - {% if paper.contrib_names %} -
- - {{ ", ".join(paper.contrib_names[:12]) }} - {% if paper.contrib_names|length > 12 %}(+{{ paper.contrib_names|length - 12 }} others){% endif %} - -
- {% endif %} - {% if paper.release_year %} - {{ paper.release_year }} - {% endif %} - {% if paper.release_type %} - {% if paper.release_type in ("article-journal", "paper-conference") %} - {{ paper.release_type }} - {% elif paper.release_type in ("book") %} - {{ paper.release_type }} - {% else %} - {{ paper.release_type }} - {% endif %} - {% endif %} - {% if paper.withdrawn_status %} - {{ paper.withdrawn_status }} - {% endif %} - {% if paper.release_stage and paper.release_stage != "published" %} - {{ paper.release_stage }} - {% elif not paper.release_stage %} - unknown - {% endif %} - {% if paper.container_name %} - {% if paper.container_id %} - {{ paper.container_name }} - {% else %} - {{ paper.container_name }} - {% endif %} - {% if paper.container_is_oa %}{% endif %} - {% endif %} - {% if paper.doi or paper.pmid or paper.arxiv_id or paper.jstor_id %} -
- {% endif %} - {% if paper.doi %} - doi:{{ paper.doi }}   - {% endif %} - {% if paper.pmid %} - pmid:{{ paper.pmid }}   - {% endif %} - {% if paper.arxiv_id %} - arXiv:{{ paper.arxiv_id }}   - {% endif %} - {% if False %} {# XXX: elastic release work grouping searches #} -
- and 5 other versions of the same work! - {% endif %} -
+ {{ entity_macros.release_search_result_row(paper) }} {% endfor %} {% if found.results|length > 8 %}
-- cgit v1.2.3