From 4d3ec6c7fbad5a4a1c0019d71e33ebc9c62d328e Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Fri, 15 Jan 2021 01:07:19 -0800 Subject: html: some CSS refactoring; make journal row a macro --- fatcat_scholar/templates/search_macros.html | 81 +++++++++++++++-------------- 1 file changed, 42 insertions(+), 39 deletions(-) (limited to 'fatcat_scholar/templates/search_macros.html') diff --git a/fatcat_scholar/templates/search_macros.html b/fatcat_scholar/templates/search_macros.html index 229d481..d6846d1 100644 --- a/fatcat_scholar/templates/search_macros.html +++ b/fatcat_scholar/templates/search_macros.html @@ -50,14 +50,45 @@ {% endif %} {% endmacro %} +{% macro journal_row(biblio, paper) -%} + {# NOTE: should be able to call with paper.biblio or any paper.release[] #} + {% if biblio.release_year %} + {{ biblio.release_year }} + {% endif %} + {% if biblio.container_name %} + + {% if biblio.container_ident %} + {{ biblio.container_name }} + {% elif paper.doc_type == "sim_page" %} + {{ biblio.container_name }} + {% else %} + {{ biblio.container_name }} + {% endif %} + +   + {% endif %} + + {% if biblio.release_stage == "submitted" %} + pre-print + {% elif biblio.release_stage and biblio.release_stage != "published" %} + {{ biblio.release_stage }} + {% elif not biblio.release_stage %} + unpublished + {% endif %} + + {% if biblio.withdrawn_status %} + {{ biblio.withdrawn_status }} + {% endif %} +{% endmacro %} + {% macro fulltext_search_result_row(paper, locale=None, debug_mode=False) -%}
-
+
{# ### TITLE ROW #} -

+

{% if paper.doc_type == "work" %} - + {% if paper.biblio.title %} {{ paper.biblio.title[:512] }} {% if paper.biblio.title|length > 512 %}...{% endif %} @@ -66,7 +97,7 @@ {% endif %} {# release type suffix #} - + {% if paper.biblio.release_type in ("article-journal", "paper-conference") or paper.doc_type == "sim_page" %} {# pass #} {% elif paper.biblio.release_type in ("book", "chapter", "dataset") %} @@ -81,23 +112,23 @@ {# show inverse of title/original_title above #} {% if paper.biblio.original_title and paper.biblio.title != paper.biblio.original_title %}
- + {{ paper.biblio.original_title[:512] }} {% if paper.biblio.original_title|length > 512 %}...{% endif %} - +
{% endif %} {% elif paper.doc_type == "sim_page" %} - + {% trans page_num = paper.ia_sim.first_page, journal_name = paper.biblio.container_name, volume = paper.biblio.volume, issue = paper.biblio.issue %}Page {{ page_num }} of {{ journal_name }} Vol. {{ volume }}, Issue {{ issue }}{% endtrans %} - [{{ _("page") }}] + [{{ _("page") }}] {% endif %}

{# ### AUTHOR ROW #} {% if paper.biblio.contrib_names %} -
+
{{ ", ".join(paper.biblio.contrib_names[:12]) }} {% if paper.biblio.contrib_names|length > 12 %}(+{{ paper.biblio.contrib_names|length - 12 }} others){% endif %}
@@ -105,33 +136,7 @@ {# ### JOURNAL ROW #} - {% if paper.biblio.release_year %} - {{ paper.biblio.release_year }} - {% endif %} - {% if paper.biblio.container_name %} - - {% if paper.biblio.container_ident %} - {{ paper.biblio.container_name }} - {% elif paper.doc_type == "sim_page" %} - {{ paper.biblio.container_name }} - {% else %} - {{ paper.biblio.container_name }} - {% endif %} - -   - {% endif %} - - {% if paper.biblio.release_stage == "submitted" %} - pre-print - {% elif paper.biblio.release_stage and paper.biblio.release_stage != "published" %} - {{ paper.biblio.release_stage }} version - {% elif not paper.biblio.release_stage %} - unpublished - {% endif %} - - {% if paper.biblio.withdrawn_status %} - {{ paper.biblio.withdrawn_status }} - {% endif %} + {{ journal_row(paper.biblio, paper) }} {# ### ABSTRACT / QUERY HIGHLIGHT #} {% if paper._highlights %} @@ -204,9 +209,7 @@ {% for release in paper.releases %} - - {{ release.release_stage or _("unknown") }} - + {{ release.release_stage or _("unknown") }} {% if release.release_date %} -- cgit v1.2.3