From 554a5059c3b60d949075577611da7bceadbb4e49 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 12 Apr 2021 15:36:41 -0700 Subject: web: add goatcounter analytics Same setup as scholar.archive.org --- python/fatcat_web/templates/base.html | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'python/fatcat_web/templates') diff --git a/python/fatcat_web/templates/base.html b/python/fatcat_web/templates/base.html index 73f33d0d..c17f81de 100644 --- a/python/fatcat_web/templates/base.html +++ b/python/fatcat_web/templates/base.html @@ -153,6 +153,16 @@ integrity="sha256-9H3HWYnPJ2bEHgkOrw+48KheOqYzTvJd1hbeU9sEDFk=" crossorigin="anonymous"> +{% if config.ENABLE_GOATCOUNTER -%} + + +{%- endif %} {% block postscript %}{% endblock %} -- cgit v1.2.3 From 151832cd805b85bea57cbf888491e081607eb040 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 12 Apr 2021 15:50:44 -0700 Subject: web: improve access button HTML --- python/fatcat_web/templates/file_view.html | 3 +-- python/fatcat_web/templates/release_view.html | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'python/fatcat_web/templates') diff --git a/python/fatcat_web/templates/file_view.html b/python/fatcat_web/templates/file_view.html index 0f5a5fc6..8ed7b084 100644 --- a/python/fatcat_web/templates/file_view.html +++ b/python/fatcat_web/templates/file_view.html @@ -55,9 +55,8 @@ No known archives or mirrors of this file. No Public URL {% endif %} -
-
+
{% if file.size != None %} Size  {{ file.size|filesizeformat }}
{% endif %} diff --git a/python/fatcat_web/templates/release_view.html b/python/fatcat_web/templates/release_view.html index 898cd369..cc7bfc1b 100644 --- a/python/fatcat_web/templates/release_view.html +++ b/python/fatcat_web/templates/release_view.html @@ -203,7 +203,7 @@ accessible version.
{% if entity.state == 'active' and entity._es and entity._es.ia_pdf_url %} - + Read Archived PDF {% elif entity.state == 'active' and entity.webcaptures != [] and entity.webcaptures[0].archive_urls != [] and entity.webcaptures[0].archive_urls[0].rel == "wayback" %} -- cgit v1.2.3 From 42be320518d238d3f26901e17618ff604435a657 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 12 Apr 2021 16:10:54 -0700 Subject: web: improve preservation holdings display for containers --- python/fatcat_web/templates/container_view.html | 32 +++++++++++++++++-------- 1 file changed, 22 insertions(+), 10 deletions(-) (limited to 'python/fatcat_web/templates') diff --git a/python/fatcat_web/templates/container_view.html b/python/fatcat_web/templates/container_view.html index 6ec705b4..0d572c63 100644 --- a/python/fatcat_web/templates/container_view.html +++ b/python/fatcat_web/templates/container_view.html @@ -91,7 +91,7 @@ {% if container.issnl != None or container.wikidata_qid != None %}
{% if container.issnl != None %} - ISSN-L? + ISSN-L?  {{ container.issnl }} {% endif %} {% if container.extra != None and container.extra.issnp != None and (container.extra.issnp|length > 0) %} @@ -135,22 +135,34 @@
{% endif %} +{%- if container.extra and container.extra.kbart %}
Preservation Holdings
-{%- if container.extra and container.extra.kbart %} {% for k, v in container.extra.kbart.items() %} -
{{ k }}: + {% if k == "lockss" %} + LOCKSS: + {% elif k == "clockss" %} + CLOCKSS: + {% elif k == "hathitrust" and container.issnl %} + HathiTrust: + {% elif k == "portico" and container.issnl %} + Portico: + {% else %} + {{ k }}: + {% endif %} + years {% for span in v.year_spans %} - {% if span|length >= 2 %} - {{ span[0] }}-{{ span[1] }} - {% elif span|length == 1 %} - {{ span[0] }} - {% endif %} - {{ ", " if not loop.last }} + {% if span|length >= 2 -%} + {{ span[0] }}-{{ span[1] -}} + {% elif span|length == 1 -%} + {{ span[0] -}} + {% endif -%} + {{- ", " if not loop.last }} {% endfor %} +
{% endfor %} -{% endif %}
+{% endif %}
Lookup Links
-- cgit v1.2.3 From b28547df2025afb7b5d8941e5553865ff5dc29a6 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 12 Apr 2021 16:11:42 -0700 Subject: web: consistent public API URLs --- python/fatcat_web/templates/changelog.html | 6 +----- python/fatcat_web/templates/editgroup_view.html | 2 +- python/fatcat_web/templates/entity_history.html | 2 +- python/fatcat_web/templates/entity_macros.html | 7 +------ python/fatcat_web/templates/entity_view_metadata.html | 2 +- python/fatcat_web/web_config.py | 4 ++++ 6 files changed, 9 insertions(+), 14 deletions(-) (limited to 'python/fatcat_web/templates') diff --git a/python/fatcat_web/templates/changelog.html b/python/fatcat_web/templates/changelog.html index 3ad01d63..59630666 100644 --- a/python/fatcat_web/templates/changelog.html +++ b/python/fatcat_web/templates/changelog.html @@ -37,11 +37,7 @@ inspect every change all the way back to the start.
- {% if config.FATCAT_DOMAIN == "fatcat.wiki" %} - As JSON via API - {% else %} - As JSON via API - {% endif %} + As JSON via API
{% endblock %} diff --git a/python/fatcat_web/templates/editgroup_view.html b/python/fatcat_web/templates/editgroup_view.html index 6a9793f7..e1af719d 100644 --- a/python/fatcat_web/templates/editgroup_view.html +++ b/python/fatcat_web/templates/editgroup_view.html @@ -181,7 +181,7 @@ {{ edit_list(auth_to, editgroup, editgroup.edits.webcaptures, "webcapture", "Web Capture") }}

