Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 18 additions & 15 deletions site/cds_rdm/custom_fields/publishing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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"],
Expand Down
2 changes: 2 additions & 0 deletions site/cds_rdm/ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions site/cds_rdm/templates/semantic-ui/cds_rdm/records/detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,22 @@ <h2 id="record-subtitle" class="wrap-overflowing-text">{{ subtitle.value }}</h2>
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 %}
<div class="ui grid">
<div class="sixteen wide mobile four wide tablet three wide computer column">
<h3 class="ui header">{{ oa_funding_model_field_cfg.props.label }}</h3>
</div>
<div class="sixteen wide mobile twelve wide tablet thirteen wide computer column">
{{ list_vocabulary_values(oa_funding_model_field_cfg.field, oa_funding_model, oa_funding_model_field_cfg) }}
</div>
</div>
<div class="ui divider"></div>
{% endif %}
{# Linked Records Section - Always evaluate to get other records linked to this one #}
{%- set linkedRecordsQuery = record | get_linked_records_search_query %}
{% if linkedRecordsQuery %}
Expand Down
Loading