-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
custom_field: added subject field to community
- Loading branch information
Fatimah
committed
Feb 22, 2024
1 parent
95bf1c3
commit ccd94c1
Showing
3 changed files
with
61 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# Copyright (C) 2023 CERN. | ||
# | ||
# ZenodoRDM is free software; you can redistribute it and/or modify it | ||
# under the terms of the MIT License; see LICENSE file for more details. | ||
|
||
"""Custom fields.""" | ||
from invenio_i18n import lazy_gettext as _ | ||
from invenio_vocabularies.services.custom_fields import VocabularyCF | ||
|
||
COMMUNITY_FIELDS_UI = [ | ||
{ | ||
"section": _("Subjects"), | ||
"fields": [ | ||
dict( | ||
field="es:subjects", | ||
ui_widget="AutocompleteDropdown", | ||
props=dict( | ||
label="Keywords and subjects", | ||
icon="tag", | ||
description="The subjects related to the community", | ||
placeholder="Search for a subject by name e.g. Psychology ...", | ||
autocompleteFrom="/api/vocabularies/languages", | ||
autocompleteFromAcceptHeader="application/vnd.inveniordm.v1+json", | ||
required=False, | ||
multiple=True, | ||
clearable=True, | ||
), | ||
) | ||
], | ||
} | ||
] | ||
|
||
|
||
COMMUNITY_FIELDS = { | ||
VocabularyCF( | ||
name="es:subjects", | ||
vocabulary_id="es:subjects", | ||
multiple=True, | ||
dump_options=False, | ||
) | ||
} | ||
|
||
|
||
COMMUNITY_NAMESPACES = { | ||
"es": "https://op.europa.eu/en/web/eu-vocabularies/dataset/-/resource?uri=http://publications.europa.eu/resource/dataset/euroscivoc", | ||
} |