From 9ba4cb8509b682ab62bb4debfceea41da328eccf Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 6 Aug 2020 17:47:14 -0700 Subject: show language code as a tag --- fatcat_scholar/templates/search.html | 2 +- fatcat_scholar/templates/search_macros.html | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'fatcat_scholar/templates') diff --git a/fatcat_scholar/templates/search.html b/fatcat_scholar/templates/search.html index 0216f87..b4e6098 100644 --- a/fatcat_scholar/templates/search.html +++ b/fatcat_scholar/templates/search.html @@ -87,7 +87,7 @@ {# search results (rendered via macro) #} {% for paper in hits.results %} - {{ search_macros.fulltext_search_result_row(paper) }} + {{ search_macros.fulltext_search_result_row(paper, locale=locale) }} {% endfor %} {% if hits.count_found > hits.limit %} diff --git a/fatcat_scholar/templates/search_macros.html b/fatcat_scholar/templates/search_macros.html index 6d7814c..ca8ef4d 100644 --- a/fatcat_scholar/templates/search_macros.html +++ b/fatcat_scholar/templates/search_macros.html @@ -15,12 +15,14 @@ Szczepanski {% elif tag == "doaj" %} DOAJ + {% elif tag.startswith("lang:") %} + {{ tag }} {% else %} {{ _(tag) }} {% endif %} {% endmacro %} -{% macro fulltext_search_result_row(paper) -%} +{% macro fulltext_search_result_row(paper, locale=None) -%}
{# ### TITLE ROW #} @@ -152,6 +154,9 @@ {% for tag in paper.tags %} {{ tag_label(tag) }} {% endfor %} + {% if paper.biblio.lang_code and paper.biblio.lang_code != (locale or 'en') %} + {{ tag_label("lang:" + paper.biblio.lang_code) }} + {% endif %}
{# ### COLLAPSED HITS #} -- cgit v1.2.3