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/base.html | 33 ++++++++++-- fatcat_scholar/templates/search_macros.html | 81 +++++++++++++++-------------- 2 files changed, 72 insertions(+), 42 deletions(-) (limited to 'fatcat_scholar/templates') diff --git a/fatcat_scholar/templates/base.html b/fatcat_scholar/templates/base.html index 7df0502..595b8c9 100644 --- a/fatcat_scholar/templates/base.html +++ b/fatcat_scholar/templates/base.html @@ -65,7 +65,7 @@ div.fulltext-link { width: 180px; } - div.serp-hit-box { + div.biblio-record { padding-left: 1.1em; } } @@ -82,13 +82,40 @@ line-height: 1.28571429em; } - .serp-hit-box details > summary { + .biblio-record .biblio-title { + margin-bottom: 0.1em; + font-size: 1.2em; + font-weight: bold; + line-height: 1.2em; + } + .biblio-record .biblio-title a { + color: #2224c7; + } + .biblio-record .release-type { + text-transform: uppercase; + font-weight: bold; + } + .biblio-record .original-title { + font-style: italic; + font-weight: normal; + } + .biblio-record .author-row { + margin-top: 0; + margin-bottom: 0.2em; + font-size: 1.1em; + } + .biblio-record .release-stage { + color: brown; + font-weight: bold; + text-transform: uppercase; + } + .biblio-record details > summary { list-style-type: none; color: #28629c; text-decoration: underline; margin-left: 0.3em; } - .serp-hit-box details > summary::-webkit-details-marker { + .biblio-record details > summary::-webkit-details-marker { display: none; } 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