diff --git a/site/cds_rdm/custom_fields/publishing.py b/site/cds_rdm/custom_fields/publishing.py index 9250e4bc..9a5d9013 100644 --- a/site/cds_rdm/custom_fields/publishing.py +++ b/site/cds_rdm/custom_fields/publishing.py @@ -22,6 +22,23 @@ ), ] +OA_FUNDING_MODEL_FIELD_CFG = dict( + field="cern:oa_funding_model", + ui_widget="Dropdown", + landing_page_search_attr="id", + props=dict( + label=_("Publication funding model"), + icon="dollar sign", + description=_( + "Optionally select how open access was obtained for this publication. Check https://sis.web.cern.ch/practical-information/faq/open-access-publishing for more info" + ), + search=True, + multiple=False, + clearable=True, + autocompleteFrom="/api/vocabularies/open_access_funding_models", + ), +) + PUBLISHING_FIELDS_UI = { "section": _("Publishing information (Imprint, Journal, Thesis)"), "hide_from_landing_page": True, @@ -32,21 +49,7 @@ # journal *JOURNAL_CUSTOM_FIELDS_UI["fields"] + [ - dict( - field="cern:oa_funding_model", - ui_widget="Dropdown", - props=dict( - label=_("Publication funding model"), - icon="dollar sign", - description=_( - "Optionally select how open access was obtained for this publication. Check https://sis.web.cern.ch/practical-information/faq/open-access-publishing for more info" - ), - search=True, - multiple=False, - clearable=True, - autocompleteFrom="/api/vocabularies/open_access_funding_models", - ), - ), + OA_FUNDING_MODEL_FIELD_CFG, ], # imprint *IMPRINT_CUSTOM_FIELDS_UI["fields"], diff --git a/site/cds_rdm/ext.py b/site/cds_rdm/ext.py index 4c175196..81eb77ef 100644 --- a/site/cds_rdm/ext.py +++ b/site/cds_rdm/ext.py @@ -12,6 +12,7 @@ from cds_rdm.clc_sync.resources.utils import get_clc_sync_entry from cds_rdm.clc_sync.services.config import CLCSyncServiceConfig from cds_rdm.clc_sync.services.service import CLCSyncService +from cds_rdm.custom_fields.publishing import OA_FUNDING_MODEL_FIELD_CFG from cds_rdm.inspire_harvester.reports.download.resources import ( HarvesterDownloadResource, HarvesterDownloadResourceConfig, @@ -46,6 +47,7 @@ def init_app(self, app): get_committee_approval_state ) app.jinja_env.globals["evaluate_permissions"] = evaluate_permissions + app.jinja_env.globals["oa_funding_model_field_cfg"] = OA_FUNDING_MODEL_FIELD_CFG # Register filter for building linked records search query app.jinja_env.filters["get_linked_records_search_query"] = ( get_linked_records_search_query diff --git a/site/cds_rdm/templates/semantic-ui/cds_rdm/records/detail.html b/site/cds_rdm/templates/semantic-ui/cds_rdm/records/detail.html index 312d42cc..e972c1e9 100644 --- a/site/cds_rdm/templates/semantic-ui/cds_rdm/records/detail.html +++ b/site/cds_rdm/templates/semantic-ui/cds_rdm/records/detail.html @@ -91,8 +91,22 @@

{{ subtitle.value }}

display_name=display_name) }} {%- endblock record_file_list -%} +{%- from "invenio_app_rdm/records/macros/detail.html" import list_vocabulary_values %} + {%- block record_details -%} {{super()}} +{%- set oa_funding_model = record_ui["ui"]["custom_fields"].get("cern:oa_funding_model") %} +{% if oa_funding_model %} +
+
+

{{ oa_funding_model_field_cfg.props.label }}

+
+
+ {{ list_vocabulary_values(oa_funding_model_field_cfg.field, oa_funding_model, oa_funding_model_field_cfg) }} +
+
+
+{% endif %} {# Linked Records Section - Always evaluate to get other records linked to this one #} {%- set linkedRecordsQuery = record | get_linked_records_search_query %} {% if linkedRecordsQuery %}