diff --git a/python/fatcat_web/templates/entity_history.html b/python/fatcat_web/templates/entity_history.html index 0115b845..05fae0c3 100644 --- a/python/fatcat_web/templates/entity_history.html +++ b/python/fatcat_web/templates/entity_history.html @@ -35,7 +35,7 @@ This table only shows accepted edits included in the catalog, not any wor {% endfor %} diff --git a/python/fatcat_web/templates/entity_macros.html b/python/fatcat_web/templates/entity_macros.html index 9207bd48..4b0635e5 100644 --- a/python/fatcat_web/templates/entity_macros.html +++ b/python/fatcat_web/templates/entity_macros.html @@ -36,12 +36,7 @@
Revision: {{ entity.revision }} {% endif %}
API URL: - As JSON via API + As JSON via API
{% if entity.extra %} diff --git a/python/fatcat_web/web_config.py b/python/fatcat_web/web_config.py index 25c93114..3dba933d 100644 --- a/python/fatcat_web/web_config.py +++ b/python/fatcat_web/web_config.py @@ -22,6 +22,10 @@ class Config(object): FATCAT_DOMAIN = os.environ.get("FATCAT_DOMAIN", default="dev.fatcat.wiki") FATCAT_API_AUTH_TOKEN = os.environ.get("FATCAT_API_AUTH_TOKEN", default=None) FATCAT_API_HOST = os.environ.get("FATCAT_API_HOST", default="https://{}/v0".format(FATCAT_DOMAIN)) + public_host_default = f"https://{FATCAT_DOMAIN}/v0" + if FATCAT_DOMAIN == "dev.fatcat.wiki": + public_host_default = FATCAT_API_HOST + FATCAT_PUBLIC_API_HOST = os.environ.get("FATCAT_PUBLIC_API_HOST", default=public_host_default) # can set this to https://search.fatcat.wiki for some experimentation ELASTICSEARCH_BACKEND = os.environ.get("ELASTICSEARCH_BACKEND", default="http://localhost:9200") -- cgit v1.2.3 From 0e4f84d9938c6cf226fac8d2b0d34284a661a071 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 12 Apr 2021 16:19:13 -0700 Subject: web: include DOI in share-your-paper URL, when possible --- python/fatcat_web/templates/release_save.html | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'python/fatcat_web/templates') diff --git a/python/fatcat_web/templates/release_save.html b/python/fatcat_web/templates/release_save.html index 7dd01fc0..c78d0066 100644 --- a/python/fatcat_web/templates/release_save.html +++ b/python/fatcat_web/templates/release_save.html @@ -46,11 +46,17 @@ we will attempt to crawl, process, and verify the content and add it to the catalog. + {% if release and release.ext_ids.doi %} + {% set syp_suffix = release.ext_ids.doi %} + {% else %} + {% set syp_suffix = "" %} + {% endif %} +

If you are the author of this work, and the published version is not publicly available, another option is to upload an version to an institutional or discipline repository. The - Share Your Paper tool can help with - this process. + Share Your Paper + tool can help with this process.

Important: double-check the publication stage of the file you are submitting. We -- cgit v1.2.3 From 3c82729459b4ba8d99000293a5601236c1fea68d Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 12 Apr 2021 16:19:31 -0700 Subject: web: better logic for showing 'save-paper-now' link --- python/fatcat_web/templates/release_view.html | 2 ++ 1 file changed, 2 insertions(+) (limited to 'python/fatcat_web/templates') diff --git a/python/fatcat_web/templates/release_view.html b/python/fatcat_web/templates/release_view.html index cc7bfc1b..90ea6592 100644 --- a/python/fatcat_web/templates/release_view.html +++ b/python/fatcat_web/templates/release_view.html @@ -225,7 +225,9 @@ accessible version.

