Skip to content

Commit 25b24b9

Browse files
rerowepiGor milhit
authored and
iGor milhit
committed
documents: do not translate URL in detailed view
* Prevents to translate the URL in the `electronicLocator` filed of the document detailed view. It resulted in an 500 Internal server error. Co-Authored-by: Peter Weber <[email protected]>
1 parent 8d8720d commit 25b24b9

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

rero_ils/modules/documents/templates/rero_ils/detailed_view_documents.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,10 @@ <h3>
111111
<ul class="list-unstyled mb-0">
112112
{% for resource in resources %}
113113
<li>
114-
<a href="{{ resource.url }}">
114+
<a class="rero-ils-external-link" href={{ resource.url }}>
115115
{{ _(resource.type) }}
116116
{% if resource.content %}
117-
: {{ _(resource.content) }}
117+
: {{ resource.content }}
118118
{% endif %}
119119
</a>
120120
{% if resource.public_note %}({{ resource.public_note }}){% endif %}

rero_ils/modules/documents/views.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ def filter_type(electronic_locator):
407407
)
408408
for electronic_locator in filtered_electronic_locators:
409409
url = electronic_locator.get('url')
410-
content = electronic_locator.get('content', url)
410+
content = _(electronic_locator.get('content'))
411411
public_notes = electronic_locator.get('publicNote', [])
412412
public_note = ', '.join(public_notes)
413413
accesses.append({

rero_ils/theme/templates/rero_ils/page.html

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
along with this program. If not, see <http://www.gnu.org/licenses/>.
1717

1818
#}
19+
{% set viewcode=viewcode or config.RERO_ILS_SEARCH_GLOBAL_VIEW_CODE %}
1920
<!DOCTYPE html>
2021
<html{% if html_css_classes %} class="{{ html_css_classes|join(' ') }}" {% endif %}
2122
lang="{{ current_i18n.locale.language|safe }}" dir="{{ current_i18n.locale.text_direction }}">

tests/unit/test_documents_dojson.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -5195,7 +5195,7 @@ def test_marc21_to_electronicLocator_from_856(mock_cover_get):
51955195
assert get_cover_art(data) is None
51965196
assert get_other_accesses(data) == [
51975197
{
5198-
'content': 'http://d-nb.info/1071856731/04',
5198+
'content': None,
51995199
'public_note': 'Inhaltsverzeichnis, Bd. 1',
52005200
'type': 'relatedResource',
52015201
'url': 'http://d-nb.info/1071856731/04'
@@ -5243,7 +5243,7 @@ def test_marc21_to_electronicLocator_from_856(mock_cover_get):
52435243
assert get_cover_art(data) == 'http://d-nb.info/image.png'
52445244
assert get_other_accesses(data) == [
52455245
{
5246-
'content': 'http://d-nb.info/1071856731/04',
5246+
'content': None,
52475247
'public_note': 'Inhaltsverzeichnis, Bd. 1',
52485248
'type': 'relatedResource',
52495249
'url': 'http://d-nb.info/1071856731/04'

0 commit comments

Comments
 (0)