mirror of
https://github.com/Cian-H/invenio-theme-iform.git
synced 2025-12-23 05:01:58 +00:00
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ab8a357137 | |||
| 6cba9a6d2b | |||
| b66f7a75df | |||
| b02b7aca14 | |||
| 56d5d223f3 | |||
| c14168c194 | |||
| 5b71404fda | |||
| 926196b30f | |||
| e74d2017fc | |||
| ef1f268298 | |||
| af61f927f1 | |||
| d5b9686302 |
@@ -8,4 +8,4 @@
|
|||||||
|
|
||||||
"""Metadata for this python module."""
|
"""Metadata for this python module."""
|
||||||
|
|
||||||
__version__ = "2025.6.3"
|
__version__ = "2025.6.6.4"
|
||||||
|
|||||||
@@ -106,7 +106,9 @@ DEPOSITS_HEADER_TEMPLATE = "invenio_theme_iform/header.html"
|
|||||||
# SEARCH_UI_SEARCH_TEMPLATE = "invenio_theme_iform/search.html"
|
# SEARCH_UI_SEARCH_TEMPLATE = "invenio_theme_iform/search.html"
|
||||||
# """override the default search page"""
|
# """override the default search page"""
|
||||||
|
|
||||||
IFORM_ROUTES = {
|
THEME_IFORM_ROUTES = {
|
||||||
"index": "/",
|
"index": "/",
|
||||||
"comingsoon": "/comingsoon",
|
"comingsoon": "/comingsoon",
|
||||||
|
"records-search": "/records/search",
|
||||||
|
"overview": "/me/overview",
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,12 +42,12 @@
|
|||||||
{%- if config.INVENIO_CONFIG_IFORM_SHIBBOLETH %}
|
{%- if config.INVENIO_CONFIG_IFORM_SHIBBOLETH %}
|
||||||
<div class="ui divider"></div>
|
<div class="ui divider"></div>
|
||||||
<a
|
<a
|
||||||
href="{{ url_for("sso_saml.sso", idp="idp") }}"
|
href="{{ url_for('sso_saml.sso', idp='idp') }}"
|
||||||
class="login-page-button ui fluid large button"
|
class="login-page-button ui fluid large button"
|
||||||
>
|
>
|
||||||
<span style="font-size: 18px;">Sign up with I-Form</span>
|
<span style="font-size: 18px;">Sign up with I-Form</span>
|
||||||
<img
|
<img
|
||||||
src="{{ url_for("static", filename=config.INVENIO_THEME_IFORM_ICON) }}"
|
src="{{ url_for('static', filename=config.INVENIO_THEME_IFORM_ICON) }}"
|
||||||
height="20px"
|
height="20px"
|
||||||
/>
|
/>
|
||||||
</a>
|
</a>
|
||||||
@@ -73,7 +73,7 @@
|
|||||||
<div class="content {{ accordion_active }}">
|
<div class="content {{ accordion_active }}">
|
||||||
<form
|
<form
|
||||||
class="ui large form"
|
class="ui large form"
|
||||||
action="{{ url_for_security("register") }}"
|
action="{{ url_for_security('register') }}"
|
||||||
method="POST"
|
method="POST"
|
||||||
name="register_user_form"
|
name="register_user_form"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
{%- endblock head_title %}
|
{%- endblock head_title %}
|
||||||
|
|
||||||
{%- block head_links %}
|
{%- block head_links %}
|
||||||
<link rel="shortcut icon" href="{{ url_for("static", filename="favicon.ico") }}" />
|
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}" />
|
||||||
|
|
||||||
{%- if keywords %}
|
{%- if keywords %}
|
||||||
<link rel="canonical" href="{{ canonical_url }}" />
|
<link rel="canonical" href="{{ canonical_url }}" />
|
||||||
|
|||||||
@@ -132,7 +132,7 @@
|
|||||||
title="invenioRDM"
|
title="invenioRDM"
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
src="{{ url_for("static", filename="images/inveniordm-tail.svg") }}"
|
src="{{ url_for('static', filename='images/inveniordm-tail.svg') }}"
|
||||||
alt="InvenioRDM logo"
|
alt="InvenioRDM logo"
|
||||||
style="display: block; height: 90px; margin-top: 8px;"
|
style="display: block; height: 90px; margin-top: 8px;"
|
||||||
/>
|
/>
|
||||||
@@ -148,7 +148,7 @@
|
|||||||
title="Science Foundation Ireland"
|
title="Science Foundation Ireland"
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
src="{{ url_for("static", filename="images/SFI_logo.png") }}"
|
src="{{ url_for('static', filename='images/SFI_logo.png') }}"
|
||||||
alt="Science Foundation Ireland"
|
alt="Science Foundation Ireland"
|
||||||
style="display: block; height: auto; margin-top: 15px; width: 230px;"
|
style="display: block; height: auto; margin-top: 15px; width: 230px;"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -64,7 +64,7 @@
|
|||||||
<div class="affiliation-text">
|
<div class="affiliation-text">
|
||||||
<a
|
<a
|
||||||
title="Home"
|
title="Home"
|
||||||
href="{{ url_for("invenio_theme_iform.index") }}"
|
href="{{ url_for('invenio_theme_iform.index') }}"
|
||||||
class="no-decoration"
|
class="no-decoration"
|
||||||
>
|
>
|
||||||
I-FORM
|
I-FORM
|
||||||
|
|||||||
@@ -129,7 +129,7 @@
|
|||||||
<img
|
<img
|
||||||
width="400px"
|
width="400px"
|
||||||
alt="Publications"
|
alt="Publications"
|
||||||
src="{{ url_for('static', filename='images/library-book-svgrepo-com.svg') }}"
|
src="{{ url_for('invenio_theme_iform.static', filename='images/library-book-svgrepo-com.svg') }}"
|
||||||
/>
|
/>
|
||||||
</a>
|
</a>
|
||||||
<div>Overview: Description for publications</div>
|
<div>Overview: Description for publications</div>
|
||||||
|
|||||||
@@ -8,10 +8,11 @@
|
|||||||
|
|
||||||
"""invenio module for I-Form theme."""
|
"""invenio module for I-Form theme."""
|
||||||
|
|
||||||
|
import traceback
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
from typing import Dict
|
from typing import Dict
|
||||||
|
|
||||||
from flask import Blueprint, current_app, g, redirect, render_template, url_for
|
from flask import Blueprint, Flask, current_app, g, redirect, render_template, url_for
|
||||||
from flask_login import current_user, login_required
|
from flask_login import current_user, login_required
|
||||||
from invenio_rdm_records.proxies import current_rdm_records
|
from invenio_rdm_records.proxies import current_rdm_records
|
||||||
from invenio_records_global_search.resources.serializers import (
|
from invenio_records_global_search.resources.serializers import (
|
||||||
@@ -22,15 +23,30 @@ from opensearch_dsl.utils import AttrDict
|
|||||||
|
|
||||||
from .search import FrontpageRecordsSearch
|
from .search import FrontpageRecordsSearch
|
||||||
|
|
||||||
blueprint = Blueprint(
|
|
||||||
|
def create_blueprint(app: Flask) -> Blueprint:
|
||||||
|
"""Create blueprint."""
|
||||||
|
blueprint = Blueprint(
|
||||||
"invenio_theme_iform",
|
"invenio_theme_iform",
|
||||||
__name__,
|
__name__,
|
||||||
template_folder="templates",
|
template_folder="templates",
|
||||||
static_folder="static",
|
static_folder="static",
|
||||||
)
|
)
|
||||||
|
routes = app.config.get("THEME_IFORM_ROUTES")
|
||||||
|
|
||||||
|
blueprint.add_url_rule(routes["records-search"], view_func=records_search)
|
||||||
|
blueprint.add_url_rule(routes["index"], view_func=index)
|
||||||
|
blueprint.add_url_rule(routes["overview"], view_func=overview)
|
||||||
|
|
||||||
|
# base case for any otherwise unhandled exception
|
||||||
|
app.register_error_handler(Exception, default_error_handler)
|
||||||
|
|
||||||
|
blueprint.add_app_template_filter(make_dict_like)
|
||||||
|
blueprint.add_app_template_filter(cast_to_dict)
|
||||||
|
|
||||||
|
return blueprint
|
||||||
|
|
||||||
|
|
||||||
@blueprint.route("/records/search")
|
|
||||||
def records_search():
|
def records_search():
|
||||||
"""Search page ui.
|
"""Search page ui.
|
||||||
|
|
||||||
@@ -70,7 +86,6 @@ def require_iform_authenticated(view_func):
|
|||||||
return decorated_view
|
return decorated_view
|
||||||
|
|
||||||
|
|
||||||
@blueprint.route("/me/overview")
|
|
||||||
@login_required
|
@login_required
|
||||||
def overview():
|
def overview():
|
||||||
"""Overview."""
|
"""Overview."""
|
||||||
@@ -85,7 +100,6 @@ def overview():
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@blueprint.app_template_filter("make_dict_like")
|
|
||||||
def make_dict_like(value: str, key: str) -> Dict[str, str]:
|
def make_dict_like(value: str, key: str) -> Dict[str, str]:
|
||||||
"""Convert the value to a dict like structure.
|
"""Convert the value to a dict like structure.
|
||||||
|
|
||||||
@@ -94,7 +108,6 @@ def make_dict_like(value: str, key: str) -> Dict[str, str]:
|
|||||||
return {key: value}
|
return {key: value}
|
||||||
|
|
||||||
|
|
||||||
@blueprint.app_template_filter("cast_to_dict")
|
|
||||||
def cast_to_dict(attr_dict):
|
def cast_to_dict(attr_dict):
|
||||||
"""Return the dict structure of AttrDict variable."""
|
"""Return the dict structure of AttrDict variable."""
|
||||||
return AttrDict.to_dict(attr_dict)
|
return AttrDict.to_dict(attr_dict)
|
||||||
@@ -109,21 +122,13 @@ def default_error_handler(e: Exception):
|
|||||||
# - `e`, the passed-in exception
|
# - `e`, the passed-in exception
|
||||||
# to get proxied-to objects: `flask.request._get_current_object()`
|
# to get proxied-to objects: `flask.request._get_current_object()`
|
||||||
|
|
||||||
|
msg = f"default_error_handler of invenio-theme-iform captured following error type: {
|
||||||
|
type(e)
|
||||||
|
} with message {e} and stack trace {traceback.format_exc()}"
|
||||||
|
current_app.logger.error(msg)
|
||||||
return render_template(current_app.config["THEME_500_TEMPLATE"]), 500
|
return render_template(current_app.config["THEME_500_TEMPLATE"]), 500
|
||||||
|
|
||||||
|
|
||||||
def ui_blueprint(app):
|
|
||||||
"""Blueprint for the routes and resources provided by invenio-theme-iform."""
|
|
||||||
routes = app.config.get("IFORM_ROUTES")
|
|
||||||
|
|
||||||
blueprint.add_url_rule(routes["index"], view_func=index)
|
|
||||||
|
|
||||||
# base case for any otherwise unhandled exception
|
|
||||||
app.register_error_handler(Exception, default_error_handler)
|
|
||||||
|
|
||||||
return blueprint
|
|
||||||
|
|
||||||
|
|
||||||
def records_serializer(records=None):
|
def records_serializer(records=None):
|
||||||
"""Serialize list of records."""
|
"""Serialize list of records."""
|
||||||
serializer = GlobalSearchJSONSerializer()
|
serializer = GlobalSearchJSONSerializer()
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ classifiers = [
|
|||||||
requires-python = ">=3.10,<3.14"
|
requires-python = ">=3.10,<3.14"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"invenio-assets>=2.0.0",
|
"invenio-assets>=2.0.0",
|
||||||
"invenio-i18n>=1.3.1",
|
|
||||||
"invenio-config-iform>=2025.5.20.1",
|
"invenio-config-iform>=2025.5.20.1",
|
||||||
"invenio_records_global_search>=0.0.1",
|
"invenio_records_global_search>=0.0.1",
|
||||||
"invenio_records_marc21>=0.21.0",
|
"invenio_records_marc21>=0.21.0",
|
||||||
@@ -44,10 +43,7 @@ test = "scripts.test:main"
|
|||||||
invenio_theme_iform = "invenio_theme_iform:InvenioThemeIform"
|
invenio_theme_iform = "invenio_theme_iform:InvenioThemeIform"
|
||||||
|
|
||||||
[project.entry-points."invenio_base.blueprints"]
|
[project.entry-points."invenio_base.blueprints"]
|
||||||
invenio_theme_iform = "invenio_theme_iform.views:ui_blueprint"
|
invenio_theme_iform = "invenio_theme_iform.views:create_blueprint"
|
||||||
|
|
||||||
[project.entry-points."invenio_i18n.translations"]
|
|
||||||
messages = "invenio_theme_iform"
|
|
||||||
|
|
||||||
[project.entry-points."invenio_assets.webpack"]
|
[project.entry-points."invenio_assets.webpack"]
|
||||||
invenio_theme_iform_theme = "invenio_theme_iform.webpack:theme"
|
invenio_theme_iform_theme = "invenio_theme_iform.webpack:theme"
|
||||||
|
|||||||
10
uv.lock
generated
10
uv.lock
generated
@@ -2153,7 +2153,7 @@ wheels = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "invenio-records-lom"
|
name = "invenio-records-lom"
|
||||||
version = "0.18.2"
|
version = "0.18.4"
|
||||||
source = { registry = "https://pypi.org/simple" }
|
source = { registry = "https://pypi.org/simple" }
|
||||||
resolution-markers = [
|
resolution-markers = [
|
||||||
"python_full_version >= '3.12'",
|
"python_full_version >= '3.12'",
|
||||||
@@ -2164,9 +2164,9 @@ dependencies = [
|
|||||||
{ name = "invenio-stats", marker = "python_full_version >= '3.12'" },
|
{ name = "invenio-stats", marker = "python_full_version >= '3.12'" },
|
||||||
{ name = "marshmallow", marker = "python_full_version >= '3.12'" },
|
{ name = "marshmallow", marker = "python_full_version >= '3.12'" },
|
||||||
]
|
]
|
||||||
sdist = { url = "https://files.pythonhosted.org/packages/82/44/c99c74bc4ca3f77540a2cbe3f0a125507be71a58ebafae1b6476a469b159/invenio_records_lom-0.18.2.tar.gz", hash = "sha256:ae0d25e3fb9b34c7bee5515511f03855984eef32796f044e2696c0b5839f4415", size = 180140, upload_time = "2025-05-22T22:21:15.199Z" }
|
sdist = { url = "https://files.pythonhosted.org/packages/f8/e2/34683c23ce657b7df4aea1ad2be50d8565aa3407dd00f4227e773c7f1948/invenio_records_lom-0.18.4.tar.gz", hash = "sha256:87949eacf32f7917055e46debe39fb46f85b442da11f89435f45a361f694f650", size = 180272, upload_time = "2025-06-06T09:22:37.648Z" }
|
||||||
wheels = [
|
wheels = [
|
||||||
{ url = "https://files.pythonhosted.org/packages/4e/44/314094313db0a002e1f781b3a1b93cd88d7379129a192371b364eab12e45/invenio_records_lom-0.18.2-py2.py3-none-any.whl", hash = "sha256:bf3d5e30226980c241fdfcdb32598c89c8d281f565432ffbe43d7ab1f5b6d265", size = 237712, upload_time = "2025-05-22T22:21:13.247Z" },
|
{ url = "https://files.pythonhosted.org/packages/15/07/3ee50b4c0b48e597615cb6416cae95f5f58f26c89c73a7736d14a104ba8c/invenio_records_lom-0.18.4-py2.py3-none-any.whl", hash = "sha256:eb8922fbde403b8125d8b9c793343931573d05a3c1b5e7a5e401e7d7f788dd55", size = 237734, upload_time = "2025-06-06T09:22:35.957Z" },
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2391,11 +2391,10 @@ source = { editable = "." }
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
{ name = "invenio-assets" },
|
{ name = "invenio-assets" },
|
||||||
{ name = "invenio-config-iform" },
|
{ name = "invenio-config-iform" },
|
||||||
{ name = "invenio-i18n" },
|
|
||||||
{ name = "invenio-records-global-search", version = "0.2.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.12'" },
|
{ name = "invenio-records-global-search", version = "0.2.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.12'" },
|
||||||
{ name = "invenio-records-global-search", version = "0.3.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12'" },
|
{ name = "invenio-records-global-search", version = "0.3.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12'" },
|
||||||
{ name = "invenio-records-lom", version = "0.16.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.12'" },
|
{ name = "invenio-records-lom", version = "0.16.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.12'" },
|
||||||
{ name = "invenio-records-lom", version = "0.18.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12'" },
|
{ name = "invenio-records-lom", version = "0.18.4", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12'" },
|
||||||
{ name = "invenio-records-marc21", version = "0.22.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.12'" },
|
{ name = "invenio-records-marc21", version = "0.22.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.12'" },
|
||||||
{ name = "invenio-records-marc21", version = "0.24.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12'" },
|
{ name = "invenio-records-marc21", version = "0.24.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12'" },
|
||||||
]
|
]
|
||||||
@@ -2428,7 +2427,6 @@ tests = [
|
|||||||
requires-dist = [
|
requires-dist = [
|
||||||
{ name = "invenio-assets", specifier = ">=2.0.0" },
|
{ name = "invenio-assets", specifier = ">=2.0.0" },
|
||||||
{ name = "invenio-config-iform", specifier = ">=2025.5.20.1" },
|
{ name = "invenio-config-iform", specifier = ">=2025.5.20.1" },
|
||||||
{ name = "invenio-i18n", specifier = ">=1.3.1" },
|
|
||||||
{ name = "invenio-records-global-search", specifier = ">=0.0.1" },
|
{ name = "invenio-records-global-search", specifier = ">=0.0.1" },
|
||||||
{ name = "invenio-records-lom", specifier = ">=0.16.0" },
|
{ name = "invenio-records-lom", specifier = ">=0.16.0" },
|
||||||
{ name = "invenio-records-marc21", specifier = ">=0.21.0" },
|
{ name = "invenio-records-marc21", specifier = ">=0.21.0" },
|
||||||
|
|||||||
Reference in New Issue
Block a user