global: adds routes for tug

This: migrated from invenio-theme-tugraz
This commit is contained in:
mb-wali
2021-06-04 11:29:20 +02:00
committed by Mojib Wali
parent b33c7e09c3
commit 7ca398efdd
13 changed files with 48 additions and 4 deletions

View File

@@ -49,3 +49,6 @@ recursive-include invenio_config_tugraz *.html
# added by check-manifest
recursive-include invenio_config_tugraz *.csv
# added by check-manifest
recursive-include invenio_config_tugraz *.pdf

View File

@@ -38,6 +38,8 @@ Override configs from diffrent invenio modules to meet TU Graz requirement:
* Invenio-Mail
* Invenio-shibboleth
* Invenio-accounts
* Flask-security
* Defined routes for TUG
Further documentation is available on
https://invenio-config-tugraz.readthedocs.io/

View File

@@ -29,6 +29,13 @@ INVENIO_CONFIG_TUGRAZ_IP_RANGES =
[["127.0.0.2", "127.0.0.99"], ["127.0.1.3", "127.0.1.5"]]
"""
CONFIG_TUGRAZ_ROUTES = {
"guide": "/guide",
"terms": "/terms",
"gdpr": "/gdpr",
}
"""Defined routes for TUG."""
# Invenio-App
# ===========
# See https://invenio-app.readthedocs.io/en/latest/configuration.html

View File

@@ -4,10 +4,10 @@
{{ _('To help you get started, here are some useful links:') }}
- {{ _('Guidelines:')}} {{ _('Repository Guide')}} ({{ _('how to upload files')}}) (https://{{ config.SITE_HOSTNAME }}{{ url_for('invenio_theme_tugraz.guide') }})
- {{ _('Guidelines:')}} {{ _('Repository Guide')}} ({{ _('how to upload files')}}) (https://{{ config.SITE_HOSTNAME }}{{ url_for('invenio_config_tugraz.guide') }})
- {{ _('Search Guide')}} (https://{{ config.SITE_HOSTNAME }}{{url_for('invenio_app_rdm.help_search')}})
- {{ _('Terms And Conditions') }} (https://{{ config.SITE_HOSTNAME }}{{ url_for('invenio_theme_tugraz.terms') }})
- {{ _('Data Protection Rights')}} (https://{{ config.SITE_HOSTNAME }}{{ url_for('invenio_theme_tugraz.gdpr') }})
- {{ _('Terms And Conditions') }} (https://{{ config.SITE_HOSTNAME }}{{ url_for('invenio_config_tugraz.terms') }})
- {{ _('Data Protection Rights')}} (https://{{ config.SITE_HOSTNAME }}{{ url_for('invenio_config_tugraz.gdpr') }})
{% if security.confirmable %}
{{ _('You can confirm your email through the link below:') }}
{{ confirmation_link }}">

View File

@@ -12,17 +12,25 @@ from os import environ
from typing import Dict
from elasticsearch_dsl.utils import AttrDict
from flask import Blueprint, current_app
from flask import Blueprint, current_app, redirect, url_for
from flask_babelex import get_locale
def ui_blueprint(app):
"""Blueprint for the routes and resources provided by invenio-config-tugraz."""
routes = app.config.get("CONFIG_TUGRAZ_ROUTES")
blueprint = Blueprint(
"invenio_config_tugraz",
__name__,
template_folder="templates",
static_folder="static",
)
blueprint.add_url_rule(routes["guide"], view_func=guide)
blueprint.add_url_rule(routes["terms"], view_func=terms)
blueprint.add_url_rule(routes["gdpr"], view_func=gdpr)
@blueprint.before_app_first_request
def rank_higher():
"""Rank this modules blueprint higher than blueprint of security module."""
@@ -42,3 +50,27 @@ def ui_blueprint(app):
blueprints[our_index] = temp
return blueprint
def guide():
"""TUGraz_Repository_Guide."""
locale = get_locale()
return redirect(url_for('static',
filename=f'documents/TUGraz_Repository_Guide_02_{locale}.pdf',
_external=True))
def terms():
"""Terms_And_Conditions."""
locale = get_locale()
return redirect(url_for('static',
filename=f'documents/TUGraz_Repository_Terms_And_Conditions_{locale}.pdf',
_external=True))
def gdpr():
"""General_Data_Protection_Rights."""
locale = get_locale()
return redirect(url_for('static',
filename=f'documents/TUGraz_Repository_General_Data_Protection_Rights_{locale}.pdf',
_external=True))