aboutsummaryrefslogtreecommitdiffstats
path: root/fatcat_covid19/templates/entity_macros.html
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2020-04-02 17:37:35 -0700
committerBryan Newbold <bnewbold@archive.org>2020-04-02 17:37:35 -0700
commit87f40d0f8d15f16020964773e75d35ea22da049f (patch)
treebb1bae721bc9249bea7a4f994201c0ef0b730962 /fatcat_covid19/templates/entity_macros.html
parent7c5d51190cb8e58dea6231b48dc942fb35ef54a9 (diff)
downloadfatcat-covid19-87f40d0f8d15f16020964773e75d35ea22da049f.tar.gz
fatcat-covid19-87f40d0f8d15f16020964773e75d35ea22da049f.zip
basic fulltext search highlighting
Diffstat (limited to 'fatcat_covid19/templates/entity_macros.html')
-rw-r--r--fatcat_covid19/templates/entity_macros.html34
1 files changed, 22 insertions, 12 deletions
diff --git a/fatcat_covid19/templates/entity_macros.html b/fatcat_covid19/templates/entity_macros.html
index 66f0eb2..cc3a8a6 100644
--- a/fatcat_covid19/templates/entity_macros.html
+++ b/fatcat_covid19/templates/entity_macros.html
@@ -1,16 +1,7 @@
{% macro fulltext_search_result_row(paper) -%}
<div class="row">
-<div class="four wide right aligned column" style="padding: 1em;">
- {% if paper.fulltext.t_thumbnail_url %}
- <a href="{{ config.COVID19_FULLTEXT_HOST }}{{ paper.fulltext.pdf_url.replace('//', '/') }}">
- <img src="{{ config.COVID19_FULLTEXT_HOST }}{{ paper.fulltext.t_thumbnail_url.replace('//', '/') }}" style="border: 1px solid grey; max-height: 12em;">
- </a>
- {% else %}
- No Fulltext
- {% endif %}
-</div>
-<div class="twelve wide column">
+<div class="thirteen wide column">
{# ### TITLE ROW #}
<h4 style="margin-top: 1em; margin-bottom: 0px; font-size: 1.2em;">
@@ -41,14 +32,18 @@
<b style="text-transform: uppercase;">[{{ paper.release_type }}]</b>
{% endif %}
</h4>
+
+ {#
<div style="float: right; padding: 4px;">
&nbsp;&nbsp;<a href="{{ config.ELASTICSEARCH_BACKEND }}/{{ config.ELASTICSEARCH_FULLTEXT_INDEX }}/release/{{ paper.fatcat_ident }}" class="ui grey tag label"><i class="file icon"></i>json</a>
</div>
+
{% if paper.best_pdf_url %}
<div style="float: right; padding: 4px;">
&nbsp;&nbsp;<a href="{{ paper.best_pdf_url }}" class="ui violet tag label"><i class="file icon"></i>fulltext</a>
</div>
{% endif %}
+ #}
{# ### AUTHOR ROW #}
@@ -87,8 +82,14 @@
{% endif %}
{# ### ABSTRACT / QUERY HIGHLIGHT #}
- {% if paper.abstract %}
- <div style="padding: 1em;">
+ {% if paper._highlights %}
+ <div style="padding-top: 1em; padding-left: 0.5em;" class="search_highlights">
+ {% for highlight in paper._highlights %}
+ {{ highlight|safe }} ...
+ {% endfor %}
+ </div>
+ {% elif paper.abstract %}
+ <div style="padding-top: 1em; padding-left: 0.5em;">
{% if paper.abstract[0]|length > 500 %}
{{ paper.abstract[0][:500] }}...
{% else %}
@@ -115,6 +116,15 @@
<a href="/work/{{ paper.work_id }}"><i class="sitemap icon"></i> and 5 other versions of the same work!</a>
{% endif %}
</div>
+<div class="three wide left aligned column" style="padding: 1em;">
+ {% if paper.fulltext.thumbnail_url %}
+ <a href="{{ config.COVID19_FULLTEXT_HOST }}{{ paper.fulltext.pdf_url.replace('//', '/') }}">
+ <img src="{{ config.COVID19_FULLTEXT_HOST }}{{ paper.fulltext.thumbnail_url.replace('//', '/') }}" style="border: 1px solid grey; max-height: 12em; max-width: 100%;">
+ </a>
+ {% else %}
+ {# No Fulltext #}
+ {% endif %}
+</div>
</div>
{% endmacro %}