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 Aug 28, 2024
1 parent cc00d29 commit 43103e7
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 1 deletion.
16 changes: 16 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 @@ -44,6 +46,20 @@ pub(crate) struct OpencastConfig {
///
/// Example: "https://admin.oc.my-uni.edu/editor-ui/index.html".
pub(crate) editor_url: Option<ToolBaseUri>,

/// Set the return label for Editor.
/// This is for text on 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".
pub(crate) editor_return_label: Option<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
14 changes: 14 additions & 0 deletions docs/docs/setup/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,20 @@
# Example: "https://admin.oc.my-uni.edu/editor-ui/index.html".
#editor_url =

# Set the return label for Editor.
# This is for text on 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".
#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;
};

type VersionInfo = {
Expand Down
5 changes: 4 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,10 @@ const Page: React.FC<Props> = ({ event }) => {
params={{
id: event.opencastId,
callbackUrl: document.location.href,
callbackSystem: translatedConfig(CONFIG.siteTitle, i18n),
callbackSystem: translatedConfig(
CONFIG.opencast.editorReturnLabel,
i18n,
),
}}
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 43103e7

Please sign in to comment.