From 1cd50049945a0d3f27e376fc137ad82b09ea18ab Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 21 Jan 2021 09:56:37 -0800 Subject: html: access button/options tweaks --- fatcat_scholar/templates/base.html | 16 +- fatcat_scholar/templates/search_macros.html | 234 +++++++++++++++------------- 2 files changed, 140 insertions(+), 110 deletions(-) diff --git a/fatcat_scholar/templates/base.html b/fatcat_scholar/templates/base.html index 7f1b2cd..354f111 100644 --- a/fatcat_scholar/templates/base.html +++ b/fatcat_scholar/templates/base.html @@ -48,13 +48,12 @@ .ui.labeled.icon.button.serp-button { padding-left: 3.0em!important; padding-right: 1em!important; - min-width: 10em; - max-width: 15em; + width: 14em; box-shadow: 1px 1px 2px 1px rgba(0, 0, 0, 0.3); } .ui.labeled.icon.button.serp-button .menu.fulltext-thumbnail { - left: calc(-100% - 1.6em); + left: calc(-100% + 0.3em); margin-top: -2.4em; background-color: black; min-width: 186px; @@ -72,7 +71,7 @@ display: flex; justify-content: center; column-gap: 0.3em; - min-width: 12em; + min-width: 14em; max-width: 15em; } @@ -210,10 +209,15 @@ color: inherit; } details.access-options .menu { - /* border: 1px solid black; */ margin: 0.5em; + margin-top: 1.5em; width: auto; - padding: 1em; + } + details.access-options .meta { + width: 100%; + overflow: hidden; + text-overflow: ellipsis; + text-decoration: underline; } details.serp-action-menu[open] > summary .ui.basic.button { diff --git a/fatcat_scholar/templates/search_macros.html b/fatcat_scholar/templates/search_macros.html index d267cdc..ca6d9f5 100644 --- a/fatcat_scholar/templates/search_macros.html +++ b/fatcat_scholar/templates/search_macros.html @@ -50,24 +50,115 @@ {% endif %} {% endmacro %} -{% macro ia_access_button(access) -%} - {% set access_alt = _('fulltext access') %} +{% macro ia_access_button(access, show_thumbnail=False, other_version=False) -%} + {% if access.file_mimetype == "application/pdf" %} + {% set access_alt = _('fulltext PDF download') %} + {% elif access.access_type == "ia_sim" %} + {% set access_alt = _('read fulltext microfilm') %} + {% else %} + {% set access_alt = _('fulltext access') %} + {% endif %} + {% if other_version %} + {% set access_alt = access_alt + " [" + other_version + "]" %} + {% endif %} - {% endmacro %} +{% macro doi_access_button(biblio, is_oa=False) %} + {% if biblio.doi %} + {% set publisher = "" or (biblio.publisher and biblio.publisher.lower()) %} + {% set container_name = "" or (biblio.container_name and biblio.container_name.lower()) %} + + + + {% endif %} +{% endmacro %} + +{% macro platform_access_button(biblio) %} + {# TODO: DOAJ, dblp #} + {% if biblio.arxiv_id %} + + + + {% elif biblio.pmcid %} + + + + {% endif %} +{% endmacro %} + {% macro journal_row(biblio, paper) -%} {# NOTE: should be able to call with paper.biblio or any paper.release[] #} {% if biblio.release_year %} @@ -194,6 +285,11 @@ {% endif %} +
+ + {{ paper.fulltext.access_url }} + +
{% if paper.fulltext.access_type == "wayback" %}

A copy of this work was available on the public web and has been preserved in the Wayback Machine. The capture dates from {{ paper.fulltext.access_url.split('/')[4][:4] }}; you can also visit the original URL. @@ -204,13 +300,14 @@ {% endif %} {% if paper.fulltext.file_mimetype %} -

The file type is {{ paper.fulltext.file_mimetype }}. + {% trans mimetype = ("" + paper.fulltext.file_mimetype + "")|safe %} + The file type is {{ mimetype }}. + {% endtrans %} {% endif %} {% if paper.fulltext.release_ident and (paper.biblio.release_ident != paper.fulltext.release_ident) %} {# Fulltext copy is different from biblio version! #} -

Note that this fulltext copy is not of the "primary" version - of this work. The version it corresponds to is: +

{% trans %}Note that this fulltext copy is not of the "primary" version of this work. The version it corresponds to is:{% endtrans %}

{% for release in paper.releases if release.ident == paper.fulltext.release_ident %} {{ journal_row(release, paper) }} @@ -224,7 +321,7 @@ {# currently, ia_sim access types are not linked to specific versions #} {% for access in paper.access if access.access_type != paper.fulltext.access_type and (access.release_ident == paper.fulltext.release_ident or access.release_ident == paper.biblio.release_ident or access.access_type == 'ia_sim') %} {% if loop.first %} -

Additional access options for the primary version of this work: +

{% trans %}Additional access options for the primary version of this work:{% endtrans %} {% endif %} {{ ia_access_button(access )}} {% endfor %} @@ -242,18 +339,20 @@ {% endif %} {% if paper.releases|length > 1 %} -

- {# #} - Other Versions -

{% for release in paper.releases if (release.ident != paper.biblio.release_ident and release.ident != paper.fulltext.release_ident) %} + {% if loop.first %} +

+ {# #} + Other Versions +

+ {% endif %}
{{ journal_row(release, paper) }}
{{ external_identifiers(release) }}
{% for access in paper.access if access.release_ident == release.ident %} - {{ ia_access_button(access )}} + {{ ia_access_button(access)}} {% endfor %}
{% if not loop.last %} @@ -317,6 +416,14 @@ {{ tag_label("lang:" + paper.biblio.lang_code) }} {% endif %} + {# "Multiple Versions" disabled for now + {% if (paper.access and paper.access|length > 1) or (paper.releases and paper.releases|length > 1) %} + + {% trans %}Multiple Versions{% endtrans %} + + {% endif %} + #} +
@@ -326,100 +433,19 @@ {# archive links (if available) #} {% if paper.fulltext and paper.fulltext.access_url %} - {% if paper.fulltext.file_mimetype == "application/pdf" %} - {% set access_alt = _('fulltext PDF download') %} - {% elif paper.fulltext.access_type == "ia_sim" %} - {% set access_alt = _('read fulltext microfilm') %} + {% if (paper.fulltext.release_ident and paper.fulltext.release_ident != paper.biblio.release_ident) %} + {% set other_version = _("not primary version") %} {% else %} - {% set access_alt = _('fulltext access') %} + {% set other_version = "" %} {% endif %} - - - + {{ ia_access_button(paper.fulltext, show_thumbnail=True, other_version=other_version) }} {% endif %} - {# publisher #} - {% if paper.biblio.doi %} - - - - {% endif %} + {# publisher / repository #} + {{ doi_access_button(paper.biblio, is_oa=("oa" in paper.tags)) }} {# trusted platform fulltext links #} - {# TODO: DOAJ, dblp #} - {% if paper.biblio.arxiv_id %} - - - - {% elif paper.biblio.pmcid %} - - - - {% endif %} - - {# ### VERSIONS #} - {% if (paper.access and paper.access|length > 1) or (paper.releases and paper.releases|length > 1) %} -
- - {% trans %}Multiple Versions{% endtrans %} -
- {% endif %} + {{ platform_access_button(paper.biblio) }} {# ### COLLAPSED HITS #} {% if paper._collapsed_count > 0 %} -- cgit v1.2.3