From 2e8e7a875a54f130be8344f2d8878e59d1229e0a Mon Sep 17 00:00:00 2001 From: Ole Wieners Date: Wed, 28 Aug 2024 14:59:36 +0200 Subject: [PATCH] Add config for editor return label --- backend/src/config/opencast.rs | 17 +++++++++++++++++ backend/src/http/assets.rs | 1 + docs/docs/setup/config.toml | 15 +++++++++++++++ frontend/src/config.ts | 1 + frontend/src/routes/manage/Video/Details.tsx | 4 +++- util/dev-config/config.toml | 2 ++ 6 files changed, 39 insertions(+), 1 deletion(-) diff --git a/backend/src/config/opencast.rs b/backend/src/config/opencast.rs index c496a0d08..ecb6cd9c4 100644 --- a/backend/src/config/opencast.rs +++ b/backend/src/config/opencast.rs @@ -8,6 +8,8 @@ use crate::{ config::HttpHost, }; +use super::TranslatedString; + #[derive(Debug, confique::Config)] pub(crate) struct OpencastConfig { @@ -49,6 +51,21 @@ pub(crate) struct OpencastConfig { /// be trusted. #[config(default = [])] pub(crate) other_hosts: Vec, + + /// Set the return label for Editor. + /// This is for text on a button that will take you back to Tobira + /// after editing is done. + /// Part of that text ("Return to" / "Zurück zu") is fixed in Editor and + /// cannot be configured here. + /// The label can be configured in english and german. + /// + /// Example: + /// editor_return_label.en = "Tobira" + /// editor_return_label.de = "Aribot" + /// + /// Results in "Return to Tobira" / "Zurück zu Aribot". + /// If not set, "Video" is used for both languages. + pub(crate) editor_return_label: Option, } impl OpencastConfig { diff --git a/backend/src/http/assets.rs b/backend/src/http/assets.rs index fcd168e8b..3746200c6 100644 --- a/backend/src/http/assets.rs +++ b/backend/src/http/assets.rs @@ -286,6 +286,7 @@ fn frontend_config(config: &Config) -> serde_json::Value { "uploadNode": config.opencast.upload_node().to_string(), "studioUrl": config.opencast.studio_url().to_string(), "editorUrl": config.opencast.editor_url().to_string(), + "editorReturnLabel": config.opencast.editor_return_label, }, "logo": { "large": logo_obj(&config.theme.logo.large), diff --git a/docs/docs/setup/config.toml b/docs/docs/setup/config.toml index b78eae74d..3cee11187 100644 --- a/docs/docs/setup/config.toml +++ b/docs/docs/setup/config.toml @@ -427,6 +427,21 @@ # Default value: [] #other_hosts = [] +# Set the return label for Editor. +# This is for text on a button that will take you back to Tobira +# after editing is done. +# Part of that text ("Return to" / "Zurück zu") is fixed in Editor and +# cannot be configured here. +# The label can be configured in english and german. +# +# Example: +# editor_return_label.en = "Tobira" +# editor_return_label.de = "Aribot" +# +# Results in "Return to Tobira" / "Zurück zu Aribot". +# If not set, "Video" is used for both languages. +#editor_return_label = + [sync] # Username of the user used to communicate with Opencast for data syncing. diff --git a/frontend/src/config.ts b/frontend/src/config.ts index 978c0078d..331a36887 100644 --- a/frontend/src/config.ts +++ b/frontend/src/config.ts @@ -83,6 +83,7 @@ type OpencastConfig = { uploadNode: string; studioUrl: string; editorUrl: string; + editorReturnLabel: TranslatedString | null; }; type VersionInfo = { diff --git a/frontend/src/routes/manage/Video/Details.tsx b/frontend/src/routes/manage/Video/Details.tsx index 775dcb15f..eb7f998d7 100644 --- a/frontend/src/routes/manage/Video/Details.tsx +++ b/frontend/src/routes/manage/Video/Details.tsx @@ -71,7 +71,9 @@ const Page: React.FC = ({ event }) => { params={{ id: event.opencastId, callbackUrl: document.location.href, - callbackSystem: translatedConfig(CONFIG.siteTitle, i18n), + callbackSystem: CONFIG.opencast.editorReturnLabel + ? translatedConfig(CONFIG.opencast.editorReturnLabel, i18n) + : t("video.video"), }} fallback="button" css={buttonStyle(config, "normal", isHighContrast)} diff --git a/util/dev-config/config.toml b/util/dev-config/config.toml index 94150bb7b..44395df10 100644 --- a/util/dev-config/config.toml +++ b/util/dev-config/config.toml @@ -37,6 +37,8 @@ secret_key = "jwt-key.pem" [opencast] host = "http://localhost:8081" +editor_return_label.en = "Video" +editor_return_label.de = "dem Video" [sync] user = "admin"