Compare commits

..
38 Commits
Author SHA1 Message Date
Cian-H ca9b574669 chore: version bump 2026-08-14 14:35:13 +01:00
Cian-H 0d544fdc8e Attempted to fix favicon display 2026-08-14 14:34:57 +01:00
Cian-H 154d77e187 Updated dependencies 2026-08-14 14:34:24 +01:00
Cian-H c177eaffc3 Fixed coverage testing 2026-08-14 14:30:28 +01:00
Cian-H cdee2d929d chore: version bump 2026-08-13 17:35:46 +01:00
Cian-H fc920e1b04 Updated footer logos 2026-08-13 14:23:00 +01:00
Cian-H 9963c3e7fe Added user login and account creation to admin panels 2026-08-13 14:03:03 +01:00
Cian-H 9040da0172 Added admin panel access with Role Assignment 2026-08-13 13:30:53 +01:00
Cian-H 4ff4e83e05 Added translation compilation to wheel 2026-08-13 11:54:10 +01:00
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
Cian-H de36035b59 Patch: fixed code coverage badge display 2025-05-23 17:16:58 +01:00
Cian-H f0643b3488 Patch: config cleanup 2025-05-23 17:15:26 +01:00
Cian-H 9b5e74ae67 Removed unnecessary docker version check 2025-05-23 16:26:44 +01:00
Cian-H 1a91b1c33c Added automatic coveralls coverage reporting 2025-05-23 16:13:39 +01:00
Cian-H f4d6435146 Fixed url for code coverage badge 2025-05-23 16:12:19 +01:00
Cian-H 2297d2f3dd Removed unnecessary docs/requirements.txt 2025-05-23 15:25:08 +01:00
51 changed files with 13844 additions and 2889 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"
+2
View File
@@ -20,6 +20,8 @@ jobs:
enable-cache: true
cache-dependency-glob: |
pyproject.toml
- name: Compile translations
run: uv run pybabel compile -d invenio_theme_iform/translations/
- name: Build package
run: uv build
- name: Publish to PyPI
+8 -2
View File
@@ -74,13 +74,19 @@ jobs:
run: |
uv --version
uv run python --version
docker --version
docker ps
- name: Install dependencies
run: |
uv sync --group tests
- name: Run tests
env:
PYTEST_ADDOPTS: "--cov-report=lcov"
run: |
uv run test
- name: Upload coverage to Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: coverage.lcov
+5 -5
View File
@@ -15,20 +15,20 @@
.. image:: https://img.shields.io/pypi/dm/invenio-theme-iform.svg
:target: https://pypi.python.org/pypi/invenio-theme-iform
.. image:: https://img.shields.io/github/tag/tu-graz-library/invenio-theme-iform.svg
.. image:: https://img.shields.io/github/tag/Cian-H/invenio-theme-iform.svg
:target: https://github.com/Cian-H/invenio-theme-iform/releases
.. image:: https://img.shields.io/github/license/tu-graz-library/invenio-theme-iform.svg
.. image:: https://img.shields.io/github/license/Cian-H/invenio-theme-iform.svg
:target: https://github.com/Cian-H/invenio-theme-iform/blob/master/LICENSE
.. 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/mb-wali/invenio-theme-iform.svg
:target: https://coveralls.io/r/mb-wali/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
View File
@@ -1 +0,0 @@
-e .[docs,tests]
+1 -1
View File
@@ -8,4 +8,4 @@
"""Metadata for this python module."""
__version__ = "2025.5.20.3"
__version__ = "2026.8.14"
@@ -0,0 +1,9 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2024 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.
"""Administration views."""
+219
View File
@@ -0,0 +1,219 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2024 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.
"""I-Form administration views."""
import json
import os
from datetime import datetime
from flask import current_app, flash, redirect, request, url_for
from invenio_accounts.models import Role, User
from invenio_accounts.proxies import current_accounts
from invenio_administration.views.base import AdminView
from invenio_db import db
from invenio_i18n import lazy_gettext as _
def get_site_settings_path():
"""Get the path to site_settings.json."""
app_data_dir = os.path.join(current_app.instance_path, "app_data")
os.makedirs(app_data_dir, exist_ok=True)
return os.path.join(app_data_dir, "site_settings.json")
def get_site_settings():
"""Load site settings from JSON file."""
path = get_site_settings_path()
if not os.path.exists(path):
return {"registration_enabled": True}
try:
with open(path, "r") as f:
return json.load(f)
except Exception:
return {"registration_enabled": True}
def set_site_settings(settings):
"""Save site settings to JSON file."""
path = get_site_settings_path()
with open(path, "w") as f:
json.dump(settings, f, indent=2)
class RoleManagementView(AdminView):
"""Admin view for managing user roles."""
name = "roles"
category = "User management"
template = "invenio_theme_iform/administration/roles.html"
url = "/roles"
menu_label = _("Role Assignment")
icon = "users"
def get(self):
"""Render the role management template."""
roles = Role.query.order_by(Role.name).all()
selected_role_id = request.args.get("role_id")
users = []
selected_role = None
if selected_role_id:
selected_role = Role.query.get(selected_role_id)
if selected_role:
users = User.query.order_by(User.email).all()
return self.render(
roles=roles,
selected_role=selected_role,
users=users,
)
def post(self):
"""Handle role assignment/revocation."""
user_id = request.form.get("user_id")
role_id = request.form.get("role_id")
action = request.form.get("action")
if not (user_id and role_id and action):
flash(_("Missing required fields."), "error")
return redirect(url_for("administration.roles", role_id=role_id))
try:
user = User.query.get(int(user_id))
except ValueError:
user = None
role = Role.query.get(role_id)
if not user or not role:
flash(_("User or role not found."), "error")
return redirect(url_for("administration.roles", role_id=role_id))
if action == "enable":
if role not in user.roles:
current_accounts.datastore.add_role_to_user(user, role)
flash(
_("Role {role} enabled for {email}.").format(
role=role.name, email=user.email
),
"success",
)
elif action == "disable":
if role in user.roles:
current_accounts.datastore.remove_role_from_user(user, role)
flash(
_("Role {role} disabled for {email}.").format(
role=role.name, email=user.email
),
"success",
)
db.session.commit()
return redirect(url_for("administration.roles", role_id=role_id))
class RegistrationSettingsView(AdminView):
"""Admin view for controlling site registration settings."""
name = "registration-settings"
category = "Site Settings"
template = "invenio_theme_iform/administration/registration_settings.html"
url = "/registration-settings"
menu_label = _("Registration Settings")
icon = "setting"
def get(self):
"""Render registration settings page."""
settings = get_site_settings()
return self.render(
registration_enabled=settings.get("registration_enabled", True)
)
def post(self):
"""Handle registration settings update."""
enabled = request.form.get("registration_enabled") == "true"
settings = get_site_settings()
settings["registration_enabled"] = enabled
set_site_settings(settings)
status_str = _("enabled") if enabled else _("disabled")
flash(
_("Public user registration has been {status}.").format(
status=status_str
),
"success",
)
return redirect(url_for("administration.registration-settings"))
class UserCreateView(AdminView):
"""Admin view for creating users."""
name = "create-user"
category = "User management"
template = "invenio_theme_iform/administration/user_create.html"
url = "/create-user"
menu_label = _("Create User")
icon = "user plus"
def get(self):
"""Render user creation page."""
return self.render()
def post(self):
"""Handle manual user creation."""
from flask_security.utils import hash_password
from invenio_access.permissions import system_identity
from invenio_users_resources.proxies import current_users_service
email = request.form.get("email", "").strip()
password = request.form.get("password", "").strip()
confirm_email = request.form.get("confirm_email") == "true"
if not email or not password:
flash(_("Email and Password are required."), "error")
return redirect(url_for("administration.create-user"))
if User.query.filter_by(email=email).first():
flash(_("A user with this email already exists."), "error")
return redirect(url_for("administration.create-user"))
try:
user_kwargs = {
"email": email,
"password": hash_password(password),
"active": True,
}
if confirm_email:
user_kwargs["confirmed_at"] = datetime.utcnow()
user = current_accounts.datastore.create_user(**user_kwargs)
db.session.commit()
# Index the newly created user in search engine
try:
from invenio_search import current_search_client
current_users_service.reindex(system_identity, uids=[user.id])
current_users_service.indexer.process_bulk_queue()
current_search_client.indices.refresh(index="*")
except Exception as ie:
current_app.logger.warning("Failed to index user %s: %s", user.id, str(ie))
flash(
_("User {email} created successfully.").format(email=email),
"success",
)
except Exception as e:
db.session.rollback()
flash(
_("Failed to create user: {error}").format(error=str(e)),
"error",
)
return redirect(url_for("administration.create-user"))
@@ -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 () {
@@ -39,8 +39,20 @@
}
}
div .logos a:hover {
background-color: transparent !important;
div .logos {
--invenio-logo-glass-color: @invenioLogoGlassColor;
--ri-logo-color: @riLogoColor;
a:hover {
background-color: transparent !important;
}
}
}
@media (prefers-color-scheme: dark) {
#footer div .logos {
--invenio-logo-glass-color: #ffffff;
--ri-logo-color: @riLogoColorDark;
}
}
@@ -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;
}
@@ -59,6 +59,9 @@
// footer specific
@footerGrey: #5e5e5e;
@footerBottomBackground: #f2f2f2;
@invenioLogoGlassColor: #333333;
@riLogoColor: #19261b;
@riLogoColorDark: #decbe9;
// record specific
@recordVersionBackground: #f2f2f2;
+20 -4
View File
@@ -8,7 +8,15 @@
"""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"
@@ -46,6 +54,9 @@ THEME_500_TEMPLATE = "invenio_theme_iform/default_error.html"
THEME_LOGO = "images/iform_logo.png"
"""I-Form logo"""
THEME_FAVICON = "images/iform-favicon.ico"
"""I-Form favicon"""
THEME_SEARCHBAR = False
"""Enable or disable the header search bar."""
@@ -55,16 +66,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 +120,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",
}
+38 -4
View File
@@ -8,8 +8,8 @@
"""invenio module for I-Form theme."""
from flask import g, has_request_context, request
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,12 +32,36 @@ class InvenioThemeIform(object):
app.register_error_handler(423, locked)
@app.context_processor
def inject_visibility():
return {"can_view_marc21": current_identity_can_view()}
@app.before_request
def block_registration_if_disabled():
if request.endpoint == "security.register":
from flask import current_app, render_template
from .administration.views import get_site_settings
settings = get_site_settings()
if not settings.get("registration_enabled", True):
admin_email = (
current_app.config.get("APP_RDM_ADMIN_EMAIL_RECIPIENT")
or current_app.config.get("SUPPORT_EMAIL")
or current_app.config.get("THEME_SUPPORT_EMAIL")
or current_app.config.get("SECURITY_EMAIL_SENDER")
or "info@repo.i-form.ie"
)
return (
render_template(
"invenio_theme_iform/accounts/registration_disabled.html",
admin_email=admin_email,
),
403,
)
app.extensions["invenio-theme-iform"] = self
@app.context_processor
def inject_site_settings():
from .administration.views import get_site_settings
settings = get_site_settings()
return dict(registration_enabled=settings.get("registration_enabled", True))
def init_config(self, app):
"""Initialize configuration."""
for k in dir(config):
@@ -51,6 +75,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"

Before

Width:  |  Height:  |  Size: 330 KiB

After

Width:  |  Height:  |  Size: 330 KiB

@@ -0,0 +1,20 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100%" height="100%" viewBox="0 0 29.069883 10.420284">
<g transform="translate(1142.2809,279.38339)">
<a transform="matrix(0.26458333,0,0,0.26458333,-1279.7936,-339.14401)" id="a9715" xlink:href="/products/rdm/">
<g transform="translate(0.9420447)">
<g aria-label="RDM" transform="scale(0.96631971,1.0348542)" style="font-style:normal;font-variant:normal;font-weight:600;font-stretch:normal;font-size:37.37073898px;font-family:Oswald;fill:#fb8273;stroke:none">
<path d="m 628.93512,251.59732 0.52319,-30.2703 h 6.53987 l 3.73708,19.09645 3.99867,-19.09645 h 6.31565 l 0.52319,30.2703 h -4.48449 l -0.48582,-20.51654 -3.84918,20.51654 h -3.84919 l -4.03604,-20.66602 -0.41108,20.66602 z m -21.27388,0 v -30.2703 h 7.3994 q 3.84919,0 5.97932,1.00901 2.1675,0.97164 3.0644,3.10177 0.8969,2.09276 0.8969,5.38139 v 11.02437 q 0,3.36336 -0.8969,5.53087 -0.8969,2.1675 -3.02703,3.21388 -2.09276,1.00901 -5.8672,1.00901 z m 6.16617,-4.29763 h 1.30798 q 1.71905,0 2.42909,-0.52319 0.74742,-0.56057 0.93427,-1.60695 0.18686,-1.08375 0.18686,-2.65332 V 230.0344 q 0,-1.56957 -0.2616,-2.50384 -0.22422,-0.97163 -0.97164,-1.42008 -0.71004,-0.44845 -2.35436,-0.44845 h -1.2706 z m -27.84412,4.29763 v -30.2703 h 7.84785 q 3.06441,0 5.23191,0.71005 2.20487,0.67267 3.36336,2.42909 1.19587,1.75643 1.19587,4.8582 0,1.86854 -0.33634,3.326 -0.29896,1.42008 -1.12112,2.50384 -0.78479,1.04638 -2.24224,1.68168 l 4.18552,14.76144 h -6.31566 l -3.47548,-13.71506 h -2.1675 v 13.71506 z m 6.16617,-17.37739 h 1.7938 q 1.49483,0 2.35435,-0.48582 0.85953,-0.48582 1.19587,-1.45746 0.3737,-1.00901 0.3737,-2.46647 0,-2.09276 -0.78478,-3.17651 -0.74742,-1.12113 -2.84018,-1.12113 h -2.09276 z"/>
</g>
<g transform="matrix(0.43046721,0,0,0.43046721,198.64479,126.38329)">
<g transform="translate(474.21725,226.44114)">
<path d="m 328.162,4.665 c -18.767,0 -34.032,15.268 -34.032,34.034 0,7.28 2.306,14.028 6.214,19.568 l -30.078,26.432 c -1.881,1.878 0.067,6.867 1.944,8.749 1.879,1.876 6.87,3.822 8.748,1.943 l 26.265,-29.894 c 5.779,4.525 13.047,7.233 20.939,7.233 18.768,0 34.034,-15.267 34.034,-34.032 0,-18.765 -15.266,-34.033 -34.034,-34.033 z m 0,56.722 c -12.51,0 -22.689,-10.177 -22.689,-22.688 0,-12.511 10.18,-22.69 22.689,-22.69 12.513,0 22.688,10.18 22.688,22.69 0,12.51 -10.175,22.688 -22.688,22.688 z" style="fill:var(--invenio-logo-glass-color, #000000)"/>
</g>
<g transform="matrix(0.38742049,0,0,0.38742049,670.93796,251.12579)">
<path d="m 375.104,38.079 c 0.174,18.184 -8.123,32.126 -11.51,37.52 8.183,-5.347 19.898,-19.36 19.674,-37.661 0.174,-18.183 -11.431,-32.127 -19.631,-37.52 3.323,5.347 11.691,19.36 11.467,37.661 z" style="fill:var(--invenio-logo-glass-color, #000000)"/>
<path d="m 375.104,38.079 c 0.174,18.184 -8.123,32.126 -11.51,37.52 8.183,-5.347 19.898,-19.36 19.674,-37.661 0.174,-18.183 -11.431,-32.127 -19.631,-37.52 3.323,5.347 11.691,19.36 11.467,37.661 z" style="fill:none;stroke:var(--invenio-logo-glass-color, #000000)"/>
</g>
</g>
</g>
</a>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.1 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 9.6 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 9.6 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 9.8 KiB

@@ -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 %}
@@ -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('static', filename=config.THEME_FAVICON or 'images/iform-favicon.ico') }}" />
{%- if keywords %}<link rel="canonical" href="{{ canonical_url }}" />{% endif %}
{%- block head_links_langs %}
{%- if alternate_urls %}
@@ -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 %}
@@ -2,7 +2,7 @@
{%- if not current_user.is_authenticated %}
{%- if config.SECURITY_REGISTERABLE %}
{%- if config.SECURITY_REGISTERABLE and registration_enabled %}
<div class="short-menu-right-button">
<a href="{{ url_for('security.register') }}" class="no-decoration">
{{ _ ("Sign up") }}
@@ -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 %}
@@ -22,9 +22,16 @@
<i class="user icon"></i> {{ current_user.email }}
</a>
</div>
{%- for item in current_menu.submenu('profile-admin').children if item.visible %}
<div class="short-menu-right-button">
<a class="dropdown-item no-decoration" href="{{ item.url }}">
{{ item.text|safe }}
</a>
</div>
{%- endfor %}
<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>
@@ -0,0 +1,42 @@
{#
Copyright (C) 2024 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.
#}
{% extends config.THEME_ERROR_TEMPLATE %}
{% block message %}
<div class="ui container center aligned rel-mt-5 rel-mb-5">
<h1 class="ui icon header">
<i class="user cancel icon red"></i>
<div class="content">
{{ _("Public Registration Disabled") }}
<div class="sub header rel-mt-2">
{{ _("Public user registration is currently closed on this repository.") }}
</div>
</div>
</h1>
<div class="ui message info left aligned" style="max-width: 600px; margin: 2em auto;">
<div class="header">
{{ _("Need an account?") }}
</div>
<p>
{{ _("If you require an account to upload or manage research data, please contact an administrator at:") }}
</p>
<p style="font-size: 1.1em; font-weight: bold; text-align: center;">
<a href="mailto:{{ admin_email }}"><i class="envelope icon"></i> {{ admin_email }}</a>
</p>
</div>
<div class="rel-mt-3">
<a href="{{ url_for('security.login') }}" class="ui button primary">
<i class="sign-in icon"></i> {{ _("Back to Log In") }}
</a>
<a href="{{ url_for('index') }}" class="ui button">
<i class="home icon"></i> {{ _("Home Page") }}
</a>
</div>
</div>
{% endblock message %}
@@ -0,0 +1,61 @@
{#
Copyright (C) 2024 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.
#}
{% extends "invenio_administration/base.html" %}
{% block admin_page_content %}
<div class="ui container dashboard rel-mt-5">
<div class="ui grid">
<div class="sixteen wide column">
<h2 class="ui header">
<i class="setting icon"></i>
<div class="content">
{{ _("Registration Settings") }}
<div class="sub header">{{ _("Enable or disable public user registration on the website.") }}</div>
</div>
</h2>
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, message in messages %}
<div class="ui {{ 'positive' if category == 'success' else 'negative' }} message">
{{ message }}
</div>
{% endfor %}
{% endif %}
{% endwith %}
<div class="ui segment">
<h3 class="ui header">{{ _("Public Sign-up Status") }}</h3>
<p>
{% if registration_enabled %}
<span class="ui green large label"><i class="check icon"></i> {{ _("Public Sign-ups ENABLED") }}</span>
{% else %}
<span class="ui red large label"><i class="ban icon"></i> {{ _("Public Sign-ups DISABLED") }}</span>
{% endif %}
</p>
<div class="ui divider"></div>
<form method="POST" class="ui form">
{% if registration_enabled %}
<input type="hidden" name="registration_enabled" value="false">
<button type="submit" class="ui red button">
<i class="ban icon"></i> {{ _("Disable Public Sign-ups") }}
</button>
{% else %}
<input type="hidden" name="registration_enabled" value="true">
<button type="submit" class="ui green button">
<i class="check icon"></i> {{ _("Enable Public Sign-ups") }}
</button>
{% endif %}
</form>
</div>
</div>
</div>
</div>
{% endblock %}
@@ -0,0 +1,120 @@
{#
Copyright (C) 2024 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.
#}
{% extends "invenio_administration/base.html" %}
{% block admin_page_content %}
<div class="ui container dashboard rel-mt-5">
<div class="ui grid">
<div class="sixteen wide column">
<h2 class="ui header">
<i class="users icon"></i>
<div class="content">
{{ _("Role Assignment") }}
<div class="sub header">{{ _("Select a role and enable or disable it for users.") }}</div>
</div>
</h2>
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, message in messages %}
<div class="ui {{ 'positive' if category == 'success' else 'negative' }} message">
{{ message }}
</div>
{% endfor %}
{% endif %}
{% endwith %}
<div class="ui segment">
<form method="GET" class="ui form">
<div class="field">
<label>{{ _("Select a Role") }}</label>
<div class="ui action input">
<select name="role_id" class="ui dropdown">
<option value="">{{ _("-- Select a role --") }}</option>
{% for r in roles %}
<option value="{{ r.id }}" {% if selected_role and selected_role.id == r.id %}selected{% endif %}>
{{ r.name }}
</option>
{% endfor %}
</select>
<button class="ui button primary" type="submit">{{ _("Select") }}</button>
</div>
</div>
</form>
</div>
{% if selected_role %}
<div class="ui segment">
<h3 class="ui header">
{{ _("Users assigned to:") }} {{ selected_role.name }}
{% if selected_role.description %}
<div class="sub header" style="margin-top: 5px;">
<i class="info circle icon"></i> {{ selected_role.description }}
</div>
{% endif %}
</h3>
<table class="ui celled striped table">
<thead>
<tr>
<th>{{ _("Email") }}</th>
<th>{{ _("Active") }}</th>
<th class="center aligned">{{ _("Has Role?") }}</th>
<th class="center aligned">{{ _("Actions") }}</th>
</tr>
</thead>
<tbody>
{% for user in users %}
<tr>
<td>{{ user.email }}</td>
<td>
{% if user.active %}
<div class="ui green horizontal label">{{ _("Active") }}</div>
{% else %}
<div class="ui grey horizontal label">{{ _("Inactive") }}</div>
{% endif %}
</td>
{% set has_role = selected_role in user.roles %}
<td class="center aligned">
{% if has_role %}
<i class="green check large icon"></i>
{% else %}
<i class="red times large icon"></i>
{% endif %}
</td>
<td class="center aligned">
<form method="POST" style="display:inline;">
<input type="hidden" name="user_id" value="{{ user.id }}">
<input type="hidden" name="role_id" value="{{ selected_role.id }}">
{% if has_role %}
<input type="hidden" name="action" value="disable">
<button class="ui tiny red button" type="submit">
<i class="minus icon"></i> {{ _("Disable") }}
</button>
{% else %}
<input type="hidden" name="action" value="enable">
<button class="ui tiny green button" type="submit">
<i class="plus icon"></i> {{ _("Enable") }}
</button>
{% endif %}
</form>
</td>
</tr>
{% else %}
<tr>
<td colspan="4" class="center aligned">{{ _("No users found.") }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
</div>
</div>
</div>
{% endblock %}
@@ -0,0 +1,58 @@
{#
Copyright (C) 2024 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.
#}
{% extends "invenio_administration/base.html" %}
{% block admin_page_content %}
<div class="ui container dashboard rel-mt-5">
<div class="ui grid">
<div class="sixteen wide column">
<h2 class="ui header">
<i class="user plus icon"></i>
<div class="content">
{{ _("Create User") }}
<div class="sub header">{{ _("Manually add a new user account.") }}</div>
</div>
</h2>
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, message in messages %}
<div class="ui {{ 'positive' if category == 'success' else 'negative' }} message">
{{ message }}
</div>
{% endfor %}
{% endif %}
{% endwith %}
<div class="ui segment">
<form method="POST" class="ui form">
<div class="field required">
<label>{{ _("Email Address") }}</label>
<input type="email" name="email" placeholder="user@example.com" required>
</div>
<div class="field required">
<label>{{ _("Password") }}</label>
<input type="password" name="password" placeholder="Password" required>
</div>
<div class="field">
<div class="ui checkbox">
<input type="checkbox" name="confirm_email" value="true" id="confirm_email" checked>
<label for="confirm_email">{{ _("Automatically confirm email address (allow immediate login)") }}</label>
</div>
</div>
<button type="submit" class="ui button primary">
<i class="user plus icon"></i> {{ _("Create User") }}
</button>
</form>
</div>
</div>
</div>
</div>
{% endblock %}
@@ -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=config.THEME_FAVICON or 'images/iform-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,31 +104,31 @@
<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"
title="InvenioRDM"
>
<img
src="{{ url_for("static", filename="images/inveniordm-tail.svg") }}"
src="{{ url_for('static', filename='images/invenio-favicon.svg') }}"
alt="InvenioRDM logo"
style="display: block; height: 90px; margin-top: 8px;"
style="display: block; height: 50px; margin-top: 8px;"
/>
</a>
</div>
</div>
<div class="column">
<div class="logos">
<strong>Funded by</strong>
<strong>{{ _("Funded by") }}</strong>
<a
href="https://www.sfi.ie"
href="https://www.researchireland.ie"
target="_blank"
title="Science Foundation Ireland"
title="Research Ireland"
>
<img
src="{{ url_for("static", filename="images/SFI_logo.png") }}"
alt="Science Foundation Ireland"
src="{{ url_for('static', filename='images/research-ireland-logo.svg') }}"
alt="Research Ireland"
style="display: block; height: auto; margin-top: 15px; width: 230px;"
/>
</a>
@@ -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):
+11 -6
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"
@@ -57,6 +55,12 @@ invenio_theme_iform = "invenio_theme_iform.config"
[project.entry-points."invenio_base.finalize_app"]
invenio_theme_iform = "invenio_theme_iform.ext:finalize_app"
[project.entry-points."invenio_administration.views"]
invenio_theme_iform_roles = "invenio_theme_iform.administration.views:RoleManagementView"
invenio_theme_iform_registration_settings = "invenio_theme_iform.administration.views:RegistrationSettingsView"
invenio_theme_iform_user_create = "invenio_theme_iform.administration.views:UserCreateView"
[dependency-groups]
dev = [
"hatch>=1.14.1",
@@ -92,15 +96,16 @@ 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]
addopts = "--ruff --ruff-format --pydocstyle --doctest-glob=\"*.rst\" --doctest-modules --cov=invenio_config_iform --cov-report=term-missing tests invenio_theme_iform"
addopts = "--ruff --ruff-format --pydocstyle --doctest-glob=\"*.rst\" --doctest-modules --cov=invenio_theme_iform --cov-report=term-missing tests invenio_theme_iform"
testpaths = ["tests", "invenio_theme_iform"]
live_server_scope = "module"
[tool.pytest.ini_options]
addopts = "--ruff --ruff-format --pydocstyle --doctest-glob=\"*.rst\" --doctest-modules --cov=invenio_config_iform --cov-report=term-missing tests invenio_theme_iform"
addopts = "--ruff --ruff-format --pydocstyle --doctest-glob=\"*.rst\" --doctest-modules --cov=invenio_theme_iform --cov-report=term-missing tests invenio_theme_iform"
testpaths = ["tests", "invenio_theme_iform"]
live_server_scope = "module"
+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
+2821 -2463
View File
File diff suppressed because it is too large Load Diff