mirror of
https://github.com/Cian-H/invenio-theme-iform.git
synced 2025-12-24 05:31:57 +00:00
Compare commits
6 Commits
2025.5.20.
...
2025.6.6
| Author | SHA1 | Date | |
|---|---|---|---|
| e74d2017fc | |||
| ef1f268298 | |||
| af61f927f1 | |||
| d5b9686302 | |||
| c5bd3d138e | |||
| d5f63f4387 |
29
.github/dependabot.yml
vendored
Normal file
29
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "uv"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
day: "monday"
|
||||
time: "04:00"
|
||||
open-pull-requests-limit: 8
|
||||
allow:
|
||||
- dependency-type: "all"
|
||||
reviewers:
|
||||
- "Cian-H"
|
||||
assignees:
|
||||
- "Cian-H"
|
||||
commit-message:
|
||||
prefix: "uv-deps"
|
||||
prefix-development: "uv-deps-dev"
|
||||
include: "scope"
|
||||
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
day: "monday"
|
||||
time: "04:00"
|
||||
open-pull-requests-limit: 5
|
||||
commit-message:
|
||||
prefix: "ci"
|
||||
@@ -8,4 +8,4 @@
|
||||
|
||||
"""Metadata for this python module."""
|
||||
|
||||
__version__ = "2025.5.20.8"
|
||||
__version__ = "2025.6.6"
|
||||
|
||||
@@ -106,7 +106,9 @@ DEPOSITS_HEADER_TEMPLATE = "invenio_theme_iform/header.html"
|
||||
# SEARCH_UI_SEARCH_TEMPLATE = "invenio_theme_iform/search.html"
|
||||
# """override the default search page"""
|
||||
|
||||
IFORM_ROUTES = {
|
||||
THEME_IFORM_ROUTES = {
|
||||
"index": "/",
|
||||
"comingsoon": "/comingsoon",
|
||||
"records-search": "/records/search",
|
||||
"overview": "/me/overview",
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
"""invenio module for I-Form theme."""
|
||||
|
||||
from flask import g, has_request_context
|
||||
from flask_login import login_required
|
||||
from invenio_records_marc21.ui.theme import current_identity_can_view
|
||||
|
||||
@@ -34,7 +35,16 @@ class InvenioThemeIform(object):
|
||||
|
||||
@app.context_processor
|
||||
def inject_visibility():
|
||||
return {"can_view_marc21": current_identity_can_view()}
|
||||
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
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
<title>{{ title }}</title>
|
||||
{%- endblock head_title %}
|
||||
{%- block head_links %}
|
||||
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}" />
|
||||
<link rel="shortcut icon" href="{{ url_for('invenio_theme_iform.static', filename='favicon.ico') }}" />
|
||||
{%- if keywords %}<link rel="canonical" href="{{ canonical_url }}" />{% endif %}
|
||||
{%- block head_links_langs %}
|
||||
{%- if alternate_urls %}
|
||||
@@ -58,7 +58,7 @@
|
||||
<link
|
||||
rel="apple-touch-icon-precomposed"
|
||||
sizes="{{ size }}x{{ size }}"
|
||||
href="{{ url_for('static', filename=icon_name) }}"
|
||||
href="{{ url_for('invenio_theme_iform.static', filename=icon_name) }}"
|
||||
/>
|
||||
{%- endfor %}
|
||||
{%- endblock head_apple_icons %}
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
Log in with
|
||||
{{ config.SSO_SAML_IDPS[name]['title']|default("SAML", true) }}
|
||||
<img
|
||||
src="{{ url_for('static', filename=config.INVENIO_THEME_IFORM_ICON) }}"
|
||||
src="{{ url_for('invenio_theme_iform.static', filename=config.INVENIO_THEME_IFORM_ICON) }}"
|
||||
height="20px"
|
||||
/>
|
||||
</a>
|
||||
|
||||
@@ -42,12 +42,12 @@
|
||||
{%- if config.INVENIO_CONFIG_IFORM_SHIBBOLETH %}
|
||||
<div class="ui divider"></div>
|
||||
<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"
|
||||
>
|
||||
<span style="font-size: 18px;">Sign up with I-Form</span>
|
||||
<img
|
||||
src="{{ url_for("static", filename=config.INVENIO_THEME_IFORM_ICON) }}"
|
||||
src="{{ url_for('invenio_theme_iform.static', filename=config.INVENIO_THEME_IFORM_ICON) }}"
|
||||
height="20px"
|
||||
/>
|
||||
</a>
|
||||
@@ -73,7 +73,7 @@
|
||||
<div class="content {{ accordion_active }}">
|
||||
<form
|
||||
class="ui large form"
|
||||
action="{{ url_for_security("register") }}"
|
||||
action="{{ url_for_security('register') }}"
|
||||
method="POST"
|
||||
name="register_user_form"
|
||||
>
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
{%- endblock head_title %}
|
||||
|
||||
{%- block head_links %}
|
||||
<link rel="shortcut icon" href="{{ url_for("static", filename="favicon.ico") }}" />
|
||||
<link rel="shortcut icon" href="{{ url_for('inveino_theme_iform.static', filename='favicon.ico') }}" />
|
||||
|
||||
{%- if keywords %}
|
||||
<link rel="canonical" href="{{ canonical_url }}" />
|
||||
|
||||
@@ -132,7 +132,7 @@
|
||||
title="invenioRDM"
|
||||
>
|
||||
<img
|
||||
src="{{ url_for("static", filename="images/inveniordm-tail.svg") }}"
|
||||
src="{{ url_for('invenio_theme_iform.static', filename='images/inveniordm-tail.svg') }}"
|
||||
alt="InvenioRDM logo"
|
||||
style="display: block; height: 90px; margin-top: 8px;"
|
||||
/>
|
||||
@@ -148,7 +148,7 @@
|
||||
title="Science Foundation Ireland"
|
||||
>
|
||||
<img
|
||||
src="{{ url_for("static", filename="images/SFI_logo.png") }}"
|
||||
src="{{ url_for('invenio_theme_iform.static', filename='images/SFI_logo.png') }}"
|
||||
alt="Science Foundation Ireland"
|
||||
style="display: block; height: auto; margin-top: 15px; width: 230px;"
|
||||
/>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<a href="{{ creators.identifiers.orcid|pid_url('orcid') }}" target="_blank"
|
||||
><img
|
||||
class="inline-orcid"
|
||||
src="{{ url_for('static', filename='extra/orcid.png') }}"
|
||||
src="{{ url_for('invenio_theme_iform.static', filename='extra/orcid.png') }}"
|
||||
/></a>
|
||||
{%- endif %}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
<div class="affiliation-text">
|
||||
<a
|
||||
title="Home"
|
||||
href="{{ url_for("invenio_theme_iform.index") }}"
|
||||
href="{{ url_for('invenio_theme_iform.index') }}"
|
||||
class="no-decoration"
|
||||
>
|
||||
I-FORM
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<img
|
||||
width="400px"
|
||||
alt="Research Results"
|
||||
src="{{ url_for('static', filename='images/diamond.svg') }}"
|
||||
src="{{ url_for('invenio_theme_iform.static', filename='images/diamond.svg') }}"
|
||||
/>
|
||||
</a>
|
||||
<div class="ui right floated text">
|
||||
@@ -48,7 +48,7 @@
|
||||
<img
|
||||
width="400px"
|
||||
alt="Communities"
|
||||
src="{{ url_for('static', filename='images/group-discussion.svg') }}"
|
||||
src="{{ url_for('invenio_theme_iform.static', filename='images/group-discussion.svg') }}"
|
||||
/>
|
||||
</a>
|
||||
<div>Overview: Description of Communities</div>
|
||||
@@ -61,7 +61,7 @@
|
||||
<img
|
||||
width="400px"
|
||||
alt="Requests"
|
||||
src="{{ url_for('static', filename='images/umbrella.svg') }}"
|
||||
src="{{ url_for('invenio_theme_iform.static', filename='images/umbrella.svg') }}"
|
||||
/>
|
||||
</a>
|
||||
<div>Overview: Description of Requests</div>
|
||||
@@ -112,7 +112,7 @@
|
||||
<img
|
||||
width="400px"
|
||||
alt="Research Results"
|
||||
src="{{ url_for('static', filename='images/diamond.svg') }}"
|
||||
src="{{ url_for('invenio_theme_iform.static', filename='images/diamond.svg') }}"
|
||||
/>
|
||||
</div>
|
||||
<div class="ui right floated text">
|
||||
@@ -129,7 +129,7 @@
|
||||
<img
|
||||
width="400px"
|
||||
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>
|
||||
<div>Overview: Description for publications</div>
|
||||
@@ -143,7 +143,7 @@
|
||||
<img
|
||||
width="400px"
|
||||
alt="Open Educational Resources"
|
||||
src="{{ url_for('static', filename='images/play.svg') }}"
|
||||
src="{{ url_for('invenio_theme_iform.static', filename='images/play.svg') }}"
|
||||
/>
|
||||
</a>
|
||||
<div>Overview: Description for open educational resources</div>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
from functools import wraps
|
||||
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 invenio_rdm_records.proxies import current_rdm_records
|
||||
from invenio_records_global_search.resources.serializers import (
|
||||
@@ -22,15 +22,30 @@ from opensearch_dsl.utils import AttrDict
|
||||
|
||||
from .search import FrontpageRecordsSearch
|
||||
|
||||
blueprint = Blueprint(
|
||||
"invenio_theme_iform",
|
||||
__name__,
|
||||
template_folder="templates",
|
||||
static_folder="static",
|
||||
)
|
||||
|
||||
def create_blueprint(app: Flask) -> Blueprint:
|
||||
"""Create blueprint."""
|
||||
blueprint = Blueprint(
|
||||
"invenio_theme_iform",
|
||||
__name__,
|
||||
template_folder="templates",
|
||||
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():
|
||||
"""Search page ui.
|
||||
|
||||
@@ -70,7 +85,6 @@ def require_iform_authenticated(view_func):
|
||||
return decorated_view
|
||||
|
||||
|
||||
@blueprint.route("/me/overview")
|
||||
@login_required
|
||||
def overview():
|
||||
"""Overview."""
|
||||
@@ -85,7 +99,6 @@ def overview():
|
||||
)
|
||||
|
||||
|
||||
@blueprint.app_template_filter("make_dict_like")
|
||||
def make_dict_like(value: str, key: str) -> Dict[str, str]:
|
||||
"""Convert the value to a dict like structure.
|
||||
|
||||
@@ -94,7 +107,6 @@ def make_dict_like(value: str, key: str) -> Dict[str, str]:
|
||||
return {key: value}
|
||||
|
||||
|
||||
@blueprint.app_template_filter("cast_to_dict")
|
||||
def cast_to_dict(attr_dict):
|
||||
"""Return the dict structure of AttrDict variable."""
|
||||
return AttrDict.to_dict(attr_dict)
|
||||
@@ -112,18 +124,6 @@ def default_error_handler(e: Exception):
|
||||
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):
|
||||
"""Serialize list of records."""
|
||||
serializer = GlobalSearchJSONSerializer()
|
||||
|
||||
@@ -44,10 +44,7 @@ test = "scripts.test:main"
|
||||
invenio_theme_iform = "invenio_theme_iform:InvenioThemeIform"
|
||||
|
||||
[project.entry-points."invenio_base.blueprints"]
|
||||
invenio_theme_iform = "invenio_theme_iform.views:ui_blueprint"
|
||||
|
||||
[project.entry-points."invenio_i18n.translations"]
|
||||
messages = "invenio_theme_iform"
|
||||
invenio_theme_iform = "invenio_theme_iform.views:create_blueprint"
|
||||
|
||||
[project.entry-points."invenio_assets.webpack"]
|
||||
invenio_theme_iform_theme = "invenio_theme_iform.webpack:theme"
|
||||
|
||||
Reference in New Issue
Block a user