From a4a3154c6466c47ec97400bceb26fdace04a95aa Mon Sep 17 00:00:00 2001 From: Cian Hughes Date: Wed, 1 Jul 2026 09:26:26 +0100 Subject: [PATCH] Removed MARC21 and LOM records --- invenio_theme_iform/ext.py | 16 ----------- invenio_theme_iform/search.py | 20 ------------- .../templates/invenio_theme_iform/navbar.html | 10 ------- .../invenio_theme_iform/overview.html | 28 ------------------- .../invenio_theme_iform/recent_uploads.html | 28 ++++++++----------- invenio_theme_iform/views.py | 17 ++--------- pyproject.toml | 3 -- 7 files changed, 15 insertions(+), 107 deletions(-) delete mode 100644 invenio_theme_iform/search.py diff --git a/invenio_theme_iform/ext.py b/invenio_theme_iform/ext.py index 6507589..9a203bc 100644 --- a/invenio_theme_iform/ext.py +++ b/invenio_theme_iform/ext.py @@ -10,7 +10,6 @@ from flask import g, has_request_context from flask_login import login_required -from invenio_records_marc21.ui.theme import current_identity_can_view from . import config from .views import index, locked, require_iform_authenticated @@ -33,19 +32,6 @@ class InvenioThemeIform(object): app.register_error_handler(423, locked) - @app.context_processor - def inject_visibility(): - def can_view_marc21(): - try: - # Only check if we're in a request context and identity exists - if has_request_context() and hasattr(g, "identity") and g.identity: - return current_identity_can_view() - return False - except (AttributeError, RuntimeError): - return False - - return {"can_view_marc21": can_view_marc21()} - app.extensions["invenio-theme-iform"] = self def init_config(self, app): @@ -69,8 +55,6 @@ def create_quick_upload_submenu(app): quick_upload_submenu._text = "Quick upload" quick_upload_submenu._order = 1 quick_upload_submenu.register("records.upload", "Upload Research Data") - quick_upload_submenu.register("invenio_records_marc21.uploads", "Upload Publication") - quick_upload_submenu.register("invenio_records_lom.uploads", "Upload Educational Resource") def modify_user_dashboard(app): diff --git a/invenio_theme_iform/search.py b/invenio_theme_iform/search.py deleted file mode 100644 index d5d0fe9..0000000 --- a/invenio_theme_iform/search.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (C) 2020-2023 Graz University of Technology. -# -# invenio-theme-iform is free software; you can redistribute it and/or -# modify it under the terms of the MIT License; see LICENSE file for more -# details. - -"""Frontpage records.""" - -from invenio_search.api import RecordsSearch - - -class FrontpageRecordsSearch(RecordsSearch): - """Search class for records that goes on the frontpage.""" - - class Meta: - """Default index and filter for frontpage search.""" - - index = "global-search" diff --git a/invenio_theme_iform/templates/invenio_theme_iform/navbar.html b/invenio_theme_iform/templates/invenio_theme_iform/navbar.html index f04f6cb..d2de2be 100644 --- a/invenio_theme_iform/templates/invenio_theme_iform/navbar.html +++ b/invenio_theme_iform/templates/invenio_theme_iform/navbar.html @@ -18,16 +18,6 @@ "text": "Research Results", "value": "/records/search", "title": "Research Data", - },{ - "key": "marc21", - "text": "Publications", - "value": url_for("invenio_records_marc21.search"), - "title": "publication", - },{ - "key": "lom", - "text": "Educational Resources", - "value": url_for("invenio_records_lom.search"), - "title": "oer", } ] %} diff --git a/invenio_theme_iform/templates/invenio_theme_iform/overview.html b/invenio_theme_iform/templates/invenio_theme_iform/overview.html index b36c244..3266094 100644 --- a/invenio_theme_iform/templates/invenio_theme_iform/overview.html +++ b/invenio_theme_iform/templates/invenio_theme_iform/overview.html @@ -121,34 +121,6 @@ {% endif %} - {% if can_view_marc21 %} -
-
-

Publications

- - Publications - -
Overview: Description for publications
-
-
- {% endif %} -
-
-

Educational Resources

- - Open Educational Resources - -
Overview: Description for open educational resources
-
-
{%- endblock %} diff --git a/invenio_theme_iform/templates/invenio_theme_iform/recent_uploads.html b/invenio_theme_iform/templates/invenio_theme_iform/recent_uploads.html index 4dd01c6..45162c3 100644 --- a/invenio_theme_iform/templates/invenio_theme_iform/recent_uploads.html +++ b/invenio_theme_iform/templates/invenio_theme_iform/recent_uploads.html @@ -18,55 +18,51 @@ {%- for r in records %} {%- set creation_date = r.created | from_isodatetime -%} - {%- set record_url = r.original.view %} + {%- set record_url = r.links.self_html %}
{# Publication date/Version badge #} - {{ r.created_date_l10n_long }} + {{ r.ui.created_date_l10n_long }} {# Resource type badge #} - {% if r.metadata.types | length > 0 %} + {% if r.ui.resource_type %} - {{ r.metadata.types[0] }} + {{ r.ui.resource_type.title_l10n }} {% endif %} - - {{ r.access_status.title_l10n }} - - - - {{ r.original.schema_l10n }} + + {{ r.ui.access_status.title_l10n }}

- {{ r.metadata.titles[0] }} + {{ r.metadata.title }}

{%- for creator in r.metadata.creators %} - {{ creator }} + {{ creator.person_or_org.name }} {%- endfor %}

{%- for subject in r.metadata.subjects %} - {{ subject }} + {{ subject.subject }} {%- endfor %}
diff --git a/invenio_theme_iform/views.py b/invenio_theme_iform/views.py index a6f782f..b60eac0 100644 --- a/invenio_theme_iform/views.py +++ b/invenio_theme_iform/views.py @@ -15,14 +15,9 @@ from typing import Dict from flask import Blueprint, Flask, current_app, g, redirect, render_template, url_for from flask_login import current_user, login_required from invenio_rdm_records.proxies import current_rdm_records -from invenio_records_global_search.resources.serializers import ( - GlobalSearchJSONSerializer, -) from invenio_users_resources.proxies import current_user_resources from opensearch_dsl.utils import AttrDict -from .search import FrontpageRecordsSearch - def create_blueprint(app: Flask) -> Blueprint: """Create blueprint.""" @@ -129,17 +124,11 @@ def default_error_handler(e: Exception): return render_template(current_app.config["THEME_500_TEMPLATE"]), 500 -def records_serializer(records=None): - """Serialize list of records.""" - serializer = GlobalSearchJSONSerializer() - return [serializer.dump_obj(r.to_dict()) for r in records] - - def index(): """Frontpage.""" - records = FrontpageRecordsSearch()[:5].sort("-created").execute() - - return render_template("invenio_theme_iform/index.html", records=records_serializer(records)) + records = current_rdm_records.records_service.search(g.identity, size=5, sort="newest") + + return render_template("invenio_theme_iform/index.html", records=list(records.hits)) def locked(e): diff --git a/pyproject.toml b/pyproject.toml index c8ef1bd..cd0fccf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,9 +25,6 @@ requires-python = ">=3.10,<3.14" dependencies = [ "invenio-assets>=2.0.0", "invenio-config-iform>=2025.5.20.1", - "invenio_records_global_search>=0.0.1", - "invenio_records_marc21>=0.21.0", - "invenio-records-lom>=0.16.0", ] [project.urls]