diff --git a/uffd/default_config.cfg b/uffd/default_config.cfg index 72953217802c3ccb08522378839382459c8c02f7..fb837a154ec9bb2f1a739ceb6406c38ce77fd18f 100644 --- a/uffd/default_config.cfg +++ b/uffd/default_config.cfg @@ -122,6 +122,13 @@ SERVICES=[ # ] # }, ] + +# A banner text that will be displayed above the services list +SERVICES_BANNER='' + +# If the banner should be shown to users who are not logged in +SERVICES_BANNER_PUBLIC=True + # Enable the service overview page for users who are not logged in SERVICES_PUBLIC=True diff --git a/uffd/services/templates/overview.html b/uffd/services/templates/overview.html index c81b826657f3bb1917c89c8d0a1182dc940f31b9..5b91772c043787a7f5aa7b4d1dc1fda8e0c058bc 100644 --- a/uffd/services/templates/overview.html +++ b/uffd/services/templates/overview.html @@ -8,6 +8,14 @@ <div class="alert alert-warning" role="alert">Some services may not be publicly listed! Log in to see all services you have access to.</div> {% endif %} +{% if banner %} +<div class="card"> + <div class="card-body"> + {{ banner|safe }} + </div> +</div> +{% endif %} + {% macro service_card(service) %} <div class="col mb-4"> <div class="card h-100 {{ 'text-muted' if not service.has_access }}"> diff --git a/uffd/services/views.py b/uffd/services/views.py index 7d9f03defaae2c147ae4adfc6a271f4d13908b4b..f4f9a805156966300b07748ac68f3dbd17a83d36 100644 --- a/uffd/services/views.py +++ b/uffd/services/views.py @@ -83,4 +83,11 @@ def index(): services = get_services(user) if not current_app.config['SERVICES']: abort(404) - return render_template('overview.html', user=user, services=services) + + banner = current_app.config.get('SERVICES_BANNER') + + # Set the banner to None if it is not public and no user is logged in + if not (current_app.config["SERVICES_BANNER_PUBLIC"] or user): + banner = None + + return render_template('overview.html', user=user, services=services, banner=banner)