-
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.
* search for related records only within BLR community * adjust empty search results to absence of search bar * add a new loader placeholder
- Loading branch information
1 parent
f34ea49
commit b5268aa
Showing
7 changed files
with
120 additions
and
78 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
19 changes: 19 additions & 0 deletions
19
...rdm/assets/semantic-ui/js/zenodo_rdm/src/blr-related-works/components/BlrResultsLoader.js
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,19 @@ | ||
import React from "react"; | ||
import { Placeholder } from "semantic-ui-react"; | ||
|
||
export const BlrResultsLoader = (children, loading) => { | ||
return loading ? ( | ||
<Placeholder fluid> | ||
<Placeholder.Header image> | ||
<Placeholder.Line length="long" /> | ||
<Placeholder.Line /> | ||
</Placeholder.Header> | ||
<Placeholder.Header image> | ||
<Placeholder.Line length="long" /> | ||
<Placeholder.Line /> | ||
</Placeholder.Header> | ||
</Placeholder> | ||
) : ( | ||
children | ||
); | ||
}; |
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,33 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# Copyright (C) 2024 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. | ||
|
||
"""Filters to be used in the Jinja templates.""" | ||
|
||
from invenio_records.dictutils import dict_lookup | ||
|
||
|
||
def is_blr_related_record(record): | ||
"""Check if we need to display related records for this record.""" | ||
valid_types = [ | ||
"Figure", | ||
"Taxonomic treatment", | ||
"Book chapter", | ||
"Journal article", | ||
"Drawing", | ||
] | ||
|
||
try: | ||
slug = dict_lookup(record, "expanded.parent.communities.default.slug") | ||
resource_type = dict_lookup(record, "metadata.resource_type.title.en") | ||
is_valid_type = resource_type in valid_types | ||
|
||
if slug == "biosyslit" and is_valid_type: | ||
return True | ||
|
||
return False | ||
except KeyError: | ||
return False |
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