Skip to content
Snippets Groups Projects
Commit 407d3af7 authored by Erwan Rouchet's avatar Erwan Rouchet
Browse files

Merge branch 'frontend-banner' into 'master'

Embed a maintenance message as HTML meta

Closes #826

See merge request !1464
parents 1b0c34fd b6a00d57
No related branches found
No related tags found
1 merge request!1464Embed a maintenance message as HTML meta
......@@ -15,6 +15,13 @@ class CacheType(Enum):
Dummy = 'dummy'
class BannerStyle(Enum):
Info = 'info'
Success = 'success'
Warning = 'warning'
Error = 'error'
class CookieSameSiteOption(Enum):
"""
Options for the SameSite flag on a cookie. Django accepts Lax, Strict, None and False.
......@@ -160,6 +167,10 @@ def get_settings_parser(base_dir):
features_parser.add_option('transkribus', type=bool, default=True)
features_parser.add_option('workers', type=bool, default=False)
banner_parser = parser.add_subparser('banner', default={})
banner_parser.add_option('message', type=str, default=None)
banner_parser.add_option('style', type=BannerStyle, default=BannerStyle.Info)
cache_parser = ConfigParser()
cache_parser.add_option('type', type=CacheType, default=None)
cache_parser.add_option('url', type=str, default=None)
......
......@@ -545,6 +545,9 @@ FRONTEND_SENTRY_DSN = conf['sentry']['frontend_dsn']
# https://doorbell.io settings
FRONTEND_DOORBELL = conf['doorbell']
# Banner settings
FRONTEND_BANNER = conf['banner']
# Specific setting to enable GitLab webhook when using PageKite, it should not be used in production.
# It is used to change GitLab webhook URLs to go through a specified PageKite domain instead of localhost.
# None by default.
......
allowed_hosts: []
arkindex_env: dev
banner:
message: null
style: info
cache:
path: null
type: null
......
allowed_hosts: all of them
arkindex_env: off
banner:
style: big
cache:
type: redis
cors:
......
banner:
style: "'big' is not a valid BannerStyle"
cache:
url: cache.url is required for a Redis cache
cors:
......
allowed_hosts:
- something.com
arkindex_env: prod
banner:
message: This is a paragraph with **bold** text.
style: success
cache:
path: /
type: filesystem
......
......@@ -37,6 +37,7 @@ class CdnHome(CachedViewMixin, TemplateView):
ctx['frontend_version'] = settings.FRONTEND_VERSION
ctx['frontend_sentry_dsn'] = settings.FRONTEND_SENTRY_DSN
ctx['frontend_doorbell'] = settings.ARKINDEX_FEATURES['doorbell'] and settings.FRONTEND_DOORBELL
ctx['frontend_banner'] = settings.FRONTEND_BANNER
return ctx
......
......@@ -14,6 +14,10 @@
<meta name="doorbell_id" content="{{ frontend_doorbell.id }}">
<meta name="doorbell_appkey" content="{{ frontend_doorbell.appkey }}">
{% endif %}
{% if frontend_banner.message %}
<meta name="banner_message" content="{{ frontend_banner.message }}">
<meta name="banner_style" content="{{ frontend_banner.style }}">
{% endif %}
<title>ArkIndex {{ frontend_version }}</title>
<link href="{{ cdn_assets_url }}/{{ frontend_version }}/arkindex-{{ frontend_version }}.css" rel="stylesheet">
</head>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment