From aef7b788326313a44e47549af98fc93690b34661 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Wed, 13 May 2020 16:02:41 -0700 Subject: skeleton of basic search, using covid19 index --- fatcat_scholar/templates/base.html | 212 ++++++++++++++++++++++++++++ fatcat_scholar/templates/home.html | 104 ++++++++++++-- fatcat_scholar/templates/search.html | 74 +++++++++- fatcat_scholar/templates/search_macros.html | 203 ++++++++++++++++++++++++++ 4 files changed, 580 insertions(+), 13 deletions(-) create mode 100644 fatcat_scholar/templates/base.html create mode 100644 fatcat_scholar/templates/search_macros.html (limited to 'fatcat_scholar/templates') diff --git a/fatcat_scholar/templates/base.html b/fatcat_scholar/templates/base.html new file mode 100644 index 0000000..d47003b --- /dev/null +++ b/fatcat_scholar/templates/base.html @@ -0,0 +1,212 @@ + + + + + + + + + {%- block title -%}scholar.archive.org{%- endblock %} + + + {% block extra_head %}{% endblock %} + + + + + +{% block fullmain %} +
+
+ +
+
+
+{% block fullbody %} +
+ {% block body %}Nothing to see here.{% endblock %} +
+{% endblock %} +
+{% endblock %} + +{# + +#} + +
+
+ + + + +{% block postscript %}{% endblock %} + + diff --git a/fatcat_scholar/templates/home.html b/fatcat_scholar/templates/home.html index e6e09b5..bb387f7 100644 --- a/fatcat_scholar/templates/home.html +++ b/fatcat_scholar/templates/home.html @@ -1,12 +1,92 @@ - - - hello - - -

The Start

- -

{% trans %}This is a longer paragraph, all of which should be translated.{% endtrans %} - -

and {{ _("this is a quick") }} thing to translate. - - +{% extends "base.html" %} + +{% block fullmain %} + +

+
+
+
+
+

Search Inside Millions of Research Papers

+
+ +
+
+
+

This fulltext search index includes over 25 million research articles and other documents preserved in the Internet Archive. +

The collection spans from digitized copies of eighteenth century journals though the latest Open Access conference proceedings and pre-prints crawled from the World Wide Web. +

+
+
+
+ +
+
+ +
+ + + +
+ Children are not little adults: blood transfusion in children with burn injury + Tina L. Palmieri +
+ 2017 + Burns & Trauma +
+
+
+ +
+ + + +
+ Epidemic Influenza in and around the City of Calcutta + Koilas Chandra Bose +
+ 1920 + The Indian Medical Gazette +
+
+
+ +
+ + + +
+ Repertoire of Intensive Care Unit Pneumonia Microbiota + Sabri Bousbia, et al +
+ 2012 + PLoS ONE +
+
+
+ +
+ + + +
+ BioTorrents: A File Sharing Service for Scientific Data + Morgan Langille, et al +
+ 2012 + PLoS ONE +
+
+
+
+
+ +{% endblock %} diff --git a/fatcat_scholar/templates/search.html b/fatcat_scholar/templates/search.html index 783cb47..fcb19c3 100644 --- a/fatcat_scholar/templates/search.html +++ b/fatcat_scholar/templates/search.html @@ -1 +1,73 @@ -

Search template will go here

+{% import "search_macros.html" as search_macros %} +{% extends "base.html" %} + +{% block fullbody %} +
+
+ + {% if found %} +
+
+ {{ "{:,}".format(found.count_found) }} +
+
+ Hits +
+
+ {% else %} + Maybe some filters, facets, counts over here? + {% endif %} + +
+
+ Release Date + + +
+ Resource Type + + +
+ Availability + + +
+ Sort Order + +
+ +
+
+ {% if found %} + {% if found.results %} + {% for paper in found.results %} + {{ search_macros.fulltext_search_result_row(paper) }} + {% endfor %} + {% endif %} + {% else %} + Some other message here when there is no search? Like a bunch of examples? + Or does that ever happen... we can just run query on "*". + {% endif %} +
+
+{% endblock %} diff --git a/fatcat_scholar/templates/search_macros.html b/fatcat_scholar/templates/search_macros.html new file mode 100644 index 0000000..b600cb4 --- /dev/null +++ b/fatcat_scholar/templates/search_macros.html @@ -0,0 +1,203 @@ + +{% macro fulltext_search_result_row(paper) -%} +{% set lang_code = "en" %} +
+
+ {# ### TITLE ROW #} +

+ + {# "best URL" calculation #} + {% if paper.pmcid %} + + {% if lang_code != 'en' and lang_code == paper.lang and paper.original_title %} + {# show original title first instead of title if UI is in that language #} + {{ paper.original_title[:512] }} + {% if paper.original_title|length > 512 %}...{% endif %} + {% elif paper.title %} + {{ paper.title[:512] }} + {% if paper.title|length > 512 %}...{% endif %} + {% else %} + [blank] + {% endif %} + + + {# release type suffix #} + {% if paper.release_type in ("article-journal", "paper-conference") %} + {# pass #} + {% elif paper.release_type in ("book", "chapter", "dataset") %} + [{{ _(paper.release_type) }}] + {% elif not paper.release_type %} + [media?] + {% else %} + [{{ _(paper.release_type) }}] + {% endif %} + + {# show inverse of title/original_title above #} + {% if lang_code != 'en' and lang_code == paper.lang and paper.title and paper.title != paper.original_title %} +
+ + {{ paper.title[:512] }} {% if paper.title|length > 512 %}...{% endif %} + + {% elif paper.original_title and paper.title != paper.original_title %} +
+ + {{ paper.original_title[:512] }} {% if paper.original_title|length > 512 %}...{% endif %} + + {% endif %} + +

+ + {# ### AUTHOR ROW #} + {% if paper.contrib_names %} +
+ + {{ ", ".join(paper.contrib_names[:12]) }} + {% if paper.contrib_names|length > 12 %}(+{{ paper.contrib_names|length - 12 }} others){% endif %} + +
+ {% endif %} + + + {# ### JOURNAL ROW #} + {% if paper.release_year %} + {{ paper.release_year }} + {% endif %} + {% if paper.release_year and paper.container_name %} + | + {% 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.withdrawn_status %} + [{{ paper.withdrawn_status }}] + {% endif %} + {% if paper.release_stage == "accepted" %} + [{{ paper.release_stage }}] + {% elif paper.release_stage and paper.release_stage != "published" %} + [{{ paper.release_stage }}] + {% elif not paper.release_stage %} + [unpublished?] + {% endif %} + + {# ### ABSTRACT / QUERY HIGHLIGHT #} + {% if paper._highlights %} +
+ {% for highlight in paper._highlights %} + {{ highlight|safe }} ... + {% endfor %} +
+ {% elif paper.abstract %} +
+ {% if paper.abstract[0]|length > 500 %} + {{ paper.abstract[0][:500] }}... + {% else %} + {{ paper.abstract[0][:500] }}... + {% endif %} +
+ {% else %} +
+ {% endif %} + + {# ### IDENTIFIERS #} + {% if paper.doi %} + doi:{{ paper.doi }}   + {% endif %} + {% if paper.pmid %} + pmid:{{ paper.pmid }}   + {% endif %} + {% if paper.pmcid %} + pmcid:{{ paper.pmcid }}   + {% endif %} + {% if paper.arxiv_id %} + arXiv:{{ paper.arxiv_id }}   + {% endif %} + {% if paper.fatcat_ident %} + fatcat:{{ paper.fatcat_ident}}   + {% endif %} + + {# ### SOURCE TAGS #} +
+ {% if paper.cord19_uid or 'cord19' in paper.source_tags %} + + CORD-19 + + {% endif %} + {% if 'fatcat' in paper.source_tags %} + + fatcat + + {% endif %} + {% if 'who' in paper.source_tags %} + + WHO + + {% endif %} + {% if 'wanfang' in paper.source_tags %} + + Wanfang + + {% endif %} + {% if 'cnki' in paper.source_tags %} + + CNKI + + {% endif %} + {# olive, brown, grey, pink, red, etc #} +
+ +
+
+ {% if paper.fulltext.thumbnail_url %} + {# #} + +
+ + + + {# +
+
+ PDF +
+
+ #} +
+ + +
+ {% else %} + {# No Fulltext #} + {% endif %} +{# should we include these little links? + + {% if paper.fulltext.pdf_url %} + mirror + {% endif %} + {% if paper.fulltext.grobid_xml_url %} + xml + {% endif %} + +#} +
+
+{% endmacro %} -- cgit v1.2.3