mirror of
https://github.com/Cian-H/invenio-theme-iform.git
synced 2026-02-06 09:13:28 +00:00
fix deprecated before_app_first_request
This commit is contained in:
committed by
martinobersteiner
parent
049063fd7d
commit
923d4e8120
@@ -8,6 +8,7 @@
|
||||
|
||||
"""invenio module for TUGRAZ theme."""
|
||||
|
||||
from invenio_i18n import lazy_gettext as _
|
||||
from invenio_records_marc21.ui.theme import current_identity_can_view
|
||||
|
||||
from . import config
|
||||
@@ -42,3 +43,26 @@ class InvenioThemeTugraz(object):
|
||||
for k in dir(config):
|
||||
if k.startswith("INVENIO_THEME_TUGRAZ_") or k.startswith("THEME_TUGRAZ_"):
|
||||
app.config.setdefault(k, getattr(config, k))
|
||||
|
||||
|
||||
def finalize_app(app):
|
||||
"""Finalize app."""
|
||||
modify_user_dashboard(app)
|
||||
|
||||
|
||||
def modify_user_dashboard(app):
|
||||
"""Modify user dashboard."""
|
||||
root_menu = app.extensions["menu"].root_node
|
||||
|
||||
user_dashboard_menu = root_menu.submenu("dashboard")
|
||||
user_dashboard_menu.submenu("overview").register(
|
||||
"invenio_theme_tugraz.overview",
|
||||
text=_("Overview"),
|
||||
order=0,
|
||||
)
|
||||
|
||||
root_menu.submenu("actions.deposit").register(
|
||||
"invenio_theme_tugraz.overview",
|
||||
_("My dashboard"),
|
||||
order=1,
|
||||
)
|
||||
|
||||
@@ -12,10 +12,6 @@ from typing import Dict
|
||||
|
||||
from flask import Blueprint, g, render_template
|
||||
from flask_login import current_user, login_required
|
||||
from flask_menu import current_menu
|
||||
from invenio_i18n import lazy_gettext as _
|
||||
|
||||
# from invenio_rdm_records.resources.serializers import UIJSONSerializer
|
||||
from invenio_records_global_search.resources.serializers import (
|
||||
GlobalSearchJSONSerializer,
|
||||
)
|
||||
@@ -60,24 +56,6 @@ def cast_to_dict(attr_dict):
|
||||
return AttrDict.to_dict(attr_dict)
|
||||
|
||||
|
||||
@blueprint.before_app_first_request
|
||||
def modify_user_dashboard():
|
||||
"""Modify user dashboard."""
|
||||
user_dashboard_menu = current_menu.submenu("dashboard")
|
||||
|
||||
user_dashboard_menu.submenu("overview").register(
|
||||
"invenio_theme_tugraz.overview",
|
||||
text=_("Overview"),
|
||||
order=0,
|
||||
)
|
||||
|
||||
current_menu.submenu("actions.deposit").register(
|
||||
"invenio_theme_tugraz.overview",
|
||||
_("My dashboard"),
|
||||
order=1,
|
||||
)
|
||||
|
||||
|
||||
def ui_blueprint(app):
|
||||
"""Blueprint for the routes and resources provided by Invenio-theme-tugraz."""
|
||||
routes = app.config.get("TUG_ROUTES")
|
||||
|
||||
@@ -62,6 +62,8 @@ invenio_assets.webpack =
|
||||
invenio_theme_tugraz_theme = invenio_theme_tugraz.webpack:theme
|
||||
invenio_config.module =
|
||||
invenio_theme_tugraz = invenio_theme_tugraz.config
|
||||
invenio_base.finalize_app =
|
||||
invenio_theme_tugraz = invenio_theme_tugraz.ext:finalize_app
|
||||
|
||||
[aliases]
|
||||
test = pytest
|
||||
|
||||
Reference in New Issue
Block a user