Compare commits

...
23 Commits
Author SHA1 Message Date
Cian-H c585d5c142 chore: update version number 2026-08-12 15:53:08 +01:00
Cian-H 331a5318aa Updated license headers where appropriate 2026-08-12 15:52:55 +01:00
Cian-H 7b934c8419 Added Irish translations, and removed "Educational Resources" section 2026-08-12 15:52:55 +01:00
Cian-H a4a3154c64 Removed MARC21 and LOM records 2026-07-01 09:26:26 +01:00
Cian-H fccbc9089f Updated devenv 2026-07-01 09:26:04 +01:00
Cian-H 20122ab6c0 Added quick upload (and some misc improvements) 2025-09-01 11:05:37 +01:00
Cian-H ab8a357137 Added logger output on error 500
Cherry picked and tweaked from
https://github.com/tu-graz-library/invenio-theme-tugraz/commit/fdec916528442fdafa19972353d9642c06db9106
2025-06-06 16:34:32 +01:00
Cian-H 6cba9a6d2b Patch: revert static routes from package level to relative 2025-06-06 14:51:59 +01:00
Cian-H b66f7a75df Version bump 2025-06-06 14:13:54 +01:00
Cian-H b02b7aca14 Revert "Removed lom to fix py3.13 issues"
This reverts commit 926196b30f.
2025-06-06 14:13:26 +01:00
Cian-H 56d5d223f3 Version bump 2025-06-06 13:56:11 +01:00
Cian-H c14168c194 Lock bump 2025-06-06 13:55:22 +01:00
Cian-H 5b71404fda removed depedency on i18n 2025-06-06 13:54:32 +01:00
Cian-H 926196b30f Removed lom to fix py3.13 issues 2025-06-06 13:54:14 +01:00
Cian-H e74d2017fc Version bump 2025-06-06 13:15:29 +01:00
Cian-H ef1f268298 Template reference fixes 2025-06-06 13:14:58 +01:00
Cian-H af61f927f1 Removed translations entrypoint as was unused 2025-06-06 12:51:57 +01:00
Cian-H d5b9686302 Switched blueprint creation to newer flask style
Noticed and cherry picked from tugraz theme during debugging of plugin
build issues. See:
https://github.com/tu-graz-library/invenio-theme-tugraz/commit/62c572e483b7b33a207414d61857d12037723f66
2025-06-06 12:51:17 +01:00
Cian-H c5bd3d138e Attempt to fix loading issues when oauth is not responding 2025-06-03 11:08:36 +01:00
Cian-H d5f63f4387 Add dependabot config 2025-05-27 17:52:05 +01:00
Cian-H f7d0aa1bcf patch: Added missing dependency 2025-05-27 13:26:31 +01:00
Cian-H 4155fb875a Patch: format fix 2025-05-23 17:24:21 +01:00
Cian-H 51dac9f287 Fix badge display 2025-05-23 17:24:07 +01:00
35 changed files with 12219 additions and 2278 deletions
+29
View 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"
+3 -3
View File
@@ -24,11 +24,11 @@
.. image:: https://readthedocs.org/projects/invenio-theme-iform/badge/?version=latest
:target: https://invenio-theme-iform.readthedocs.io/en/latest/?badge=latest
.. image:: https://img.shields.io/coveralls/Cian-H/invenio-theme-iform.svg
:target: https://coveralls.io/r/Cian-H/invenio-theme-iform
.. image:: https://coveralls.io/repos/github/Cian-H/invenio-theme-iform/badge.svg?branch=master
:target: https://coveralls.io/github/Cian-H/invenio-theme-iform?branch=master
.. image:: https://img.shields.io/badge/code%20style-Ruff-D7FF64.svg
:target: https://github.com/astral-sh/ruff
:target: https://github.com/astral-sh/ruff
I-Form standard theme.
+23
View File
@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020-2021 Graz University of Technology.
# Copyright (C) 2025 I-Form Advanced Manufacturing Research Centre.
#
# 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.
# Extraction from Python source files
[python: **.py]
encoding = utf-8
# Extraction from Jinja2 templates
[jinja2: **/templates/**.html]
encoding = utf-8
# Extraction from JavaScript files
[javascript: **.js]
encoding = utf-8
extract_messages = $._, jQuery._
+23
View File
@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020-2021 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.
# Extraction from Python source files
[python: **.py]
encoding = utf-8
# Extraction from Jinja2 templates
[jinja2: **/templates/**.html]
encoding = utf-8
# Extraction from JavaScript files
[javascript: **.js]
encoding = utf-8
extract_messages = $._, jQuery._
+54 -18
View File
@@ -3,10 +3,11 @@
"devenv": {
"locked": {
"dir": "src/modules",
"lastModified": 1746707904,
"lastModified": 1782860656,
"narHash": "sha256-HiSNP0/eEhKGZBWC6kLZVN8I6j6AwVnI4gjeH25+/5k=",
"owner": "cachix",
"repo": "devenv",
"rev": "fada79d97f2066c444766d039b0a62affd3e3cab",
"rev": "3f6df48c00d8aa408f0440f2707662aa91a1f033",
"type": "github"
},
"original": {
@@ -19,14 +20,15 @@
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1733328505,
"owner": "edolstra",
"lastModified": 1767039857,
"narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=",
"owner": "NixOS",
"repo": "flake-compat",
"rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
"rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab",
"type": "github"
},
"original": {
"owner": "edolstra",
"owner": "NixOS",
"repo": "flake-compat",
"type": "github"
}
@@ -35,15 +37,14 @@
"inputs": {
"flake-compat": "flake-compat",
"gitignore": "gitignore",
"nixpkgs": [
"nixpkgs"
]
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1746537231,
"lastModified": 1781733627,
"narHash": "sha256-U3yTuGBnmXvXoQI3qkpfEDsn9RovQPAjN7ndRco+3u0=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "fa466640195d38ec97cf0493d6d6882bc4d14969",
"rev": "3bbec39bc90eadfa031e6f3b77272f3f60803e39",
"type": "github"
},
"original": {
@@ -61,6 +62,7 @@
},
"locked": {
"lastModified": 1709087332,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
@@ -74,10 +76,47 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1745934659,
"lastModified": 1770073757,
"narHash": "sha256-Vy+G+F+3E/Tl+GMNgiHl9Pah2DgShmIUBJXmbiQPHbI=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "47472570b1e607482890801aeaf29bfb749884f6",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-src": {
"flake": false,
"locked": {
"lastModified": 1781607440,
"narHash": "sha256-rxO+uc/KFbSJp+pgyXRuAX6QlG9hJdnt0BXpEQRXY+U=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "3e41b24abd260e8f71dbe2f5737d24122f972158",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"inputs": {
"nixpkgs-src": "nixpkgs-src"
},
"locked": {
"lastModified": 1782132010,
"narHash": "sha256-ZnAVHdVrotp80iIMm5CSR1fdxPlw7Uwmwxb+O/wsgZ8=",
"owner": "cachix",
"repo": "devenv-nixpkgs",
"rev": "fbc071e5c11e23fba50037de37268e3d8a1858eb",
"rev": "12866ae2dddbc0ab8b329915f8072bb9c75bde89",
"type": "github"
},
"original": {
@@ -91,13 +130,10 @@
"inputs": {
"devenv": "devenv",
"git-hooks": "git-hooks",
"nixpkgs": "nixpkgs",
"pre-commit-hooks": [
"git-hooks"
]
"nixpkgs": "nixpkgs_2"
}
}
},
"root": "root",
"version": 7
}
}
+2
View File
@@ -2,3 +2,5 @@
inputs:
nixpkgs:
url: github:cachix/devenv-nixpkgs/rolling
git-hooks:
url: github:cachix/git-hooks.nix
+1 -1
View File
@@ -8,4 +8,4 @@
"""Metadata for this python module."""
__version__ = "2025.5.20.6"
__version__ = "2026.8.12"
@@ -1,3 +1,12 @@
/*
Copyright (C) 2020-2023 Graz University of Technology.
Copyright (C) 2023-2026 Cian-H/iform-invenio (I-Form).
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.
*/
import $ from "jquery";
import "semantic-ui-css";
import { MultipleOptionsSearchBar } from "@js/invenio_search_ui/components";
@@ -7,28 +16,8 @@ import React from "react";
// called on document ready
$(function () {
importZammadScript();
syncLogoHover();
});
function importZammadScript() {
let scriptNode = document.createElement("hidden"); //needed for zammad script
scriptNode.id = "zammad_form_script";
scriptNode.src = "https://ub-support.tugraz.at/assets/form/form.js";
document.head.appendChild(scriptNode);
$.getScript("https://ub-support.tugraz.at/assets/form/form.js", () => {
$("#feedback-form").ZammadForm({
messageTitle: "Contact us",
showTitle: true,
messageSubmit: "Submit",
messageThankYou:
"Thank you for your message, (#%s). We will get back to you as quickly as possible!",
modal: true,
});
});
}
// used for sticky test instance notification
$(".ui.sticky.test-instance").sticky({
context: "body",
@@ -46,6 +35,23 @@ window.toggleVisibility = toggleVisibility;
const headerSearchbar = document.getElementById("header-search-bar");
const searchBarOptions = JSON.parse(headerSearchbar.dataset.options);
// Quick upload dropdown
$("#quick-upload-dropdown.ui.dropdown").dropdown({
showOnFocus: false,
selectOnKeydown: false,
action: (text, value, element) => {
// needed to trigger navigation on keyboard interaction
let path = element.attr("href");
window.location.pathname = path;
},
onShow: () => {
$("#quick-upload-dropdown-btn").attr("aria-expanded", true);
},
onHide: () => {
$("#quick-upload-dropdown-btn").attr("aria-expanded", false);
},
});
// Synchronises the hover states of the subcomponents of the logo
export function syncLogoHover() {
const logoGrad = document.getElementById("int-header-logo-grad");
@@ -77,10 +83,16 @@ export function syncLogoHover() {
window.syncLogoHover = syncLogoHover;
const HeaderSearchBar = () => {
return (
<MultipleOptionsSearchBar
options={searchBarOptions}
placeholder={i18next.t("Search records...")}
/>
);
};
ReactDOM.render(
<MultipleOptionsSearchBar
options={searchBarOptions}
placeholder={i18next.t("Search records...")}
/>,
<HeaderSearchBar />,
headerSearchbar,
);
@@ -1,4 +1,4 @@
// Copyright (C) 2024 Graz University of Technology.
// Copyright (C) 2025-2026 Cian-H/iform-invenio (I-Form).
//
// 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.
@@ -14,23 +14,13 @@ async function generateForm() {
email = json?.email || "???";
}
// show form
$.getScript("https://ub-support.tugraz.at/assets/form/form.js", () => {
$("#anchor-unlock-form").ZammadForm({
attributes: [
{},
{ defaultValue: email },
{
defaultValue: `Could you unlock my account (${email}) for research-uploads?`,
// TODO: add to defaultValue once policy on how to get accepted is decided...
},
],
modal: false,
});
// focus first entry of now-shown form
document.getElementById("zammad-form-name-inline").focus();
});
// show message
$("#anchor-unlock-form").html(
`<div class="ui warning message">
<div class="header">Account Unlocking</div>
<p>Please contact an administrator to request unlocking for your account (${email}).</p>
</div>`
);
}
$(function () {
@@ -96,6 +96,34 @@
text-decoration: none;
}
.short-menu-left-lang {
display: inline-block;
margin-right: 10px;
font-size: 17px !important;
font-weight: 300;
& a {
padding: 5px 8px;
background-color: transparent;
color: #000 !important;
text-decoration: none;
border-radius: 3px;
transition: background-color 0.2s ease, color 0.2s ease;
&:hover {
background-color: #000 !important;
color: #fff !important;
text-decoration: none;
}
&.active {
background-color: #e0e1e2 !important;
color: #000 !important;
font-weight: 600;
}
}
}
.search-icon-header {
display: inline-block;
@@ -130,7 +158,9 @@
}
.short-menu-left-search {
display: inline-block;
display: inline-flex;
align-items: center;
vertical-align: middle;
margin: 12px 9px 6px 0;
color: @primaryLinkInverted;
}
+16 -4
View File
@@ -8,7 +8,14 @@
"""invenio module for I-Form theme."""
INVENIO_THEME_IFORM_DEFAULT_VALUE = "I-Form Repository"
from flask_babel import lazy_gettext as _
I18N_LANGUAGES = [
("en", _("English")),
("ga", _("Irish")),
]
INVENIO_THEME_IFORM_DEFAULT_VALUE = _("I-Form Repository")
"""Default value for the application."""
INVENIO_THEME_IFORM_BASE_TEMPLATE = "invenio_theme_iform/base.html"
@@ -55,16 +62,19 @@ THEME_HEADER_TEMPLATE = "invenio_theme_iform/header.html"
THEME_FRONTPAGE = False
"""Use default frontpage."""
THEME_HEADER_RECORDS_TEMPLATE = "invenio_theme_iform/accounts/header_records.html"
"""Records management page header"""
THEME_HEADER_LOGIN_TEMPLATE = "invenio_theme_iform/accounts/header_login.html"
"""login page header"""
THEME_FOOTER_TEMPLATE = "invenio_theme_iform/footer.html"
"""footer template"""
THEME_FRONTPAGE_TITLE = "I-Form Repository"
THEME_FRONTPAGE_TITLE = _("I-Form Repository")
"""Frontpage title."""
THEME_SITENAME = "Repository"
THEME_SITENAME = _("Repository")
"""Site name."""
# Invenio-accounts
@@ -106,7 +116,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",
}
+11 -5
View File
@@ -8,8 +8,8 @@
"""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
from . import config
from .views import index, locked, require_iform_authenticated
@@ -32,10 +32,6 @@ class InvenioThemeIform(object):
app.register_error_handler(423, locked)
@app.context_processor
def inject_visibility():
return {"can_view_marc21": current_identity_can_view()}
app.extensions["invenio-theme-iform"] = self
def init_config(self, app):
@@ -51,6 +47,16 @@ def finalize_app(app):
guard_view_functions(app)
def create_quick_upload_submenu(app):
"""Create a submenu for the quick-upload menu."""
root_menu = app.extensions["menu"].root_node
quick_upload_submenu = root_menu.submenu("quick_upload")
quick_upload_submenu._text = "Quick upload"
quick_upload_submenu._order = 1
quick_upload_submenu.register("records.upload", "Upload Research Data")
def modify_user_dashboard(app):
"""Modify user dashboard."""
root_menu = app.extensions["menu"].root_node
-20
View File
@@ -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"
@@ -8,6 +8,6 @@
{% extends config.THEME_ERROR_TEMPLATE %}
{% block message %}
<h1><i class="bolt icon"></i> Locked</h1>
<p>The resource that is being accessed is locked.</p>
<h1><i class="bolt icon"></i> {{ _("Locked") }}</h1>
<p>{{ _("The resource that is being accessed is locked.") }}</p>
{% endblock message %}
@@ -88,8 +88,8 @@
>
{% if not config.THEME_IFORM_PRODUCTION %}
<div class="ui sticky test-instance">
<h4>"Test Instance"</h4>
<p>"This is the test instance of the I-Form Repository."</p>
<h4>{{ _("Test Instance") }}</h4>
<p>{{ _("This is the test instance of the I-Form Repository.") }}</p>
</div>
{% endif %}
{%- block body %}
@@ -12,7 +12,7 @@
<div class="short-menu-right-button">
<a href="{{ url_for_security('login', next=request.path) }}" class="no-decoration">
{{ _ ("Log in") }}
{{ _("Log in") }}
</a>
</div>
{%- else %}
@@ -24,7 +24,7 @@
</div>
<div class="short-menu-right-button">
<a class="dropdown-item no-decoration" href="{{ url_for_security('logout') }}"
>Sign out</a
>{{ _("Sign out") }}</a
>
</div>
{%- endif %}
@@ -17,7 +17,7 @@
<div class="ui login segment padded">
<div class="divider hidden"></div>
{%- block form_header %}
<h3 class="ui login header">Log in to Repository</h3>
<h3 class="ui login header">{{ _("Log in to Repository") }}</h3>
{%- endblock form_header %}
<div class="ui divider"></div>
<!--Log in with SSO-->
@@ -33,7 +33,7 @@
class="login-page-button ui fluid large button"
href="{{ url_for('sso_saml.sso', idp=name) }}"
>
Log in with
{{ _("Log in with") }}
{{ config.SSO_SAML_IDPS[name]['title']|default("SAML", true) }}
<img
src="{{ url_for('static', filename=config.INVENIO_THEME_IFORM_ICON) }}"
@@ -43,7 +43,7 @@
</div>
{% endfor %}
{%- if config.ACCOUNTS_LOCAL_LOGIN_ENABLED %}
<div class="ui horizontal divider">Or</div>
<div class="ui horizontal divider">{{ _("Or") }}</div>
{%- endif %}
{% endif %}
@@ -53,7 +53,7 @@
{%- set accordion_active = "active" if form.errors else "" %}
<div class="ui styled accordion">
<div class="title trigger {{ accordion_active }}">
Log in with repository credentials
{{ _("Log in with repository credentials") }}
<i class="user icon button"></i>
</div>
<div class="content {{ accordion_active }}">
@@ -71,7 +71,7 @@
type="submit"
class="ui fluid large submit button"
>
<i class="ui sign-in icon"></i>Log In
<i class="ui sign-in icon"></i>{{ _("Log In") }}
</button>
</form>
</div>
@@ -88,7 +88,7 @@
{% trans sitename=config.ACCOUNTS_SITENAME %}New to {{ sitename }}?{% endtrans %}
<a
href="{{ url_for_security('register', next=request.args.get('next')) }}"
>Sign up</a
>{{ _("Sign up") }}</a
>
</div>
{%- endif %}
@@ -100,7 +100,7 @@
<a
class="ui inverted header tiny"
href="{{ url_for_security('forgot_password') }}"
>Forgot password?</a
>{{ _("Forgot password?") }}</a
>
</div>
{%- endif %}
@@ -14,25 +14,23 @@
<div class="ui container">
<div class="ui stackable two column grid">
<div class="centered row">
<h1 class="ui header">Create an Account</h1>
<h1 class="ui header">{{ _("Create an Account") }}</h1>
</div>
<div class="column" id="switch_left">
<div class="ui basic segment">
<h4 class="ui header">Citeable. Discoverable.</h4>
<h4 class="ui header">{{ _("Citeable. Discoverable.") }}</h4>
<p class="bodytext">
Uploads get a Digital Object Identifier (DOI) to make them easily and
uniquely citeable.
{{ _("Uploads get a Digital Object Identifier (DOI) to make them easily and uniquely citeable.") }}
</p>
<h4 class="ui header">Communities.</h4>
<h4 class="ui header">{{ _("Communities.") }}</h4>
<p class="bodytext">
Accept or reject uploads to your own community (e.g workshops, EU projects,
institutions or entire disciplines).
{{ _("Accept or reject uploads to your own community (e.g workshops, EU projects, institutions or entire disciplines).") }}
</p>
<h4 class="ui header">Trusted Research Data Management</h4>
<h4 class="ui header">{{ _("Trusted Research Data Management") }}</h4>
<p class="bodytext">
Built on top of I-Form expertise in the managing of research data.
{{ _("Built on top of I-Form expertise in the managing of research data.") }}
</p>
</div>
</div>
@@ -42,12 +40,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>
<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('static', filename=config.INVENIO_THEME_IFORM_ICON) }}"
height="20px"
/>
</a>
@@ -67,13 +65,13 @@
<div class="ui padded centered large form">
<div class="ui styled accordion">
<div class="title trigger {{ accordion_active }}">
Sign up with repository credentials
{{ _("Sign up with repository credentials") }}
<i class="user icon button"></i>
</div>
<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"
>
@@ -93,7 +91,7 @@
<div class="centered row">
<button type="submit" class="ui fluid large submit button">
<i class="ui edit outline icon"></i>Sign up
<i class="ui edit outline icon"></i>{{ _("Sign up") }}
</button>
</div>
</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('static', filename='favicon.ico') }}" />
{%- if keywords %}
<link rel="canonical" href="{{ canonical_url }}" />
@@ -8,33 +8,27 @@
#}
<div class="ui segment" style="padding-bottom: 10px;">
<h4>Good reasons to use the I-Form Repository</h4>
<h4>{{ _("Good reasons to use the I-Form Repository") }}</h4>
<ul>
<li><strong>Safe</strong> &mdash; Your research results are permanently available.</li>
<li><strong>{{ _("Safe") }}</strong> &mdash; {{ _("Your research results are permanently available.") }}</li>
<li>
<strong>Trusted</strong> &mdash; A service from I-Form, based on software developed by
CERN.
<strong>{{ _("Trusted") }}</strong> &mdash; {{ _("A service from I-Form, based on software developed by CERN.") }}
</li>
<li>
<strong>Citeable</strong> &mdash; Every upload is assigned a Digital Object Identifier
(DOI).
<strong>{{ _("Citeable") }}</strong> &mdash; {{ _("Every upload is assigned a Digital Object Identifier (DOI).") }}
</li>
<li>
<strong>No waiting time</strong> &mdash; Uploads are made available online as soon as
you hit publish. Your DOI is registered within seconds.
<strong>{{ _("No waiting time") }}</strong> &mdash; {{ _("Uploads are made available online as soon as you hit publish. Your DOI is registered within seconds.") }}
</li>
<li>
<strong>Open or closed</strong> &mdash; You determine the visibility of your uploads. A
restricted access mode is possible.
<strong>{{ _("Open or closed") }}</strong> &mdash; {{ _("You determine the visibility of your uploads. A restricted access mode is possible.") }}
</li>
<li>
<strong>Versioning</strong> &mdash; Easily update your dataset with the versioning
feature.
<strong>{{ _("Versioning") }}</strong> &mdash; {{ _("Easily update your dataset with the versioning feature.") }}
</li>
<li>
<strong>Usage statistics</strong> &mdash; All uploads display standards compliant usage
statistics. <a href="help/statistics">(More)</a>
<strong>{{ _("Usage statistics") }}</strong> &mdash; {{ _("All uploads display standards compliant usage statistics.") }} <a href="help/statistics">({{ _("More") }})</a>
</li>
</ul>
</div>
@@ -7,19 +7,19 @@
#}
<div class="ui segment">
<h4>Need help?</h4>
<h4>{{ _("Need help?") }}</h4>
{%- if config.THEME_IFORM_CONTACT_FORM %}
<div style="padding-bottom: 10px;">
<a id="feedback-form" class="fluid ui button">Contact us</a>
<a id="feedback-form" class="fluid ui button">{{ _("Contact us") }}</a>
</div>
{%- endif %}
<p>We can help with:</p>
<p>{{ _("We can help with:") }}</p>
<ul>
<li>Uploading your research results, software, preprints, etc.</li>
<li>Increasing upload limit beyond our default policy of 10GB.</li>
<li>Establishing contact with data stewards.</li>
<li>Finding individual solutions.</li>
<li>{{ _("Uploading your research results, software, preprints, etc.") }}</li>
<li>{{ _("Increasing upload limit beyond our default policy of 10GB.") }}</li>
<li>{{ _("Establishing contact with data stewards.") }}</li>
<li>{{ _("Finding individual solutions.") }}</li>
</ul>
</div>
@@ -8,10 +8,12 @@
{% extends config.THEME_ERROR_TEMPLATE %}
{% block message %}
<h1>Internal server error</h1>
<h1>{{ _("Internal server error") }}</h1>
<p>
Please contact <a href="mailto:{{ config.THEME_IFORM_SUPPORT_EMAIL }}">our support</a> to
let us know about this error.
{{ _(
'Please contact <a href="mailto:{support_email}">our support</a>\n to let us know about this error.'
).format(support_email=config.THEME_IFORM_SUPPORT_EMAIL)|safe
}}
</p>
{# TODO: provide g.sentry_event_id here once sentry is configured, cf. invenio_theme/500.html #}
{% endblock message %}
@@ -22,7 +22,7 @@
<div class="ui grid">
<div class="doubling three column row">
<div class="column">
<h2>Repository</h2>
<h2>{{ _("Repository") }}</h2>
<div class="ui list">
<div class="item">
<a
@@ -30,7 +30,7 @@
title="Repository documentation"
target="_blank"
>
Documentation <i class="external alternate icon"></i>
{{ _("Documentation") }} <i class="external alternate icon"></i>
</a>
</div>
@@ -40,7 +40,7 @@
title="Quick guide"
target="_blank"
>
Reference Guide <i class="download icon"></i>
{{ _("Reference Guide") }} <i class="download icon"></i>
</a>
</div>
@@ -49,7 +49,7 @@
href="{{ url_for('invenio_app_rdm.help_search') }}"
title="Search guide"
>
Search Guide<i class="angle right icon"></i>
{{ _("Search Guide") }}<i class="angle right icon"></i>
</a>
</div>
@@ -59,7 +59,7 @@
title="General Data Protection Rights"
target="_blank"
>
Data Protection <i class="download icon"></i>
{{ _("Data Protection") }} <i class="download icon"></i>
</a>
</div>
@@ -69,53 +69,32 @@
title="Terms and Conditions"
target="_blank"
>
Terms and Conditions <i class="download icon"></i>
{{ _("Terms and Conditions") }} <i class="download icon"></i>
</a>
</div>
</div>
</div>
<div class="column">
<h2>Features</h2>
<h2>{{ _("Features") }}</h2>
<div class="ui list">
<div class="item">Scalability</div>
<div class="item">Institutional integration</div>
<div class="item">Next Generation Repository</div>
<div class="item">Repository Profiles</div>
<div class="item">Resilient</div>
<div class="item">{{ _("Scalability") }}</div>
<div class="item">{{ _("Institutional integration") }}</div>
<div class="item">{{ _("Next Generation Repository") }}</div>
<div class="item">{{ _("Repository Profiles") }}</div>
<div class="item">{{ _("Resilient") }}</div>
</div>
</div>
<!-- <div class="column">
<h2>Connected Services</h2>
<div class="ui list">
<div class="item">
<a href="https://pure.tugraz.at" title="PURE" target="_blank">
PURE <i class="external alternate icon"></i>
</a>
</div>
<div class="item">
<a href="http://campusonline.tugraz.at" title="CAMPUS online" target="_blank">
CampusOnline <i class="external alternate icon"></i>
</a>
</div>
<div class="item">
<a href="https://rdm.i-form.ie" title="Research Data Management" target="_blank">
Research Data Management <i class="external alternate icon"></i>
</a>
</div>
</div>
</div> -->
<div class="column">
<h2>Accessibility</h2>
<h2>{{ _("Accessibility") }}</h2>
<div class="ui list">
<div class="item">Tip:</div>
<div class="item">Use Ctrl + and Crtl -</div>
<div class="item">to change the font size.</div>
<div class="item">{{ _("Tip:") }}</div>
<div class="item">{{ _("Use Ctrl + and Crtl -") }}</div>
<div class="item">{{ _("to change the font size.") }}</div>
</div>
</div>
</div>
@@ -125,14 +104,14 @@
<div class="doubling two column row">
<div class="column">
<div class="logos">
<strong>Powered by</strong>
<strong>{{ _("Powered by") }}</strong>
<a
href="http://inveniosoftware.org/products/rdm"
target="_blank"
title="invenioRDM"
>
<img
src="{{ url_for("static", filename="images/inveniordm-tail.svg") }}"
src="{{ url_for('static', filename='images/inveniordm-tail.svg') }}"
alt="InvenioRDM logo"
style="display: block; height: 90px; margin-top: 8px;"
/>
@@ -141,14 +120,14 @@
</div>
<div class="column">
<div class="logos">
<strong>Funded by</strong>
<strong>{{ _("Funded by") }}</strong>
<a
href="https://www.sfi.ie"
target="_blank"
title="Science Foundation Ireland"
>
<img
src="{{ url_for("static", filename="images/SFI_logo.png") }}"
src="{{ url_for('static', filename='images/SFI_logo.png') }}"
alt="Science Foundation Ireland"
style="display: block; height: auto; margin-top: 15px; width: 230px;"
/>
@@ -10,9 +10,9 @@
<div class="center aligned ui equal height grid">
<div class="left aligned column">
<div class="ui segment image">
<h2>Research Results</h2>
<h2>{{ _("Research Results") }}</h2>
<div>Frontpage: Description for research results</div>
<div>{{ _("Research results is the collective term for all the results of a research project. They describe the data, source code and all digital objects on which publication results are based. These include the tools used to collect and process the research data. The following links offer the possibility to add research results to the repository, but also to search for the results of other people.") }}</div>
<ul>
{#
@@ -21,19 +21,19 @@
</li>
#}
<li>
<a href="records/search">Search for research results</a>
<a href="records/search">{{ _("Search for research results") }}</a>
</li>
<li>
<a href="me/uploads">Upload research results</a>
<a href="me/uploads">{{ _("Upload research results") }}</a>
</li>
</ul>
</div>
</div>
<div class="left aligned column">
<div class="ui segment image">
<h2>Publications</h2>
<h2>{{ _("Publications") }}</h2>
<div>Frontpage: Description for publications</div>
<div>{{ _("The section of publications covers citations from several areas. Open Access papers are imported from Pure. Publications from Open Access publishers are shared. Digital copies are offered. University publications are made available to a wide range of people. The following link offers the possibility to search among publications.") }}</div>
<ul>
{#
@@ -42,28 +42,23 @@
</li>
#}
<li>
<a href="publications/search">Search for publications</a>
<a href="publications/search">{{ _("Search for publications") }}</a>
</li>
</ul>
</div>
</div>
<div class="left aligned column">
<div class="ui segment image">
<h2>Educational Resources</h2>
<h2>{{ _("Digital Tools & Software") }}</h2>
<div>Frontpage: Description for open educational resources</div>
<div>{{ _("Frontpage: Description for digital tools and software") }}</div>
<ul>
{#
<li>
<a href="oer/browse">Browse</a>
</li>
#}
<li>
<a href="oer/search">Search for educational resourses</a>
<a href="records/search?q=metadata.resource_type.id:software">{{ _("Search for digital tools & software") }}</a>
</li>
<li>
<a href="oer/uploads">Upload educational resources</a>
<a href="me/uploads">{{ _("Upload digital tools & software") }}</a>
</li>
</ul>
</div>
@@ -9,8 +9,8 @@
{% if not config.THEME_IFORM_PRODUCTION %}
<div class="ui sticky test-instance">
<h4>Test Instance</h4>
<p>This is the test instance of the I-Form Repository.</p>
<h4>{{ _("Test Instance") }}</h4>
<p>{{ _("This is the test instance of the I-Form Repository.") }}</p>
</div>
{% endif %}
@@ -33,25 +33,25 @@
<div class="two wide column main-menu-entry">
<a
href="{{ url_for('invenio_theme_iform.index') }}"
title="Home"
title="{{ _('Home') }}"
class="no-decoration"
>
<span class="home-inline">
{%- include "invenio_theme_iform/home_icon.svg" %} Home
{%- include "invenio_theme_iform/home_icon.svg" %} {{ _("Home") }}
</span>
</a>
</div>
</div>
<div class="two wide column main-menu-entry">
<a role="menuitem" href="/communities" class="no-decoration"
>Communities</a
>
</div>
<div class="two wide column main-menu-entry">
<a role="menuitem" href="/me/overview" class="no-decoration"
>Dashboard</a
>
</div>
<div class="two wide column main-menu-entry">
<a role="menuitem" href="/communities" class="no-decoration"
>{{ _("Communities") }}</a
>
</div>
<div class="two wide column main-menu-entry">
<a role="menuitem" href="/me/overview" class="no-decoration"
>{{ _("Dashboard") }}</a
>
</div>
</div>
<div id="margin-divider" class="ui divider main-menu-underline-line"></div>
@@ -1,98 +1,88 @@
{#
Copyright (C) 2020-2023 Graz University of Technology.
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.
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.
#}
{%
set options = [
{
"key": "records",
"text": "All",
"value": url_for("invenio_search_ui.search"),
"title": "repo",
},{
"key": "rdm",
"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",
}
]
set options = [
{
"key": "records",
"text": "All",
"value": url_for("invenio_search_ui.search"),
"title": "repo",
},{
"key": "rdm",
"text": "Research Results",
"value": "/records/search",
"title": "Research Data",
}
]
%}
<div class="ui container">
<div class="short-menu" id="all-menu-top-table">
<div class="short-menu-left">
<div id="all-menu-top-left-item">
<div class="short-menu-left-search">
<div style="display: inline-block;">
<div class="item p-0 search-bar rel-mr-1">
<!-- prettier-ignore-attribute data-options -->
<div id="header-search-bar" data-options='{{ options | tojson }}'></div>
</div>
</div>
</div>
<div class="short-menu" id="all-menu-top-table">
<div class="short-menu-left">
<div id="all-menu-top-left-item">
<div class="short-menu-left-search">
<div style="display: inline-block;">
<div class="item p-0 search-bar rel-mr-1">
<!-- prettier-ignore-attribute data-options -->
<div id="header-search-bar" data-options='{{ options | tojson }}'></div>
</div>
</div>
</div>
<div class="short-menu-right">
{%- block navbar_right %}
{%- include config.THEME_HEADER_LOGIN_TEMPLATE %}
{%- endblock navbar_right %}
<div class="short-menu-left-lang">
{%- for l in current_i18n.get_locales() %}
<a href="{{ url_for('invenio_i18n.set_lang', lang_code=l.language) }}"
class="no-decoration {% if current_i18n.language == l.language %}active{% endif %}">
{{ l.get_display_name().upper()[0:2] }}
</a>
{%- endfor %}
</div>
</div>
</div>
</div>
<!----END MENU------------------------------------------------------------->
<div class="ui grid" id="main-logo">
<!-- Left -->
<div class="left floated left aligned six wide column" id="repo-logo">
<div class="inline-elements">
<div class="repo-img">{%- include "invenio_theme_iform/repository_logo.svg" %}</div>
<div class="affiliation-text">
<a
title="Home"
href="{{ url_for("invenio_theme_iform.index") }}"
class="no-decoration"
>
I-FORM
<br />
RESEARCH DATA
<br />
REPOSITORY
</a>
</div>
</div>
</div>
<!-- Right -->
<div class="right floated right aligned six wide column">
<div class="affiliation-logo" id="int-header-logo">
<div class="affiliation-logo-claim">
<div class="affiliation-logo-claim-single">Excellence</div>
<div class="affiliation-logo-claim-single">Through</div>
<div class="affiliation-logo-claim-single">Expertise</div>
</div>
<a
href="https://www.i-form.ie"
title="I-Form Home"
target="_blank"
class="no-decoration"
>
{%- include "invenio_theme_iform/iform_logo.svg" %}
</a>
</div>
</div>
<div class="short-menu-right">
{%- block navbar_right %}
{%- include config.THEME_HEADER_LOGIN_TEMPLATE %}
{%- endblock navbar_right %}
</div>
</div>
<!----END MENU------------------------------------------------------------->
<div class="ui grid" id="main-logo">
<!-- Left -->
<div class="left floated left aligned six wide column" id="repo-logo">
<div class="inline-elements">
<div class="repo-img">{%- include "invenio_theme_iform/repository_logo.svg" %}</div>
<div class="affiliation-text">
<a title="Home" href="{{ url_for('invenio_theme_iform.index') }}" class="no-decoration">
{{ _("I-FORM") }}
<br />
{{ _("RESEARCH DATA") }}
<br />
{{ _("REPOSITORY") }}
</a>
</div>
</div>
</div>
<!-- Right -->
<div class="right floated right aligned six wide column">
<div class="affiliation-logo" id="int-header-logo">
<div class="affiliation-logo-claim">
<div class="affiliation-logo-claim-single">{{ _("Excellence") }}</div>
<div class="affiliation-logo-claim-single">{{ _("Through") }}</div>
<div class="affiliation-logo-claim-single">{{ _("Expertise") }}</div>
</div>
<a href="https://www.i-form.ie" title="I-Form Home" target="_blank" class="no-decoration">
{%- include "invenio_theme_iform/iform_logo.svg" %}
</a>
</div>
</div>
</div>
</div>
@@ -28,7 +28,7 @@
{# 3 columns: Research-Uploads, Communities, and Requests #}
<div class="column">
<div class="ui segment" style="height: 480px">
<h2>Research Results</h2>
<h2>{{ _("Research Results") }}</h2>
<a class="ui left floated image" href="/me/uploads">
<img
width="400px"
@@ -36,14 +36,12 @@
src="{{ url_for('static', filename='images/diamond.svg') }}"
/>
</a>
<div class="ui right floated text">
Overview: Description for research results
</div>
{{ _("Research results gives the base on which publications are built.") }}
</div>
</div>
<div class="column">
<div class="ui segment" style="height: 480px">
<h2>Communities</h2>
<h2>{{ _("Communities") }}</h2>
<a class="ui left floated image" href="/me/communities">
<img
width="400px"
@@ -51,12 +49,12 @@
src="{{ url_for('static', filename='images/group-discussion.svg') }}"
/>
</a>
<div>Overview: Description of Communities</div>
<div>{{ _("Grow a community of individuals to sustain the platform going forward and thereby organize, curate and collaborate on records for your institution, project, topic or event.") }}</div>
</div>
</div>
<div class="column">
<div class="ui segment" style="height: 480px">
<h2>Requests</h2>
<h2>{{ _("Requests") }}</h2>
<a class="ui left floated image" href="/me/requests">
<img
width="400px"
@@ -64,7 +62,7 @@
src="{{ url_for('static', filename='images/umbrella.svg') }}"
/>
</a>
<div>Overview: Description of Requests</div>
<div>{{ _("Check for incoming notifications and community assignments or inquiries.") }}</div>
</div>
</div>
{% else %}
@@ -73,15 +71,11 @@
<div class="column">
{# a modal's HTML can be placed anywhere, so I placed it here, right before it's used #}
<div class="ui small modal" id="iform-unlock-modal">
<div class="header">On unlocking research uploads</div>
<div class="header">{{ _("On unlocking research uploads") }}</div>
<div class="content">
<p>
To ensure a well-curated repository, new users need to get unlocked
before being allowed to upload. Once unlocked, you can upload your
research, request its inclusion in a community, generate a DOI for
it, and publish it.
{# TODO: extra lines on policy about who gets accepted how for Research-Uploads #}
</p>
{{ _("To ensure a well-curated repository, new users need to get unlocked
before being allowed to upload. Once unlocked, you can upload your research,
request its inclusion in a community, generate a DOI for it, and publish it.") }}
<div id="anchor-unlock-form">
{# will be replaced with ZammadForm when generating it #}
<button
@@ -93,7 +87,7 @@
Got it!
</button>
<button id="generate-unlock-form" class="ui fluid button">
Request unlocking
{{ _("Request unlocking") }}
</button>
</div>
</div>
@@ -101,7 +95,7 @@
{# actual column contents start here #}
<div class="ui disabled segment" style="height: 480px">
<h2>Research Results</h2>
<h2>{{ _("Research Results") }}</h2>
<div
class="ui left floated image"
style="cursor: pointer"
@@ -115,40 +109,10 @@
src="{{ url_for('static', filename='images/diamond.svg') }}"
/>
</div>
<div class="ui right floated text">
Overview: Description for research results
</div>
{{ _("Research results gives the base on which publications are built.") }}
</div>
</div>
{% endif %}
{% if can_view_marc21 %}
<div class="column">
<div class="ui segment" style="height: 480px">
<h2>Publications</h2>
<a class="ui left floated image" href="/publications/uploads">
<img
width="400px"
alt="Publications"
src="{{ url_for('static', filename='images/library-book-svgrepo-com.svg') }}"
/>
</a>
<div>Overview: Description for publications</div>
</div>
</div>
{% endif %}
<div class="column">
<div class="ui segment" style="height: 480px">
<h2>Educational Resources</h2>
<a class="ui left floated image" href="/oer/uploads">
<img
width="400px"
alt="Open Educational Resources"
src="{{ url_for('static', filename='images/play.svg') }}"
/>
</a>
<div>Overview: Description for open educational resources</div>
</div>
</div>
</div>
</div>
{%- endblock %}
@@ -8,65 +8,61 @@
<!---Recent uploads-->
<div class="ten wide column random-records-frontpage">
<h2>Recent uploads</h2>
<h2>{{ _("Recent uploads") }}</h2>
{% if not records %}
<div class="ui centered grid">
<p style="font-size: medium;">There are no public records to show.</p>
<p style="font-size: medium;">{{ _("There are no public records to show.") }}</p>
</div>
{% endif %}
{%- for r in records %}
{%- set creation_date = r.created | from_isodatetime -%}
{%- set record_url = r.original.view %}
{%- set record_url = r.links.self_html %}
<article>
<div class="badges">
{# Publication date/Version badge #}
<span class="ui label blue" data-tooltip="Publication date" data-inverted="">
{{ r.created_date_l10n_long }}
{{ r.ui.created_date_l10n_long }}
</span>
{# Resource type badge #}
{% if r.metadata.types | length > 0 %}
{% if r.ui.resource_type %}
<span class="ui label grey" data-tooltip="Resource type" data-inverted="">
{{ r.metadata.types[0] }}
{{ r.ui.resource_type.title_l10n }}
</span>
{% endif %}
<span
class="ui label access-status {{ r.access_status.id }}"
data-tooltip="{{ r.access_status.description_l10n }}"
class="ui label access-status {{ r.ui.access_status.id }}"
data-tooltip="{{ r.ui.access_status.description_l10n }}"
data-inverted=""
>
<i class="icon {{ r.access_status.icon }}"></i>
{{ r.access_status.title_l10n }}
</span>
<span class="ui label schema" data-tooltip="Schema Type" data-inverted="">
{{ r.original.schema_l10n }}
<i class="icon {{ r.ui.access_status.icon }}"></i>
{{ r.ui.access_status.title_l10n }}
</span>
</div>
<h4>
<a href="{{ record_url }}" class="no-decoration"> {{ r.metadata.titles[0] }} </a>
<a href="{{ record_url }}" class="no-decoration"> {{ r.metadata.title }} </a>
</h4>
<p>
{%- for creator in r.metadata.creators %}
<span>{{ creator }}</span>
<span>{{ creator.person_or_org.name }}</span>
{%- endfor %}
</p>
<p class="hidden-xs">
<a href="{{ record_url }}" class="no-decoration">
{{ r.metadata.descriptions | join(" ") | striptags | truncate(300) }}
{{ r.metadata.description | striptags | truncate(300) }}
</a>
</p>
<div class="ui">
{%- for subject in r.metadata.subjects %}
<span class="ui tiny label">{{ subject }}</span>
<span class="ui tiny label">{{ subject.subject }}</span>
{%- endfor %}
<div>
<small>
@@ -83,7 +79,7 @@
{% if records %}
<div class="ui centered grid">
<a class="ui button more" href="{{ url_for('invenio_search_ui.search') }}">More</a>
<a class="ui button more" href="{{ url_for('invenio_search_ui.search') }}">{{ _("More") }}</a>
</div>
{%- endif %}
</div>
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+30 -36
View File
@@ -8,29 +8,40 @@
"""invenio module for I-Form theme."""
import traceback
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 (
GlobalSearchJSONSerializer,
)
from invenio_users_resources.proxies import current_user_resources
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 +81,6 @@ def require_iform_authenticated(view_func):
return decorated_view
@blueprint.route("/me/overview")
@login_required
def overview():
"""Overview."""
@@ -85,7 +95,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 +103,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)
@@ -109,32 +117,18 @@ def default_error_handler(e: Exception):
# - `e`, the passed-in exception
# 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
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()
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):
+3 -4
View File
@@ -24,10 +24,8 @@ classifiers = [
requires-python = ">=3.10,<3.14"
dependencies = [
"invenio-assets>=2.0.0",
"invenio-i18n>=1.3.1",
"invenio-config-iform>=2025.5.20.1",
"invenio_records_global_search>=0.0.1",
"invenio_records_marc21>=0.21.0",
"invenio-i18n>=2.0.0",
]
[project.urls]
@@ -43,7 +41,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"
invenio_theme_iform = "invenio_theme_iform.views:create_blueprint"
[project.entry-points."invenio_i18n.translations"]
messages = "invenio_theme_iform"
@@ -92,6 +90,7 @@ path = "invenio_theme_iform/__about__.py"
[tool.hatch.build]
include = ["invenio_theme_iform"]
exclude = [".venv", "tests/*", "*/tests/*", "*.rst", "run-tests.sh"]
ignore-vcs = true
# Testing configuration
[tool.pytest]
+1 -1
View File
@@ -24,7 +24,7 @@ def app(request):
"""Basic Flask application."""
app = Flask("testapp")
app.config.update(
I18N_LANGUAGES=[("en", "English"), ("de", "German")],
I18N_LANGUAGES=[("en", "English"), ("ga", "Irish")],
)
InvenioThemeIform(app)
InvenioI18N(app)
Generated
+1810 -1867
View File
File diff suppressed because it is too large Load Diff