From f3d286d92088a2f7038e0635a85a09c7de322147 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 23 Apr 2020 18:26:11 -0700 Subject: web search: improve indentation, fix missing div tags These are back-ported fixes from covid19.fatcat.wiki --- python/fatcat_web/templates/container_search.html | 89 ++++++++++++----------- python/fatcat_web/templates/release_search.html | 59 ++++++++------- 2 files changed, 81 insertions(+), 67 deletions(-) diff --git a/python/fatcat_web/templates/container_search.html b/python/fatcat_web/templates/container_search.html index 1a089643..1a804595 100644 --- a/python/fatcat_web/templates/container_search.html +++ b/python/fatcat_web/templates/container_search.html @@ -9,6 +9,7 @@ {% endif %} {% endblock %} + {% block fullmain %}
@@ -17,8 +18,7 @@
- - +

Can also lookup by identifier or search releases.
@@ -30,49 +30,56 @@
{% if found %} -{% if found.results %} - {{ entity_macros.top_results(found) }} + {% if found.results %} -{% for entity in found.results %} -
-

- {{ entity['name'] }} - {% if entity.is_oa %}{% endif %} -

- {% if entity.publisher %} -
{{ entity.publisher }}
- {% endif %} - {% if entity.issnl %} - issn:{{ entity.issnl }} - {% endif %} - {% if entity.container_type %} -  {{ entity.container_type }} - {% endif %} -
-{% endfor %} -{% if found.results|length > 8 %} -
-
- {{ entity_macros.bottom_results(found, endpoint='container_search')}} -
-{% endif %} -{% else %} + {{ entity_macros.top_results(found) }} -Raw query was: {{ found.query.q }} + {% for entity in found.results %} +
+

+ {{ entity['name'] }} + {% if entity.is_oa %}{% endif %} +

+ {% if entity.publisher %} +
{{ entity.publisher }}
+ {% endif %} + {% if entity.issnl %} + issn:{{ entity.issnl }} + {% endif %} + {% if entity.container_type %} +  {{ entity.container_type }} + {% endif %} +
+ {% endfor %} + + {% if found.results|length > 8 %} +
+
+ {{ entity_macros.bottom_results(found, endpoint='container_search') }} +
+ {% endif %} -
-
-
- confused paper man + {% else %} + + Raw query was: {{ found.query.q }} + +
+
+
+ confused paper man +
+
+

No results found!

+

You could try elsewhere:

+ +
+
-
-

No results found!

-

You could try elsewhere:

- -
-{% endif %} + + {% endif %} + {% endif %}
diff --git a/python/fatcat_web/templates/release_search.html b/python/fatcat_web/templates/release_search.html index 47f4330a..70c46c0a 100644 --- a/python/fatcat_web/templates/release_search.html +++ b/python/fatcat_web/templates/release_search.html @@ -35,37 +35,44 @@
{% if found %} -{% if found.results %} + {% if found.results %} + {{ entity_macros.top_results(found) }} - {% for paper in found.results %} - {{ entity_macros.release_search_result_row(paper) }} -{% endfor %} -{% if found.results|length > 8 %} -
-
- {{ entity_macros.bottom_results(found)}} -
-{% endif %} -{% else %} + {% for paper in found.results %} + {{ entity_macros.release_search_result_row(paper) }} + {% endfor %} + + {% if found.results|length > 8 %} +
+
+ {{ entity_macros.bottom_results(found, endpoint='release_search') }} +
+ {% endif %} + + {% else %} -Raw query was: {{ found.query.q }} + Raw query was: {{ found.query.q }} -
-
-
- confused paper man +
+
+
+ confused paper man +
+
+

No results found!

+

You could try elsewhere:

+ +
+
-
-

No results found!

-

You could try elsewhere:

- -
-{% endif %} + + {% endif %} + {% endif %}
-- cgit v1.2.3 From 0cb1fd066e4bbefce6b9aba4ac29916c37ffd738 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 23 Apr 2020 18:26:52 -0700 Subject: web search: tweak release search result style This is also back-ported from covid19.fatcat.wiki, though with some more tweaks on top. The changes are: - show original title if available (usually non-English) - move release_type label to title line suffix, and only show if not a "paper" - show publication status and withdrawl as text after the journal title, not as a label --- python/fatcat_web/templates/entity_macros.html | 76 +++++++++++++++++--------- 1 file changed, 51 insertions(+), 25 deletions(-) diff --git a/python/fatcat_web/templates/entity_macros.html b/python/fatcat_web/templates/entity_macros.html index 7c5436c6..61de2d13 100644 --- a/python/fatcat_web/templates/entity_macros.html +++ b/python/fatcat_web/templates/entity_macros.html @@ -156,17 +156,35 @@ [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 %} + [unknown-media] + {% else %} + [{{ paper.release_type }}] + {% endif %} + + {# show original_title #} + {% if paper.original_title and paper.title != paper.original_title %} +
+ + {{ paper.original_title[:512] }} {% if paper.original_title|length > 512 %}...{% endif %} + + {% 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 %} -
- #} + + {# ### AUTHOR ROW #} {% if paper.contrib_names %}
@@ -175,25 +193,14 @@
{% endif %} + + + {# ### JOURNAL ROW #} {% 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 + {% if paper.release_year and paper.container_name %} + | {% endif %} {% if paper.container_name %} {% if paper.container_id %} @@ -203,8 +210,22 @@ {% endif %} {% if paper.container_is_oa %}{% endif %} {% endif %} - {% if paper.doi or paper.pmid or paper.arxiv_id or paper.jstor_id %} -
+ {% if paper.withdrawn_status %} + [{{ paper.withdrawn_status }}] + {% endif %} + {% if paper.release_stage == "accepted" %} + [{{ paper.release_stage }} manuscript] + {% elif paper.release_stage == "submitted" %} + [pre-print] + {% elif paper.release_stage and paper.release_stage != "published" %} + [{{ paper.release_stage }}] + {% elif not paper.release_stage %} + [unpublished?] + {% endif %} + + {# ### IDENTIFIERS #} + {% if paper.doi or paper.pmid or paper.arxiv_id or paper.jstor_id or paper.pmcid %} +
{% endif %} {% if paper.doi %} doi:{{ paper.doi }}   @@ -212,13 +233,18 @@ {% if paper.pmid %} pmid:{{ paper.pmid }}   {% endif %} + {% if paper.pmcid %} + pmcid:{{ paper.pmcid }}   + {% endif %} {% if paper.arxiv_id %} arXiv:{{ paper.arxiv_id }}   {% endif %} - {% if False %} {# XXX: elastic release work grouping searches #} + +{# WIP: elastic release work grouping searches
and 5 other versions of the same work! - {% endif %} +#} +
{% endmacro %} -- cgit v1.2.3