Skip to content

Commit

Permalink
landing page: add external resources for BLR
Browse files Browse the repository at this point in the history
  • Loading branch information
jennur committed Dec 12, 2023
1 parent e75bc0f commit dfe15c0
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 1 deletion.
3 changes: 2 additions & 1 deletion invenio.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,7 @@ THEME_SHOW_FRONTPAGE_INTRO_SECTION = False
APP_RDM_RECORD_LANDING_PAGE_TEMPLATE = "zenodo_rdm/records/detail.html"

from zenodo_rdm.utils import (
blr_link_render,
briefideas_link_render,
f1000_link_render,
github_link_render,
Expand All @@ -600,7 +601,7 @@ APP_RDM_RECORD_LANDING_PAGE_EXTERNAL_LINKS = [
{ "id": "briefideas", "render": briefideas_link_render},
{ "id": "openaire", "render": openaire_link_render},
{ "id": "softwareheritage", "render": swh_link_render},

{ "id": "blr", "render": blr_link_render},
]

APP_RDM_DEPOSIT_FORM_DEFAULTS = {
Expand Down
57 changes: 57 additions & 0 deletions site/zenodo_rdm/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,60 @@ def swh_link_render(record):
)
)
return ret


def blr_link_render(record):
"""Entry for BLR."""
ret = []

treatmentbank_link = None
gbif_link = None
sibls_link = None

for identifier in record["metadata"]["identifiers"]:
if re.match("(http|https)://(publication|treatment).plazi.org/id/", identifier["identifier"], re.I):
treatmentbank_link = identifier["identifier"]


for identifier in record["metadata"]["related_identifiers"]:
if (
re.match("(http|https)://www.gbif.org", identifier["identifier"], re.I)
and identifier["relation_type"]["id"] == "issourceof"
):
gbif_link = identifier["identifier"]
elif (
re.match("(http|https)://sibils.text-analytics.ch", identifier["identifier"], re.I)
and identifier["relation_type"]["id"] == "issourceof"
):
sibls_link = identifier["identifier"]

if treatmentbank_link:
ret.append(
dump_external_resource(
treatmentbank_link,
title="TreatmentBank",
section=_("Indexed in"),
icon=url_for("static", filename="images/treatment-bank.png"),
)
)

if gbif_link:
ret.append(
dump_external_resource(
gbif_link,
title="GBIF",
section=_("Indexed in"),
icon=url_for("static", filename="images/gbif.png"),
)
)

if sibls_link:
ret.append(
dump_external_resource(
sibls_link,
title="SIBLS",
section=_("Indexed in"),
icon=url_for("static", filename="images/sib.png"),
)
)
return ret
Binary file added static/images/gbif.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/images/sib.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/images/treatment-bank.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit dfe15c0

Please sign in to comment.