Skip to content

Commit

Permalink
documents: improve online access information
Browse files Browse the repository at this point in the history
* Moves online resources from the "Descriptions" tab to the header.
* Closes rero#1722.

Co-Authored-by: Bertrand Zuchuat <bertrand.zuchuat@rero.ch>
  • Loading branch information
Garfield-fr committed Jun 2, 2021
1 parent 6ed95ed commit ce57e47
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,30 @@ <h3>
</div>
{% endif %}

<!-- SUBJECTS -->
<!-- ELECTRONIC LOCATOR (Other accesses, types in filters) -->
{% if record.electronicLocator %}
{% set resources = record | get_other_accesses %}
{% if resources | length > 0 %}
<ul class="list-unstyled mb-0">
{% for resource in resources %}
<li>
<a href="{{ resource.url }}">
<i class="fa fa-link"></i>
{{ _(resource.type) }}:
{% if resource.content %}
{{ _(resource.content) }}
{% else %}
{{ resource.url }}
{% endif %}
</a>
{% if resource.public_note %}({{ resource.public_note }}){% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
{% endif %}

<!-- SUBJECTS TERM -->
{% if record.subjects %}
<div class="pt-2">
{% for subject in record.subjects %}
Expand Down
8 changes: 3 additions & 5 deletions rero_ils/modules/documents/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,11 +397,9 @@ def get_other_accesses(record):

def filter_type(electronic_locator):
"""Filter electronic locator for related resources and no info."""
if electronic_locator.get('type') in ['relatedResource', 'noInfo'] \
and electronic_locator.get('content') != 'coverImage':
return True
else:
return False
return electronic_locator.get('type') in [
'noInfo', 'resource', 'relatedResource', 'versionOfResource'
] and electronic_locator.get('content') != 'coverImage'

filtered_electronic_locators = filter(
filter_type,
Expand Down
7 changes: 7 additions & 0 deletions rero_ils/theme/assets/scss/rero_ils/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,13 @@ div.tooltip div.tooltip-inner{
max-width: 400px;
}

.rero-ils-external-link:after {
font-family: 'FontAwesome';
font-size: $font-size-very-small;
vertical-align: top;
content: " \f08e";
}

/*
*********************************
Expand Down
9 changes: 8 additions & 1 deletion tests/unit/test_documents_dojson.py
Original file line number Diff line number Diff line change
Expand Up @@ -4750,7 +4750,14 @@ def test_marc21_to_electronicLocator_from_856(mock_cover_get):
}
]
assert get_cover_art(data) is None
assert get_other_accesses(data) == []
assert get_other_accesses(data) == [
{
'url': 'http://reader.digitale-s.de/r/d/XXX.html',
'type': 'versionOfResource',
'content': 'fullText',
'public_note': 'Vol. 1'
}
]

marc21xml = """
<record>
Expand Down

0 comments on commit ce57e47

Please sign in to comment.