diff --git a/rero_ils/config.py b/rero_ils/config.py
index 35a8eb4faf..f280a33204 100644
--- a/rero_ils/config.py
+++ b/rero_ils/config.py
@@ -549,7 +549,8 @@ def _(x):
'https://www.google-analytics.com',
'https://services.test.rero.ch',
'https://services.rero.ch',
- 'https://cdn.jsdelivr.net'
+ 'https://cdn.jsdelivr.net',
+ 'https://www.babelio.com'
]
},
'content_security_policy_report_uri': None,
@@ -3984,3 +3985,9 @@ def search_type(field):
}
},
]
+
+# Babeltheque Configuration
+# ========================
+RERO_ILS_APP_BABELTHEQUE_CONFIG = {
+ 'enabled_views': ['global', 'vs']
+}
diff --git a/rero_ils/modules/documents/templates/rero_ils/detailed_view_documents.html b/rero_ils/modules/documents/templates/rero_ils/detailed_view_documents.html
index dad7691285..487d133f85 100644
--- a/rero_ils/modules/documents/templates/rero_ils/detailed_view_documents.html
+++ b/rero_ils/modules/documents/templates/rero_ils/detailed_view_documents.html
@@ -1,7 +1,7 @@
{# -*- coding: utf-8 -*-
RERO ILS
- Copyright (C) 2019-2023 RERO
+ Copyright (C) 2019-2024 RERO
Copyright (C) 2019-2023 UCLouvain
This program is free software: you can redistribute it and/or modify
@@ -20,9 +20,14 @@
{%- extends 'rero_ils/page.html' %}
{% from 'rero_ils/macros/macro.html' import div, dict_values, div_list, dl, dl_row, dl_dict, dl_list, div_json %}
+{% set isbn = record|get_first_isbn %}
+
{%- block css %}
{{ super() }}
{{ node_assets('@rero/rero-ils-ui/dist/public-holdings-items', ['styles.*css'], 'css') }}
+ {% if viewcode | babeltheque_enabled_view %}
+ {{ webpack['babeltheque.css'] }}
+ {% endif %}
{%- endblock css %}
{%- block body %}
@@ -277,6 +282,15 @@
{% endif %}
+ {% if viewcode | babeltheque_enabled_view and isbn is not undefined %}
+
+
+
+
ETIQUETTES
+
SUGGESTIONS
+
CITATIONS
+
+ {% endif %}
{%- block record_body %}
@@ -293,6 +307,15 @@
{{ _('Description') }}
+ {% if viewcode | babeltheque_enabled_view %}
+
+
+ {{ _('More infos') }}
+
+
+ {% endif %}
@@ -322,6 +345,15 @@
{{ _('Description') }}
+ {% if viewcode | babeltheque_enabled_view %}
+
+
+ {{ _('More infos') }}
+
+
+ {% endif %}
@@ -344,6 +376,17 @@
{% include('rero_ils/_documents_description.html') %}
+ {% if viewcode | babeltheque_enabled_view %}
+
+
+
LITT
+
CRIT
+
AUTEUR
+
VIDEO
+
PODCAST
+
+
+ {% endif %}
{% endif %}
@@ -372,4 +415,7 @@ {{ _('Export Formats') }}:
{%- block javascript %}
{{ super() }}
{{ node_assets('@rero/rero-ils-ui/dist/public-holdings-items', tags='defer') }}
+{% if viewcode | babeltheque_enabled_view %}
+
+{% endif %}
{% endblock javascript %}
diff --git a/rero_ils/modules/documents/views.py b/rero_ils/modules/documents/views.py
index 2ae9d4ae6f..795903d4aa 100644
--- a/rero_ils/modules/documents/views.py
+++ b/rero_ils/modules/documents/views.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# RERO ILS
-# Copyright (C) 2019-2023 RERO
+# Copyright (C) 2019-2024 RERO
# Copyright (C) 2019-2023 UCLouvain
#
# This program is free software: you can redistribute it and/or modify
@@ -118,6 +118,26 @@ def doc_item_view_method(pid, record, template=None, **kwargs):
)
+@blueprint.app_template_filter()
+def babeltheque_enabled_view(view):
+ """Check if the view is activated for babeltheque."""
+ enabled_views = current_app.config.get(
+ 'RERO_ILS_APP_BABELTHEQUE_CONFIG', {}).get('enabled_views', [])
+ return view in enabled_views
+
+
+@blueprint.app_template_filter()
+def get_first_isbn(record):
+ """Get first isbn result."""
+ # ISBN
+ isbns = [
+ identified_by.get('value')
+ for identified_by in record.get('identifiedBy', [])
+ if identified_by.get('type') == 'bf:Isbn'
+ ]
+ return isbns[0] if isbns else None
+
+
@blueprint.app_template_filter()
def note_general(notes):
"""Preprocess notes to extract only general type."""
diff --git a/rero_ils/theme/assets/scss/rero_ils/babeltheque.scss b/rero_ils/theme/assets/scss/rero_ils/babeltheque.scss
new file mode 100644
index 0000000000..7cc08b0caa
--- /dev/null
+++ b/rero_ils/theme/assets/scss/rero_ils/babeltheque.scss
@@ -0,0 +1,125 @@
+/*
+
+ RERO ILS
+ Copyright (C) 2019-2024 RERO
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, version 3 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+
+ */
+
+/* Titre Etiquettes */
+#BW_etiquettes h2 {}
+
+#BW_ulEti {
+ max-width:250px;
+}
+/* Element liste */
+#BW_ulEti ul {
+ margin:0;
+ padding:0;
+ list-style-type: none;
+}
+
+/* Différentes tailles selon la fréquence */
+#BW_ulEti a.tag_s0 {
+ font-weight: 120;
+ font-size: 0.8em;
+}
+#BW_ulEti a.tag_s1 {
+ font-weight: 150;
+ font-size: 0.9em;
+}
+#BW_ulEti a.tag_s2 {
+ font-weight: 180;
+ font-size: 1.0em;
+}
+#BW_ulEti a.tag_s3 {
+ font-weight: 200;
+ font-size: 1.2em;
+}
+#BW_ulEti a.tag_s4 {
+ font-weight: 220;
+ font-size: 1.4em;
+}
+#BW_ulEti a.tag_s5 {
+ font-weight: 230;
+ font-size: 1.5em;
+}
+#BW_ulEti a.tag_s6 {
+ font-weight: 320;
+ font-size: 1.6em;
+}
+#BW_ulEti a.tag_s7 {
+ font-weight: 350;
+ font-size: 1.7em;
+}
+#BW_ulEti a.tag_s8 {
+ font-weight: 400;
+ font-size: 1.8em;
+}
+#BW_ulEti {
+ padding: 0px;
+ line-height: 2em;
+ text-align: center;
+}
+#BW_ulEti a {
+ padding: 2px;
+}
+#BW_ulEti {
+ margin: 0px;
+}
+
+/* Affichage en nuage. Pour afficher les étiquettes en liste commenter cette ligne.*/
+#BW_ulEti ol {
+ float: left;
+ display: inline;
+}
+
+/* Zone Notes */
+#BW_notes {
+ clear : left;
+ padding: 5px;
+}
+/* Titre notes */
+#BW_notes h2 {}
+
+/*zone Citations*/
+#BW_citations {
+ padding: 5px;
+}
+/*titre citations*/
+#BW_citations h2 {}
+
+
+/* Zone Critiques */
+#BW_critiques {
+ padding: 5px;
+}
+/* Titre critiques */
+#BW_critiques h2 {}
+
+/* Zone vidéo */
+.BW_vignette_vid {
+ width: 200px;
+}
+
+/* Zone biographie auteur */
+#BW_bio_auteur {}
+
+/* Zone biographie autres */
+#BW_bio_titre {}
+
+.bio_details {}
+
+/* Zone prix littéraires */
+#BW_prix_litt {}
diff --git a/rero_ils/theme/webpack.py b/rero_ils/theme/webpack.py
index aa2c09509a..6e284feeeb 100644
--- a/rero_ils/theme/webpack.py
+++ b/rero_ils/theme/webpack.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# RERO ILS
-# Copyright (C) 2019-2022 RERO
+# Copyright (C) 2019-2024 RERO
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
@@ -30,7 +30,8 @@
'assets',
entry={
'global': './scss/rero_ils/styles.scss',
- 'reroils_public': './js/reroils/public.js'
+ 'reroils_public': './js/reroils/public.js',
+ 'babeltheque': './scss/rero_ils/babeltheque.scss'
},
dependencies={
'popper.js': '1.16.1',
diff --git a/tests/ui/documents/test_documents_filter.py b/tests/ui/documents/test_documents_filter.py
index e7dc724623..aa0421d21a 100644
--- a/tests/ui/documents/test_documents_filter.py
+++ b/tests/ui/documents/test_documents_filter.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# RERO ILS
-# Copyright (C) 2019 RERO
+# Copyright (C) 2019-2024 RERO
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
@@ -16,9 +16,11 @@
# along with this program. If not, see .
"""Document filters tests."""
-from rero_ils.modules.documents.views import cartographic_attributes, \
- contribution_format, doc_entity_label, identified_by, main_title_text, \
- note_general, notes_except_general, part_of_format, provision_activity, \
+
+from rero_ils.modules.documents.views import babeltheque_enabled_view, \
+ cartographic_attributes, contribution_format, doc_entity_label, \
+ get_first_isbn, identified_by, main_title_text, note_general, \
+ notes_except_general, part_of_format, provision_activity, \
provision_activity_not_publication, provision_activity_original_date, \
provision_activity_publication, title_variants, work_access_point
from rero_ils.modules.entities.models import EntityType
@@ -629,3 +631,23 @@ def test_doc_entity_label_filter(entity_person, local_entity_person):
assert 'textual' == entity_type
assert 'subject topic' == value
assert 'subject topic - Sub 1 - Sub 2' == label
+
+
+def test_babeltheque_enabled_view(app):
+ """Check enabled view for babeltheque."""
+ app.config['RERO_ILS_APP_BABELTHEQUE_CONFIG'] = {
+ 'enabled_views': ['global']
+ }
+ assert babeltheque_enabled_view('global')
+ assert not babeltheque_enabled_view('foo')
+
+
+def test_get_first_isbn():
+ """Get the first isbn on identifiedBy field."""
+ record = {'identifiedBy': [
+ {'type': 'bf:Isbn', 'value': '9782501053006'},
+ {'type': 'bf:Isbn', 'value': '9782501033671'}
+ ]}
+ assert '9782501053006' == get_first_isbn(record)
+ record = {'identifiedBy': []}
+ assert None is get_first_isbn(record)