Not Preserved
+ {% endif %} + {% if entity._es.preservation != 'bright' %}
Save Paper Now! -- cgit v1.2.3 From 7a106645f663db71020baaec147abbac896613ce Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 12 Apr 2021 16:19:50 -0700 Subject: web: show file size not known, when it isn't This is mostly to prevent showing an empty metadata box --- python/fatcat_web/templates/file_view.html | 2 ++ 1 file changed, 2 insertions(+) (limited to 'python/fatcat_web/templates') diff --git a/python/fatcat_web/templates/file_view.html b/python/fatcat_web/templates/file_view.html index 8ed7b084..3afd0099 100644 --- a/python/fatcat_web/templates/file_view.html +++ b/python/fatcat_web/templates/file_view.html @@ -59,6 +59,8 @@ No known archives or mirrors of this file.
{% if file.size != None %} Size  {{ file.size|filesizeformat }}
+ {% else %} + Size  (unknown)
{% endif %} {% if file.mimetype != None %} MIME Type  {{ file.mimetype }}
-- cgit v1.2.3 From 09caaed60efbf525d7eadb73887b50843bd2d9bd Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 12 Apr 2021 17:30:01 -0700 Subject: prefer contrib.creator.display_name over contrib.raw_name These will be getting updates from ORCID and are usually more complete and more correct for display, attribution, and search purposes. Might need to tweak fuzzycat code to handle multiple names at the verification stage. --- python/fatcat_tools/transforms/csl.py | 6 +++--- python/fatcat_tools/transforms/elasticsearch.py | 5 ++++- python/fatcat_web/templates/entity_base.html | 4 ++-- python/fatcat_web/templates/release_view_contribs.html | 11 ++++++++--- 4 files changed, 17 insertions(+), 9 deletions(-) (limited to 'python/fatcat_web/templates') diff --git a/python/fatcat_tools/transforms/csl.py b/python/fatcat_tools/transforms/csl.py index ba199efb..15bb369f 100644 --- a/python/fatcat_tools/transforms/csl.py +++ b/python/fatcat_tools/transforms/csl.py @@ -33,19 +33,19 @@ def release_to_csl(entity): if contrib.creator: # Default to "local" (publication-specific) metadata; fall back to # creator-level - family = contrib.surname or contrib.creator.surname or (contrib.raw_name and contrib.raw_name.split()[-1]) + family = contrib.creator.surname or contrib.surname or (contrib.raw_name and contrib.raw_name.split()[-1]) if not family: # CSL requires some surname (family name) continue c = dict( family=family, - given=contrib.given_name or contrib.creator.given_name, + given=contrib.creator.given_name or contrib.given_name, #dropping-particle #non-dropping-particle #suffix #comma-suffix #static-ordering - literal=contrib.raw_name or contrib.creator.display_name, + literal=contrib.creator.display_name or contrib.raw_name, #parse-names, # role must be defined; default to author role=contrib.role or 'author', diff --git a/python/fatcat_tools/transforms/elasticsearch.py b/python/fatcat_tools/transforms/elasticsearch.py index 4bf9091a..331ca4e7 100644 --- a/python/fatcat_tools/transforms/elasticsearch.py +++ b/python/fatcat_tools/transforms/elasticsearch.py @@ -113,10 +113,13 @@ def release_to_elasticsearch(entity: ReleaseEntity, force_bool: bool = True) -> contrib_affiliations = [] creator_ids = [] for c in (release.contribs or []): - if c.raw_name: + if c.creator and c.creator.display_ame: + contrib_names.append(c.creator.display_ame) + elif c.raw_name: contrib_names.append(c.raw_name) elif c.surname: contrib_names.append(c.surname) + if c.creator_id: creator_ids.append(c.creator_id) if c.raw_affiliation: diff --git a/python/fatcat_web/templates/entity_base.html b/python/fatcat_web/templates/entity_base.html index f30df0da..36280f5d 100644 --- a/python/fatcat_web/templates/entity_base.html +++ b/python/fatcat_web/templates/entity_base.html @@ -65,8 +65,8 @@

{% if entity._authors and entity._authors != [] %} by {% for contrib in entity._authors[:12] %} - {% if contrib.creator_id %} - {{ contrib.raw_name }}{% if not loop.last %}, {% endif %} + {% if contrib.creator_id and contrib.creator and contrib.creator.display_name %} + {{ contrib.creator.display_name }}{% if not loop.last %}, {% endif %} {% else %} {% if contrib.raw_name != None %}{{ contrib.raw_name }}{% else %}Unknown{% endif %}{% if not loop.last %}, {% endif %} {% endif %} diff --git a/python/fatcat_web/templates/release_view_contribs.html b/python/fatcat_web/templates/release_view_contribs.html index 55cdf133..f4969e32 100644 --- a/python/fatcat_web/templates/release_view_contribs.html +++ b/python/fatcat_web/templates/release_view_contribs.html @@ -12,12 +12,17 @@ {% for contrib in release.contribs %} {% if contrib.index or contrib.index == 0 %} {{ contrib.index + 1 }}{% endif %}