oarepo_config.detail_sidebar
oarepo_config.detail_sidebar
Configuration of the boxes in the record detail page sidebar.
DETAIL_SIDEBAR_TEMPLATES: dict[str, str] = {'manage_menu': 'invenio_app_rdm/records/details/side_bar/manage_menu.html', 'versions': 'invenio_app_rdm/records/details/side_bar/versions.html', 'external_resources': 'invenio_app_rdm/records/details/side_bar/external_resources.html', 'communities': 'invenio_app_rdm/records/details/side_bar/communities.html', 'keywords_subjects': 'invenio_app_rdm/records/details/side_bar/keywords_subjects.html', 'details': 'invenio_app_rdm/records/details/side_bar/details.html', 'locations': 'invenio_app_rdm/records/details/side_bar/locations.html', 'licenses': 'invenio_app_rdm/records/details/side_bar/licenses.html', 'citations': 'invenio_app_rdm/records/details/side_bar/citations.html', 'export': 'oarepo_ui/record_detail/side_bar/export.html', 'technical_metadata': 'invenio_app_rdm/records/details/side_bar/technical_metadata.html', 'metrics': 'invenio_app_rdm/records/details/side_bar/metrics.html', 'ark': 'oarepo_ark/ark_identifier.html'}
module-attribute
Symbolic names of the known sidebar boxes and their templates.
DEFAULT_DETAIL_SIDEBAR = ['manage_menu', 'versions', 'external_resources', 'communities', 'keywords_subjects', 'details', 'licenses', 'citations', 'export', 'metrics', 'technical_metadata']
module-attribute
Boxes set by configure_ui, in this order.
update_detail_sidebar(current: Sequence[str], *, known: Mapping[str, str] | None = None, templates: Mapping[str, str] | None = None, order: Sequence[str] | None = None, move: Sequence[str] | None = None, remove: Sequence[str] | None = None) -> list[str]
Return current (a list of template paths) with the changes applied.
known maps box names to templates of current (e.g. as registered by earlier
calls), taking precedence over
DETAIL_SIDEBAR_TEMPLATES;
templates that have no name are named by their path.
Source code in oarepo_config/detail_sidebar.py
configure_detail_sidebar(*, templates: dict[str, str] | None = None, order: list[str] | None = None, move: list[str] | None = None, remove: list[str] | None = None, model: str | None = None) -> None
Change the boxes shown in the sidebar of the record detail page.
The boxes are referred to by symbolic names (see
DETAIL_SIDEBAR_TEMPLATES):
manage_menu, versions, external_resources, communities,
keywords_subjects, details, locations, licenses,
citations, export, technical_metadata, metrics and ark
(added by configure_ark). A box
registered via templates is referred to by its new name.
The changes are applied to the current sidebar, in this order:
templates, order, move, remove. Must be called after
configure_ui and any other configure_*
function that adds a box (e.g. configure_ark).
Can be called multiple times.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
templates
|
dict[str, str] | None
|
Box name -> template. An existing box gets the new template in place; a new box is appended at the end. |
None
|
order
|
list[str] | None
|
The new order of the boxes. |
None
|
move
|
list[str] | None
|
Moves applied one after another, each one of
|
None
|
remove
|
list[str] | None
|
Boxes to remove. |
None
|
model
|
str | None
|
Change only the sidebar of this model (the model name). Its sidebar starts as a copy of the global one. |
None
|
Invenio configuration variables set:
APP_RDM_DETAIL_SIDE_BAR_TEMPLATES- withoutmodel.OAREPO_UI_SIDEBAR_TEMPLATES[model]- withmodel._OAREPO_CONFIG_DETAIL_SIDEBAR_TEMPLATES- internal: the boxes registered viatemplates, per sidebar (model name,Nonefor the global one), so that later calls know their names.
Example
Source code in oarepo_config/detail_sidebar.py
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | |