diff --git a/rero_ils/config.py b/rero_ils/config.py index 7ce7b5ec4d..50bafb2dd8 100644 --- a/rero_ils/config.py +++ b/rero_ils/config.py @@ -999,13 +999,15 @@ def _(x): record_serializers={ "application/json": "rero_ils.modules.serializers:json_v1_response" }, - record_serializers_aliases={ - "json": "application/json", - }, + record_serializers_aliases={"json": "application/json"}, search_serializers={ "application/json": "rero_ils.modules.serializers:json_v1_search", "application/rero+json": "rero_ils.modules.holdings.serializers:json_holdings_search", }, + search_serializers_aliases={ + "json": "application/json", + "rero+json": "application/json", + }, list_route="/holdings/", record_loaders={ "application/json": lambda: Holding(request.get_json()), diff --git a/rero_ils/jsonschemas/common/countries-v0.0.1.json b/rero_ils/jsonschemas/common/countries-v0.0.1.json index 27252dbd96..ec62ae505d 100644 --- a/rero_ils/jsonschemas/common/countries-v0.0.1.json +++ b/rero_ils/jsonschemas/common/countries-v0.0.1.json @@ -382,6 +382,8 @@ "formlyConfig": { "props": { "sort": true, + "placeholder": "Select an option…", + "sortOrder": "asc", "filter": true, "itemCssClass": "col-lg-4", "options": [ diff --git a/rero_ils/modules/documents/templates/rero_ils/_anonymous_button.html b/rero_ils/modules/documents/templates/rero_ils/_anonymous_button.html deleted file mode 100644 index 6a2aa26d3c..0000000000 --- a/rero_ils/modules/documents/templates/rero_ils/_anonymous_button.html +++ /dev/null @@ -1,23 +0,0 @@ -{# -*- coding: utf-8 -*- - - RERO ILS - Copyright (C) 2019-2022 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 . - -#} -{%- if current_user.is_anonymous %} - - {{ _('Log in (to see request options)') }} - -{%- endif %} diff --git a/rero_ils/modules/documents/templates/rero_ils/_document_online.html b/rero_ils/modules/documents/templates/rero_ils/_document_online.html deleted file mode 100644 index 0f68c32f3e..0000000000 --- a/rero_ils/modules/documents/templates/rero_ils/_document_online.html +++ /dev/null @@ -1,67 +0,0 @@ -{# -*- coding: utf-8 -*- - - RERO ILS - Copyright (C) 2019-2022 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 . - -#} -{% set holdings = record.pid|online_holdings(viewcode) %} -{% for library,accesses in holdings.items() %} -
- -
-
-
- {{ library }} -
-
- {{ _('Online') }} -
-
-
- -
-
-
    - {% for access in accesses %} -
  • - {% for elocation in access.electronic_location %} - - {% endfor %} - {% if access.enumerationAndChronology %} -
    -
    {{ _('Unit') }}
    -
    {{ access.enumerationAndChronology }}
    -
    - {% endif %} - - {% for note in access.notes %} -
    -
    {{ _(note.type) }}
    -
    {{ note.content}}
    -
    - {% endfor %} -
  • - {% endfor %} -
-
-
-
-{% endfor %} diff --git a/rero_ils/modules/documents/templates/rero_ils/_documents_description.html b/rero_ils/modules/documents/templates/rero_ils/_documents_description.html deleted file mode 100644 index 08305fb527..0000000000 --- a/rero_ils/modules/documents/templates/rero_ils/_documents_description.html +++ /dev/null @@ -1,553 +0,0 @@ -{# -*- coding: utf-8 -*- - - RERO ILS - Copyright (C) 2019-2022 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 . - -#} -
- - - - {% if record.fiction_statement %} -
-
{{ _('Fiction statement') }}
-
- {{ _(record.fiction_statement) }} -
-
- {% endif %} - - - {% with fieldLabel=_('Supplement'), data=record.supplement, header=false %} - {% include 'rero_ils/_other_edition.html' %} - {% endwith %} - - {% with fieldLabel=_('Related to'), data=record.relatedTo, header=false %} - {% include 'rero_ils/_other_edition.html' %} - {% endwith %} - - - {% if record.note %} - {% set noteGeneral = record.note | note_general %} - {% if noteGeneral %} -
-
{{ _('General note') }}
-
-
    - {% for note in noteGeneral.general %} -
  • {{ note }}
  • - {% endfor %} -
-
-
- {% endif %} - {% endif %} - - - {% if record.credits %} -
-
{{ _('Other responsibilities') }}
-
-
    - {% for credit in record.credits %} -
  • {{ credit }}
  • - {% endfor %} -
-
-
- {% endif %} - - - {% if record.language and record.language | length > 0 %} -
-
{{ _('Language') }}
-
-
    - {% for language in record.language %} -
  • {{ _('lang_' + language.value) }}
  • - {% endfor %} -
-
-
- {% endif %} - - - {% if record.originalLanguage and record.originalLanguage | length > 0 %} -
-
{{ _('Original language') }}
-
-
    - {% for language in record.originalLanguage %} -
  • {{ _('lang_' + language) }}
  • - {% endfor %} -
-
-
- {% endif %} - - - {% if record.originalTitle %} -
-
{{ _('Original title') }}
-
-
    - {% for title in record.originalTitle %} -
  • {{ title }}
  • - {% endfor %} -
-
-
- {% endif %} - - - {% if record.work_access_point %} - {% set workauthorized_access_point = record.work_access_point | work_access_point %} -
-
{{ _('Work') }}
-
-
    - {% for work in workauthorized_access_point %} -
  • {{ work }}
  • - {% endfor %} -
-
-
- {% endif %} - - - {% if record.tableOfContents %} -
-
{{ _('Contents') }}
-
-
    - {% for table in record.tableOfContents %} -
  • {{ table }}
  • - {% endfor %} -
-
-
- {% endif %} - - - {% if record.dissertation %} -
-
{{ _('Thesis') }}
-
-
    - {% for dissertation in record.dissertation %} - {% for label in dissertation.label %} -
  • {{ label.value }}
  • - {% endfor %} - {% endfor %} -
-
-
- {% endif %} - - - {% if record.intendedAudience %} -
-
{{ _('Intended audience') }}
-
-
    - {% for audience in record.intendedAudience %} -
  • {{ _(audience.value) }}
  • - {% endfor %} -
-
-
- {% endif %} - - - {% if record.illustrativeContent %} -
-
{{ _('Illustrations') }}
-
-
    - {% for illustrative in record.illustrativeContent %} -
  • {{ illustrative }}
  • - {% endfor %} -
-
-
- {% endif %} - - - {% if record.colorContent %} -
-
{{ _('Colors') }}
-
-
    - {% for color in record.colorContent %} -
  • {{ _(color) }}
  • - {% endfor %} -
-
-
- {% endif %} - - - {% if record.scale %} -
-
{{ _('Scale') }}
-
-
    - {% for scale in record.scale %} -
  • {{ scale.label }}
  • - {% endfor %} -
-
-
- {% endif %} - - - {% if record.cartographicAttributes %} - {% set attributes = record.cartographicAttributes | cartographic_attributes %} - {% if attributes | length > 0 %} -
-
{{ _('Cartographic data') }}
-
-
    - {% for attribute in attributes %} -
  • - {% if 'projection' in attribute %}{{ attribute.projection }}{% endif %} - {% if ('projection' in attribute) and ('coordinates' in attribute) and ('label' in attribute.coordinates) %};{% endif %} - {% if ('coordinates' in attribute) and ('label' in attribute.coordinates) %}{{ attribute.coordinates.label }}{% endif %} -
  • - {% endfor %} -
-
-
- {% endif %} - {% endif %} - - - {% if record.classification %} -
-
{{ _('Classification') }}
-
-
    - {% for classification in record.classification %} -
  • - {{ classification.classificationPortion }} - {% if 'subdivision' in classification %} - - - {% for sub in classification.subdivision %} - {{ sub }} - {% if not loop.last %} - {% endif %} - {% endfor %} - {% endif %} - ({{ _(classification.type) }}) -
  • - {% endfor %} -
-
-
- {% endif %} - - - - - - {% if record.usageAndAccessPolicy %} -
-
{{ _('Use and access condition') }}
-
-
    - {% for usage in record.usageAndAccessPolicy %} -
  • {{ usage.label }}
  • - {% endfor %} -
-
-
- {% endif %} - - - {% with fieldLabel=_('Other edition'), data=record.otherEdition, header=false %} - {% include 'rero_ils/_other_edition.html' %} - {% endwith %} - - {% with fieldLabel=_('Also issued as'), data=record.otherPhysicalFormat, header=false %} - {% include 'rero_ils/_other_edition.html' %} - {% endwith %} - - {% with fieldLabel=_('Reproduced as'), data=record.hasReproduction, header=false %} - {% include 'rero_ils/_other_edition.html' %} - {% endwith %} - - - {% if record.title %} - {% set variants = record.title | title_variants %} - {% for key, value in variants.items() %} -
-
{{ _(key) | capitalize }}
-
-
    - {% for title in value %} -
  • {{ title }}
  • - {% endfor %} -
-
-
- {% endfor %} - {% endif %} - - - {% if record.responsibilityStatement %} -
-
{{ _('Statement of responsibility') }}
-
-
    - {% for responsibility in record.responsibilityStatement %} - {% for resp in responsibility %} -
  • {{ resp.value }}
  • - {% endfor %} - {% endfor %} -
-
-
- {% endif %} - - - {% if record.seriesStatement %} -
-
{{ _('Series statement') }}
-
-
    - {% for series in record.seriesStatement | series_statement_format %} - {% for serie in series %} -
  • {{ serie.value }}
  • - {% endfor %} - {% endfor %} -
-
-
- {% endif %} - - - {% if record.provisionActivity %} - {% set provisions = record.provisionActivity | provision_activity | provision_activity_not_publication %} - {% for key, provisions in provisions.items() %} -
-
{{ _(key) }}
-
-
    - {% for provision in provisions %} -
  • {{ provision.value }}
  • - {% endfor %} -
-
-
- {% endfor %} - {% endif %} - - - {% if record.provisionActivity %} - {% set provisions = record.provisionActivity | provision_activity_original_date %} - {% if provisions | length > 0 %} -
-
{{ _('Date of the original') }}
-
-
    - {% for provision in provisions %} -
  • {{ provision }}
  • - {% endfor %} -
-
-
- {% endif %} - {% endif %} - - - {% if record.copyrightDate %} -
-
{{ _('Copyright date') }}
-
-
    - {% for copyright in record.copyrightDate %} -
  • {{ copyright }}
  • - {% endfor %} -
-
-
- {% endif %} - - - {% if record.sequence_numbering %} -
-
{{ _('Numbering') }}
-
{{ record.sequence_numbering }}
-
- {% endif %} - - - {% if record.dimensions %} -
-
{{ _('Dimensions') }}
-
-
    - {% for dimension in record.dimensions %} -
  • {{ dimension }}
  • - {% endfor %} -
-
-
- {% endif %} - - - {% if record.bookFormat %} -
-
{{ _('Format') }}
-
-
    - {% for format in record.bookFormat %} -
  • {{ format }}
  • - {% endfor %} -
-
-
- {% endif %} - - - {% if record.productionMethod %} -
-
{{ _('Production method') }}
-
-
    - {% for method in record.productionMethod %} -
  • {{ _(method) }}
  • - {% endfor %} -
-
-
- {% endif %} - - - {% if record.note %} - {% set notes = record.note | notes_except_general %} - {% if notes %} - {% for key, notes in notes.items() %} -
-
{{ _(key) }}
-
-
    - {% for note in notes %} -
  • {{ note }}
  • - {% endfor %} -
-
-
- {% endfor %} - {% endif %} - {% endif %} - - - {% if record.supplementaryContent %} -
-
{{ _('Supplementary content') }}
-
-
    - {% for sup in record.supplementaryContent %} -
  • {{ sup }}
  • - {% endfor %} -
-
-
- {% endif %} - - - {% if record.acquisitionTerms %} -
-
{{ _('Terms of availability') }}
-
-
    - {% for term in record.acquisitionTerms %} -
  • {{ term }}
  • - {% endfor %} -
-
-
- {% endif %} - - - {% if record.identifiedBy %} - {% set identifiedby = record.identifiedBy | identified_by %} - {% if identifiedby | length > 0 %} -
-
{{ _('Identifier') }}
-
-
    - {% for identifier in identifiedby %} -
  • - {% if identifier.type == "uri" %} - {{ identifier.value }} - {% else %} - {{ identifier.value }} - {% endif %} - {% if identifier.details != '' %} - - {{ identifier.details }} - {% endif %} - {{ _(identifier.type)|safe }} -
  • - {% endfor %} -
-
-
- {% endif %} - {% endif %} - - - - - - {% if record.contentMediaCarrier %} -
-
{{ _('Carrier and content type') }}
-
-
    - {% for content in record.contentMediaCarrier %} -
  • - {{ _(content.carrierType) }} - {%- if 'contentType' in content %} - ({%- for type in content.contentType -%} - {{ _(type) }}{% if not loop.last %}, {% endif %} - {%- endfor -%}) - {% endif %} -
  • - {% endfor %} -
-
-
- {% endif %} - - - {% if record.issuance %} -
-
{{ _('Mode of issuance') }}
-
- {{ _(record.issuance.main_type) }} / {{ _(record.issuance.subtype) }} -
-
- {% endif %} - - -
-
{{ _('Permalink') }}
-
- {% set permalink = url_for('invenio_records_ui.doc', viewcode=viewcode, pid_value=record.pid, _external=True) %} - {{ permalink }} -
-
-
diff --git a/rero_ils/modules/documents/templates/rero_ils/_ill_request_button.html b/rero_ils/modules/documents/templates/rero_ils/_ill_request_button.html deleted file mode 100644 index 941fe4d0b0..0000000000 --- a/rero_ils/modules/documents/templates/rero_ils/_ill_request_button.html +++ /dev/null @@ -1,35 +0,0 @@ -{# -*- coding: utf-8 -*- - - RERO ILS - Copyright (C) 2019-2022 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 . - -#} -{% if - config.RERO_ILS_ILL_REQUEST_ON_GLOBAL_VIEW - and current_user - and current_user.is_authenticated - and current_patrons|length > 0 - and viewcode == config.RERO_ILS_SEARCH_GLOBAL_VIEW_CODE - and not record.harvested -%} - {{ _('interlibrary_loan') | capitalize }} -{% endif %} 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 b8c0f3b8a7..4a62bed4d6 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 @@ -24,8 +24,7 @@ {%- block css %} {{ super() }} - {{ node_assets('@rero/rero-ils-ui/dist/public-holdings-items', ['styles.*css'], 'css') }} - {% if viewcode | babeltheque_enabled_view %} + {% if viewcode | babeltheque_enabled_view and isbn is not none %} {{ webpack['babeltheque.css'] }} {% endif %} {%- endblock css %} @@ -34,26 +33,6 @@
{{ _('Back') }}
-{%- set formats = export_formats(pid.pid_type) %} -{%- if formats %} -
-
- -
-
-{%- endif %}
{%- set icon_name = record | document_main_type(false) %} {%- set covert_art = record | get_cover_art %} @@ -296,131 +275,36 @@

{%- block record_body %}
- {% if not(holdings_count > 0 or es_record.files) %} -
- -
-
-
-
- {% include('rero_ils/_documents_description.html') %} -
-
- {% else %} -
- -
-
- {% if holdings_count > 0 or es_record.files %} -
- {% if holdings_count > 0 %} - {% include('rero_ils/_anonymous_button.html') %} - {% endif %} - {% if record.harvested and record|n_electronic_holdings %} - {% include('rero_ils/_document_online.html') %} - {% else %} - - {% endif %} - - {% if holdings_count > 0 %} - {% include('rero_ils/_ill_request_button.html') %} - {% endif %} -
- {% endif %} -
- {% include('rero_ils/_documents_description.html') %} -
- {% if viewcode | babeltheque_enabled_view %} -
- - -
-
-
-
{{ _('No additionnal information yet.') }}
+
+ + {% if viewcode | babeltheque_enabled_view and isbn is not none %} + + + +
+
+
+
{{ _('No additional information yet.') }}
+
+
+
+
-
-
-
-
-
-
-
-
-
-
- {% endif %} -
- {% endif %} +
+
+
+
+
+ + {% endif %} + +

- -
- {%- set formats = export_formats(pid.pid_type) %} - {%- if formats %} -
{{ _('Export Formats') }}:
- - {%- endif %} -
{%- endblock record_body %} {%- endblock body %} diff --git a/rero_ils/modules/documents/views.py b/rero_ils/modules/documents/views.py index fc836653ce..eb2835fe58 100644 --- a/rero_ils/modules/documents/views.py +++ b/rero_ils/modules/documents/views.py @@ -26,43 +26,30 @@ from elasticsearch_dsl.query import Q from flask import Blueprint, current_app, render_template, url_for from flask_babel import gettext as _ -from flask_login import current_user from invenio_records_ui.signals import record_viewed -from rero_ils.modules.collections.api import CollectionsSearch from rero_ils.modules.entities.api import Entity from rero_ils.modules.entities.helpers import get_entity_record_from_data -from rero_ils.modules.entities.models import EntityType -from rero_ils.modules.holdings.models import HoldingNoteTypes -from rero_ils.modules.items.models import ItemCirculationAction -from rero_ils.modules.libraries.api import Library from rero_ils.modules.locations.api import Location from rero_ils.modules.organisations.api import Organisation from rero_ils.modules.patrons.api import current_patrons from rero_ils.modules.utils import extracted_data_from_ref -from ..collections.api import CollectionsSearch from ..entities.api import Entity -from ..entities.models import EntityType -from ..holdings.models import HoldingNoteTypes -from ..items.models import ItemCirculationAction -from ..libraries.api import Library from ..locations.api import Location from ..organisations.api import Organisation from ..patrons.api import current_patrons from ..utils import extracted_data_from_ref -from .api import Document, DocumentsSearch +from .api import Document from .dumpers import document_indexer_dumper from .extensions import ( EditionStatementExtension, ProvisionActivitiesExtension, - SeriesStatementExtension, TitleExtension, ) from .utils import ( display_alternate_graphic_first, get_remote_cover, - title_format_text, title_format_text_alternate_graphic, title_variant_format_text, ) @@ -146,37 +133,6 @@ def get_first_isbn(record): return isbns[0] if isbns else None -@blueprint.app_template_filter() -def note_general(notes): - """Preprocess notes to extract only general type.""" - return sort_by_type(list(filter(lambda t: t["noteType"] == "general", notes))) - - -@blueprint.app_template_filter() -def notes_except_general(notes): - """Preprocess notes to extract all note except general type.""" - return sort_by_type(list(filter(lambda t: t["noteType"] != "general", notes))) - - -def sort_by_type(notes): - """Sort notes by type.""" - by_type = {} - for note in notes: - by_type.setdefault(note["noteType"], []) - by_type[note["noteType"]].append(note["label"]) - return by_type - - -@blueprint.app_template_filter() -def cartographic_attributes(attributes): - """Preprocess cartographic attributes.""" - return [ - attribute - for attribute in attributes - if "projection" in attribute or attribute.get("coordinates", {}).get("label") - ] - - @blueprint.app_template_filter() def provision_activity(provisions): """Preprocess provision activity.""" @@ -196,81 +152,6 @@ def provision_activity_publication(provisions): return {"bf:Publication": provisions.get("bf:Publication", [])} -@blueprint.app_template_filter() -def provision_activity_not_publication(provisions): - """Extact other than publication of provision activity.""" - if "bf:Publication" in provisions: - provisions.pop("bf:Publication") - return provisions - - -@blueprint.app_template_filter() -def provision_activity_original_date(provisions): - """Preprocess provision activity original date.""" - return [ - provision["original_date"] - for provision in provisions - if "original_date" in provision - ] - - -@blueprint.app_template_filter() -def title_variants(titles): - """Preprocess title variants.""" - variants = {} - bf_titles = list(filter(lambda t: t["type"] != "bf:Title", titles)) - for title in bf_titles: - title_texts = title_format_text(title, with_subtitle=True) - variants.setdefault(title["type"], []) - variants[title["type"]].append(title_texts[0].get("value")) - return variants - - -@blueprint.app_template_filter() -def identified_by(identifiedby): - """Preprocess identified by.""" - output = [] - for identifier in identifiedby: - details = [] - # Replace bf:Local by source - id_type = identifier.get("type") - if id_type == "bf:Local": - id_type = identifier.get("source") - # Format qualifier, status and note - if identifier.get("qualifier"): - details.append(identifier.get("qualifier")) - if identifier.get("status"): - details.append(identifier.get("status")) - if identifier.get("note"): - details.append(identifier.get("note")) - output.append( - { - "type": id_type, - "value": identifier.get("value"), - "details": ", ".join(details), - } - ) - return output - - -@blueprint.app_template_filter() -def can_request(item): - """Check if the current user can request a given item.""" - if current_user.is_authenticated: - patron = None - for p in current_patrons: - if p.organisation_pid == item.organisation_pid: - patron = p - if patron: - can, reasons = item.can( - ItemCirculationAction.REQUEST, - patron=patron, - library=Library.get_record_by_pid(patron.library_pid), - ) - return can, reasons - return False, [] - - @blueprint.app_template_filter() def contribution_format(contributions, language, viewcode, with_roles=False): """Format contribution for template in given language. @@ -399,107 +280,6 @@ def part_of_format(part_of): return output -@blueprint.app_template_filter() -def record_library_pickup_locations(record): - """Get the pickup locations of the library of the given item or holding.""" - location_pid = extracted_data_from_ref(record.get("location")) - location = Location.get_record_by_pid(location_pid) - # Either the location defines some 'restrict_pickup_to' either not. - # * If 'restrict_pickup_to' is defined, then only these locations are - # eligible as possible pickup_locations - # * Otherwise, get all organisation pickup locations - # of the record belongs to - if "restrict_pickup_to" in location: - # Get all pickup locations as Location objects and append it to the - # location record (removing possible None values) - pickup_locations = [ - Location.get_record_by_pid(loc_pid) - for loc_pid in location.restrict_pickup_to - ] - else: - org = Organisation.get_record_by_pid(location.organisation_pid) - # Get the pickup location from each library of the record organisation - # (removing possible None value) - pickup_locations = [] - for library in org.get_libraries(): - pickup_locations.extend( - Location.get_record_by_pid(location_pid) - for location_pid in list(library.get_pickup_locations_pids()) - ) - return sorted( - list(filter(None, pickup_locations)), - key=lambda location: location.get("pickup_name", location.get("code")), - ) - - -@blueprint.app_template_filter() -def work_access_point(work_access_point): - """Process work access point data.""" - wap = [] - for work in work_access_point: - agent_formatted = "" - if agent := work.get("creator"): - if agent["type"] == EntityType.PERSON: - # Person - name = [] - if "preferred_name" in agent: - name.append(agent["preferred_name"]) - if "numeration" in agent: - name.append(agent["numeration"]) - elif "fuller_form_of_name" in agent: - name.append(f"({agent['fuller_form_of_name']})") - if len(name): - agent_formatted += f"{', '.join(name)}, " - if "numeration" in agent and "qualifier" in agent: - agent_formatted += f"{agent['qualifier']}, " - dates = [ - agent[key] - for key in ["date_of_birth", "date_of_death"] - if key in agent - ] - if len(dates): - agent_formatted += f"{'-'.join(dates)}. " - if "numeration" not in agent and "qualifier" in agent: - agent_formatted += f"{agent['qualifier']}. " - else: - # Organisation - if "preferred_name" in agent: - agent_formatted += agent["preferred_name"] + ". " - if "subordinate_unit" in agent: - for unit in agent["subordinate_unit"]: - agent_formatted += f"{unit}. " - if ( - "numbering" in agent - or "conference_date" in agent - or "place" in agent - ): - conf = [ - agent[key] for key in ["numbering", "conference_date", "place"] - ] - if len(conf): - agent_formatted += f"({' : '.join(conf)}) " - agent_formatted += f"{work['title']}. " - if "part" in work: - for part in work["part"]: - for key in ["partNumber", "partName"]: - if key in part: - agent_formatted += f"{part[key]}. " - if "miscellaneous_information" in work: - agent_formatted += f"{work['miscellaneous_information']}. " - if "language" in work: - agent_formatted += f"{_('lang_'+work['language'])}. " - if "medium_of_performance_for_music" in work: - agent_formatted += f"{'. '.join(work['medium_of_performance_for_music'])}. " - if "key_for_music" in work: - agent_formatted += f"{work['key_for_music']}. " - if "arranged_statement_for_music" in work: - agent_formatted += f"{work['arranged_statement_for_music']}. " - if "date_of_work" in work: - agent_formatted += f"{work['date_of_work']}. " - wap.append(agent_formatted.strip()) - return wap - - @blueprint.app_template_filter() def create_publication_statement(provision_activity): """Create publication statement from place, agent and date values.""" @@ -622,62 +402,6 @@ def create_title_alternate_graphic(titles, responsibility_statement=None): return output -@blueprint.app_template_filter() -def create_title_variants(titles): - """Create the list of variant titles as text for detail view. - - :param titles: list of title objects - :type titles: list - :return: list of variant titles as text for detail view - :rtype: list - """ - output = [] - title_variant_texts = title_variant_format_text(titles=titles, with_subtitle=True) - for title_variant_text in title_variant_texts: - value = title_variant_text.get("value") - if value not in output: - output.append(value) - return output - - -@blueprint.app_template_filter() -def create_title_responsibilites(responsibilityStatement): - """Create the list of title responsibilites as text for detail view. - - :param responsibilityStatement: list of responsibilityStatement - :type responsibilityStatement: list - :return: list of title responsibilites as text for detail view - :rtype: list - - """ - output = [] - for responsibility in responsibilityStatement: - for responsibility_language in responsibility: - value = responsibility_language.get("value") - if value not in output: - language = responsibility_language.get("language", "default") - if display_alternate_graphic_first(language): - output.insert(0, value) - else: - output.append(value) - return output - - -@blueprint.app_template_filter() -def in_collection(item_pid): - """Find item in published collection(s). - - :param item_pid: item pid - :return: list of collections whose item is present - """ - return list( - CollectionsSearch() - .filter("term", items__pid=item_pid) - .filter("term", published=True) - .scan() - ) - - @blueprint.app_template_filter() def document_types(record, translate: bool = True) -> list[str]: """Get document types. @@ -706,82 +430,83 @@ def document_main_type(record, translate: bool = True) -> Optional[str]: @blueprint.app_template_filter() -def get_articles(record): - """Get articles for serial. +def main_title_text(title): + """Extract title with type bf:Title. - :return: list of articles with title and pid- + :param title: array of the field title. """ - search = ( - DocumentsSearch() - .filter("term", partOf__document__pid=record.get("pid")) - .source(["pid", "title"]) - ) - return [ - {"title": TitleExtension.format_text(hit.title), "pid": hit.pid} - for hit in search.scan() - ] + return list(filter(lambda t: t.get("type") == "bf:Title", title)) @blueprint.app_template_filter() -def n_electronic_holdings(record): - """Get the number of electronic holdings for this document. - - :return: integer of number of electronic holdings - """ - return Document.get_n_available_holdings(record.pid)[1] +def record_library_pickup_locations(record): + """Get the pickup locations of the library of the given item or holding.""" + location_pid = extracted_data_from_ref(record.get("location")) + location = Location.get_record_by_pid(location_pid) + # Either the location defines some 'restrict_pickup_to' either not. + # * If 'restrict_pickup_to' is defined, then only these locations are + # eligible as possible pickup_locations + # * Otherwise, get all organisation pickup locations + # of the record belongs to + if "restrict_pickup_to" in location: + # Get all pickup locations as Location objects and append it to the + # location record (removing possible None values) + pickup_locations = [ + Location.get_record_by_pid(loc_pid) + for loc_pid in location.restrict_pickup_to + ] + else: + org = Organisation.get_record_by_pid(location.organisation_pid) + # Get the pickup location from each library of the record organisation + # (removing possible None value) + pickup_locations = [] + for library in org.get_libraries(): + pickup_locations.extend( + Location.get_record_by_pid(location_pid) + for location_pid in list(library.get_pickup_locations_pids()) + ) + return sorted( + list(filter(None, pickup_locations)), + key=lambda location: location.get("pickup_name", location.get("code")), + ) @blueprint.app_template_filter() -def online_holdings(document_pid, viewcode="global"): - """Find holdings by document pid and viewcode. - - :param document_pid: document pid - :param viewcode: symbol of organisation viewcode - :return: list of holdings - """ - from ..holdings.api import HoldingsSearch - - organisation = None - if viewcode != current_app.config.get("RERO_ILS_SEARCH_GLOBAL_VIEW_CODE"): - organisation = Organisation.get_record_by_viewcode(viewcode) - query = ( - HoldingsSearch() - .filter("term", document__pid=document_pid) - .filter("bool", must_not=[Q("term", _masked=True)]) - ) - - if organisation: - query = query.filter("term", organisation__pid=organisation.pid) - results = query.source( - ["library", "electronic_location", "enumerationAndChronology", "notes"] - ).scan() - - holdings = {} - for record in results: - library = Library.get_record_by_pid(record.library.pid) - library_holdings = holdings.get(library["name"], []) - record.library.name = library["name"] - if public_notes_content := [ - n["content"] - for n in record.to_dict().get("notes", []) - if n["type"] in HoldingNoteTypes.PUBLIC - ]: - record.notes = public_notes_content - library_holdings.append(record) - holdings[library["name"]] = library_holdings - return holdings +def create_title_responsibilites(responsibilityStatement): + """Create the list of title responsibilites as text for detail view. + :param responsibilityStatement: list of responsibilityStatement + :type responsibilityStatement: list + :return: list of title responsibilites as text for detail view + :rtype: list -@blueprint.app_template_filter() -def series_statement_format(series): - """Series statement format.""" - return [SeriesStatementExtension.format_text(serie) for serie in series] + """ + output = [] + for responsibility in responsibilityStatement: + for responsibility_language in responsibility: + value = responsibility_language.get("value") + if value not in output: + language = responsibility_language.get("language", "default") + if display_alternate_graphic_first(language): + output.insert(0, value) + else: + output.append(value) + return output @blueprint.app_template_filter() -def main_title_text(title): - """Extract title with type bf:Title. +def create_title_variants(titles): + """Create the list of variant titles as text for detail view. - :param title: array of the field title. + :param titles: list of title objects + :type titles: list + :return: list of variant titles as text for detail view + :rtype: list """ - return list(filter(lambda t: t.get("type") == "bf:Title", title)) + output = [] + title_variant_texts = title_variant_format_text(titles=titles, with_subtitle=True) + for title_variant_text in title_variant_texts: + value = title_variant_text.get("value") + if value not in output: + output.append(value) + return output diff --git a/rero_ils/modules/ill_requests/templates/rero_ils/ill_request_form.html b/rero_ils/modules/ill_requests/templates/rero_ils/ill_request_form.html index 40c165d49a..7247849be0 100644 --- a/rero_ils/modules/ill_requests/templates/rero_ils/ill_request_form.html +++ b/rero_ils/modules/ill_requests/templates/rero_ils/ill_request_form.html @@ -111,5 +111,4 @@ - {%- endblock body %} diff --git a/rero_ils/modules/patrons/templates/rero_ils/patron_profile.html b/rero_ils/modules/patrons/templates/rero_ils/patron_profile.html index 63f8eb3082..5620e562d7 100644 --- a/rero_ils/modules/patrons/templates/rero_ils/patron_profile.html +++ b/rero_ils/modules/patrons/templates/rero_ils/patron_profile.html @@ -18,13 +18,8 @@ #} {% extends 'rero_ils/page.html' %} -{%- block css %} -{{ super() }} -{{ node_assets('@rero/rero-ils-ui/dist/public-patron-profile', ['styles.*css'], 'css') }} -{%- endblock css %} - {%- block body %} - + {%- endblock body %} {%- block javascript %} diff --git a/rero_ils/modules/patrons/views.py b/rero_ils/modules/patrons/views.py index 54967e5dad..a11bdebc3f 100644 --- a/rero_ils/modules/patrons/views.py +++ b/rero_ils/modules/patrons/views.py @@ -25,7 +25,6 @@ from flask import Blueprint, abort, current_app, jsonify, render_template from flask import request as flask_request -from flask_babel import format_currency from flask_babel import lazy_gettext as _ from flask_login import current_user, login_required from flask_menu import register_menu @@ -35,14 +34,11 @@ from rero_ils.modules.decorators import ( check_logged_as_librarian, - check_logged_as_patron, check_logged_user_authentication, ) from rero_ils.modules.ill_requests.api import ILLRequestsSearch -from rero_ils.modules.items.utils import item_pid_to_object from rero_ils.modules.loans.api import get_loans_stats_by_patron_pid, get_overdue_loans from rero_ils.modules.loans.utils import sum_for_fees -from rero_ils.modules.locations.api import Location from rero_ils.modules.organisations.dumpers import OrganisationLoggedUserDumper from rero_ils.modules.patron_transactions.utils import ( get_transactions_total_amount_for_patron, @@ -166,8 +162,9 @@ def logged_user(): return jsonify(data) -@blueprint.route("//patrons/profile", methods=["GET", "POST"]) -@check_logged_as_patron +@blueprint.route("//patrons/profile/", defaults={"path": ""}) +@blueprint.route("//patrons/profile/") +@login_required @register_menu( blueprint, "settings.patron_profile", @@ -176,18 +173,17 @@ def logged_user(): id="my-profile-menu", order=-1, ) -def profile(viewcode): +def profile(viewcode, path): """Patron Profile Page.""" + if (path not in ["user/edit", "password/edit"]) and not current_patrons: + abort(401) + if (path in ["user/edit", "password/edit"]) and current_app.config.get( + "RERO_PUBLIC_USERPROFILES_READONLY" + ): + abort(401) return render_template("rero_ils/patron_profile.html", viewcode=viewcode) -@blueprint.app_template_filter("format_currency") -def format_currency_filter(value, currency): - """Format currency with current locale.""" - if value: - return format_currency(value, currency) - - @api_blueprint.route("/roles_management_permissions", methods=["GET"]) @check_logged_as_librarian def get_roles_management_permissions(): @@ -195,35 +191,6 @@ def get_roles_management_permissions(): return jsonify({"allowed_roles": get_allowed_roles_management()}) -@blueprint.app_template_filter("get_patron_from_checkout_item_pid") -def get_patron_from_checkout_item_pid(item_pid): - """Get patron from a checked out item pid.""" - from invenio_circulation.api import get_loan_for_item - - patron_pid = get_loan_for_item(item_pid_to_object(item_pid))["patron_pid"] - return Patron.get_record_by_pid(patron_pid) - - -@blueprint.app_template_filter("get_checkout_loan_for_item") -def get_checkout_loan_for_item(item_pid): - """Get patron from a checkout item pid.""" - from invenio_circulation.api import get_loan_for_item - - return get_loan_for_item(item_pid_to_object(item_pid)) - - -@blueprint.app_template_filter("get_patron_from_pid") -def get_patron_from_pid(patron_pid): - """Get patron from pid.""" - return Patron.get_record_by_pid(patron_pid) - - -@blueprint.app_template_filter("get_location_name_from_pid") -def get_location_name_from_pid(location_pid): - """Get location from pid.""" - return Location.get_record_by_pid(location_pid)["name"] - - @api_blueprint.route("//messages", methods=["GET"]) @check_logged_user_authentication def get_messages(patron_pid): @@ -237,10 +204,10 @@ def get_messages(patron_pid): for note in patron.get("notes", []): if note.get("type") == "public_note": messages.append({"type": "warning", "content": note.get("content")}) - bootstrap_alert_mapping = {"error": "danger"} + prime_alert_mapping = {"warning": "warn"} for message in messages: msg_type = message["type"] - message["type"] = bootstrap_alert_mapping.get(msg_type, msg_type) + message["type"] = prime_alert_mapping.get(msg_type, msg_type) return jsonify(messages) diff --git a/rero_ils/modules/users/jsonschemas/users/user-v0.0.1.json b/rero_ils/modules/users/jsonschemas/users/user-v0.0.1.json index 0ede19d560..d841a9808c 100644 --- a/rero_ils/modules/users/jsonschemas/users/user-v0.0.1.json +++ b/rero_ils/modules/users/jsonschemas/users/user-v0.0.1.json @@ -77,6 +77,7 @@ }, "gender": { "title": "Gender", + "type": "string", "enum": [ "male", "female", @@ -86,15 +87,16 @@ "widget": { "formlyConfig": { "props": { + "placeholder": "Select an option\u2026", "options": [ - { - "label": "male", - "value": "male" - }, { "label": "female", "value": "female" }, + { + "label": "male", + "value": "male" + }, { "label": "other", "value": "other" @@ -162,7 +164,7 @@ "widget": { "formlyConfig": { "props": { - "itemCssClass": "col-lg-12" + "itemCssClass": "col-12" } } } diff --git a/rero_ils/modules/users/templates/rero_ils/user_password.html b/rero_ils/modules/users/templates/rero_ils/user_password.html deleted file mode 100644 index f676aafaa3..0000000000 --- a/rero_ils/modules/users/templates/rero_ils/user_password.html +++ /dev/null @@ -1,29 +0,0 @@ -{# -*- coding: utf-8 -*- - - RERO ILS - Copyright (C) 2019-2022 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 . - -#} -{% extends 'rero_ils/page.html' %} - -{%- block body %} -

{{ _('Change password') }}

- -{%- endblock body %} - -{%- block javascript %} -{{ webpack['reroils_public.js']}} -{{ node_assets('@rero/rero-ils-ui/dist/public-user-password-change', tags='type="module"') }} -{%- endblock javascript %} diff --git a/rero_ils/modules/users/templates/rero_ils/user_profile.html b/rero_ils/modules/users/templates/rero_ils/user_profile.html deleted file mode 100644 index 033b515d7a..0000000000 --- a/rero_ils/modules/users/templates/rero_ils/user_profile.html +++ /dev/null @@ -1,29 +0,0 @@ -{# -*- coding: utf-8 -*- - - RERO ILS - Copyright (C) 2019-2022 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 . - -#} -{% extends 'rero_ils/page.html' %} - -{%- block body %} -

{{ _('Profile') }}

- -{%- endblock body %} - -{%- block javascript %} -{{ webpack['reroils_public.js']}} -{{ node_assets('@rero/rero-ils-ui/dist/public-user-profile-edit', tags='type="module"') }} -{%- endblock javascript %} diff --git a/rero_ils/modules/users/views.py b/rero_ils/modules/users/views.py index 21d882f0c1..d27a597dbb 100644 --- a/rero_ils/modules/users/views.py +++ b/rero_ils/modules/users/views.py @@ -22,7 +22,7 @@ import json from functools import wraps -from flask import Blueprint, abort, current_app, render_template, request +from flask import Blueprint, abort, current_app, request from flask_login import current_user from invenio_rest import ContentNegotiatedMethodView @@ -204,19 +204,3 @@ def post(self): template_folder="templates", static_folder="static", ) - - -@blueprint.route("//user/profile") -@check_user_readonly_permission -def profile(viewcode): - """User Profile editor Page.""" - return render_template("rero_ils/user_profile.html", viewcode=viewcode) - - -@blueprint.route("//user/password") -@check_user_readonly_permission -def password(viewcode): - """User change password Page.""" - return render_template( - "rero_ils/user_password.html", viewcode=viewcode, current_user=current_user - ) diff --git a/rero_ils/theme/assets/scss/rero_ils/babeltheque.scss b/rero_ils/theme/assets/scss/rero_ils/babeltheque.scss index b938f4b0cd..a3479164db 100644 --- a/rero_ils/theme/assets/scss/rero_ils/babeltheque.scss +++ b/rero_ils/theme/assets/scss/rero_ils/babeltheque.scss @@ -16,116 +16,117 @@ along with this program. If not, see . */ - -#BW_suggestions, -#BW_notes, -#BW_etiquettes, -#BW_prix_litt, -#BW_critiques, -#BW_critiques_pro, -#BW_citations, -#BW_bio_auteur, -#BW_videos, -#BW_podcasts { - margin-top: 16px; - padding: 0 !important; -} - -#BW_notes img { - margin-bottom: 6px; -} - -#BW_etiquettes h2, -.BW_critiques_opac_add, -.BW_citations_opac_add { - display: none; -} - -#BW_ulEti { - display: flex; - gap: 6px; - align-items: center; - justify-content: center; - flex-wrap: wrap; - padding-inline-start: 0; - max-width: 400px !important; -} - -#BW_ulEti ol { - padding-inline-start: 0; - text-transform: lowercase; -} - -#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; -} - -.babelio-block, -.bw_list_recos { - display: flex; - flex-wrap: wrap; - gap: 20px; -} - -.babelio-block div, -.bw_list_recos div { - flex-grow: 1; -} - -.babelio-block div:empty, -.BW_critiques_OPAC { - display: none; -} - -#BW_prix_litt ul { - list-style: none; - padding-inline-start: 0; - flex-wrap: wrap; -} - -#BW_bio_titre, -.bw_h2 { - font-size: 1.3em; -} - -.BW_couv_suggestions { - max-height: 140px; - max-width: 100px; -} - -.bw_boxclose { - color: white !important; +@layer babel { + #BW_suggestions, + #BW_notes, + #BW_etiquettes, + #BW_prix_litt, + #BW_critiques, + #BW_critiques_pro, + #BW_citations, + #BW_bio_auteur, + #BW_videos, + #BW_podcasts { + margin-top: 16px; + padding: 0 !important; + } + + #BW_notes img { + margin-bottom: 6px; + } + + #BW_etiquettes h2, + .BW_critiques_opac_add, + .BW_citations_opac_add { + display: none; + } + + #BW_ulEti { + display: flex; + gap: 6px; + align-items: center; + justify-content: center; + flex-wrap: wrap; + padding-inline-start: 0; + max-width: 400px !important; + } + + #BW_ulEti ol { + padding-inline-start: 0; + text-transform: lowercase; + } + + #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: 1em; + } + #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; + } + + .babelio-block, + .bw_list_recos { + display: flex; + flex-wrap: wrap; + gap: 20px; + } + + .babelio-block div, + .bw_list_recos div { + flex-grow: 1; + } + + .babelio-block div:empty, + .BW_critiques_OPAC { + display: none; + } + + #BW_prix_litt ul { + list-style: none; + padding-inline-start: 0; + flex-wrap: wrap; + } + + #BW_bio_titre, + .bw_h2 { + font-size: 1.3em !important; + } + + .BW_couv_suggestions { + max-height: 140px; + max-width: 100px; + } + + .bw_boxclose { + color: white !important; + } } diff --git a/rero_ils/theme/assets/scss/rero_ils/styles.scss b/rero_ils/theme/assets/scss/rero_ils/styles.scss index 0aa8b4ceda..09a0b95f37 100644 --- a/rero_ils/theme/assets/scss/rero_ils/styles.scss +++ b/rero_ils/theme/assets/scss/rero_ils/styles.scss @@ -17,78 +17,88 @@ along with this program. If not, see . */ +:root { + font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, + "Helvetica Neue", Helvetica, Arial, sans-serif; + --font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", + Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 1rem; +} -@import "variables"; - -// Setting the path to fonts files. $fa-font-path: "~font-awesome/fonts"; $icon-font-path: "~bootstrap-sass/assets/fonts/bootstrap/"; -@import '~bootstrap/scss/bootstrap'; @import "~font-awesome/scss/font-awesome"; -// general styles -@import "page"; -@import "header"; -@import "footer"; -@import "search"; -@import "frontpage"; -@import "thumbnail"; +@layer bootstrap, babel, primeng, rero-ils-ui; -// modules -@import "contributions/detailed"; -@import "patrons/profile"; -@import "documents/detailed"; +@layer bootstrap { + @import "variables"; -// bootstrap extension + // Setting the path to fonts files. + @import "~bootstrap/scss/bootstrap"; -.mw-25 { - max-width: 25%; -} + // general styles + @import "page"; + @import "header"; + @import "footer"; + @import "search"; + @import "frontpage"; + @import "thumbnail"; -.mw-50 { - max-width: 50%; -} + // modules + @import "contributions/detailed"; + @import "patrons/profile"; + @import "documents/detailed"; -.mw-75 { - max-width: 75%; -} + // bootstrap extension -// cover -.rero-ils-cover-logo { - width: 10em; -} + .mw-25 { + max-width: 25%; + } -// CSS code to allow `ng-csp="no-inline-css"` -[ng\:cloak], -[ng-cloak], -[data-ng-cloak], -[x-ng-cloak], -.ng-cloak, -.x-ng-cloak, -.ng-hide:not(.ng-hide-animate) { - display: none !important; -} + .mw-50 { + max-width: 50%; + } -ng\:form { - display: block; -} + .mw-75 { + max-width: 75%; + } -.ng-animate-shim { - visibility:hidden; -} + // cover + .rero-ils-cover-logo { + width: 10em; + } -.ng-anchor { - position:absolute; -} + // CSS code to allow `ng-csp="no-inline-css"` + [ng\:cloak], + [ng-cloak], + [data-ng-cloak], + [x-ng-cloak], + .ng-cloak, + .x-ng-cloak, + .ng-hide:not(.ng-hide-animate) { + display: none !important; + } + ng\:form { + display: block; + } -// TODO: to correct a display bug with webkit browsers + .ng-animate-shim { + visibility: hidden; + } -html [type=button] { - -webkit-appearance: none; -} + .ng-anchor { + position: absolute; + } -/* + // TODO: to correct a display bug with webkit browsers + + html [type="button"] { + -webkit-appearance: none; + } + + /* ********************************* GLOBAL @@ -96,40 +106,40 @@ html [type=button] { ******************************** */ -.rero-ils-external-link:after { - font-family: 'FontAwesome'; - font-size: $font-size-very-small; - vertical-align: top; - content: " \f08e"; -} - -.required::after { - content: " *"; - color: $red; - font-weight: bold; -} - -.no-data { - color: $secondary; -} - -button:disabled { - pointer-events: none; -} - -div.tooltip div.tooltip-inner{ - text-align: left; - max-width: 400px; -} - -.rero-ils-external-link:after { - font-family: 'FontAwesome'; - font-size: $font-size-very-small; - vertical-align: top; - content: " \f08e"; -} - -/* + .rero-ils-external-link:after { + font-family: "FontAwesome"; + font-size: $font-size-very-small; + vertical-align: top; + content: " \f08e"; + } + + .required::after { + content: " *"; + color: $red; + font-weight: bold; + } + + .no-data { + color: $secondary; + } + + button:disabled { + pointer-events: none; + } + + div.tooltip div.tooltip-inner { + text-align: left; + max-width: 400px; + } + + .rero-ils-external-link:after { + font-family: "FontAwesome"; + font-size: $font-size-very-small; + vertical-align: top; + content: " \f08e"; + } + + /* ********************************* TOAST @@ -137,59 +147,60 @@ div.tooltip div.tooltip-inner{ ******************************** */ -.toast { - min-width: 350px; -} - -.toast-container { - position: fixed; - z-index: 9999999; - top: 0; - right: 0; -} - -.toast-top-right { - top: 12px; - right: 24px; -} - -.toast-success .toast-body { - background-color: $green; - color: white; -} - -.toast-warning .toast-body { - background-color: $orange; - color: white; -} - -.toast-error .toast-body, -.toast-danger .toast-body { - background-color: $red; - color: white; -} - - -/* + .toast { + min-width: 350px; + } + + .toast-container { + position: fixed; + z-index: 9999999; + top: 0; + right: 0; + } + + .toast-top-right { + top: 12px; + right: 24px; + } + + .toast-success .toast-body { + background-color: $green; + color: white; + } + + .toast-warning .toast-body { + background-color: $orange; + color: white; + } + + .toast-error .toast-body, + .toast-danger .toast-body { + background-color: $red; + color: white; + } + + /* ********************************* BUTTON ******************************** */ -.btn-mini { - padding: .25rem .35rem .25rem .45rem; - font-size: .875rem; - line-height: 1.3; - border-radius: .2rem; -} - -.btn:focus, .btn:active:focus, .btn.active:focus { - outline:none; - box-shadow:none; -} - - -#password-show-hide-icon:hover { - cursor: pointer; + .btn-mini { + padding: 0.25rem 0.35rem 0.25rem 0.45rem; + font-size: 0.875rem; + line-height: 1.3; + border-radius: 0.2rem; + } + + .btn:focus, + .btn:active:focus, + .btn.active:focus { + outline: none; + box-shadow: none; + } + + #password-show-hide-icon:hover { + cursor: pointer; + } } diff --git a/rero_ils/theme/menus.py b/rero_ils/theme/menus.py index 494b2f29b4..5243b6e1ab 100644 --- a/rero_ils/theme/menus.py +++ b/rero_ils/theme/menus.py @@ -306,7 +306,7 @@ def is_not_read_only(): item = current_menu.submenu("main.profile.edit_profile") rero_register( item, - endpoint="users.profile", + external_url=f"/{viewcode}/patrons/profile/user/edit", endpoint_arguments_constructor=lambda: dict( viewcode=request.view_args.get( "viewcode", current_app.config.get("RERO_ILS_SEARCH_GLOBAL_VIEW_CODE") @@ -321,7 +321,7 @@ def is_not_read_only(): item = current_menu.submenu("main.profile.change_password") rero_register( item, - endpoint="users.password", + external_url=f"/{viewcode}/patrons/profile/password/edit", endpoint_arguments_constructor=lambda: dict( viewcode=request.view_args.get( "viewcode", current_app.config.get("RERO_ILS_SEARCH_GLOBAL_VIEW_CODE") diff --git a/rero_ils/theme/templates/rero_ils/frontpage.html b/rero_ils/theme/templates/rero_ils/frontpage.html index 4bed45dc7b..d54e0f4bd6 100644 --- a/rero_ils/theme/templates/rero_ils/frontpage.html +++ b/rero_ils/theme/templates/rero_ils/frontpage.html @@ -36,21 +36,15 @@