Skip to content

Commit

Permalink
Add config for editor return label
Browse files Browse the repository at this point in the history
  • Loading branch information
owi92 committed Sep 16, 2024
1 parent 1516e5f commit 4e4e631
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 1 deletion.
17 changes: 17 additions & 0 deletions backend/src/config/opencast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ use crate::{
config::HttpHost,
};

use super::TranslatedString;


#[derive(Debug, confique::Config)]
pub(crate) struct OpencastConfig {
Expand Down Expand Up @@ -49,6 +51,21 @@ pub(crate) struct OpencastConfig {
/// be trusted.
#[config(default = [])]
pub(crate) other_hosts: Vec<HttpHost>,

/// 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: TranslatedString,
}

impl OpencastConfig {
Expand Down
1 change: 1 addition & 0 deletions backend/src/http/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
17 changes: 17 additions & 0 deletions docs/docs/setup/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,23 @@
# 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.
#
# Required! This value must be specified.
#editor_return_label =


[sync]
# Username of the user used to communicate with Opencast for data syncing.
Expand Down
1 change: 1 addition & 0 deletions frontend/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ type OpencastConfig = {
uploadNode: string;
studioUrl: string;
editorUrl: string;
editorReturnLabel: TranslatedString | null;
};

type VersionInfo = {
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/routes/manage/Video/Details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ const Page: React.FC<Props> = ({ 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)}
Expand Down
2 changes: 2 additions & 0 deletions util/dev-config/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 4e4e631

Please sign in to comment.