diff --git a/invenio_github/assets/semantic-ui/js/invenio_github/index.js b/invenio_github/assets/semantic-ui/js/invenio_github/index.js index 4492b63..4573c87 100644 --- a/invenio_github/assets/semantic-ui/js/invenio_github/index.js +++ b/invenio_github/assets/semantic-ui/js/invenio_github/index.js @@ -1,6 +1,5 @@ // This file is part of InvenioGithub // Copyright (C) 2023 CERN. -// Copyright (C) 2024 KTH Royal Institute of Technology. // // Invenio Github is free software; you can redistribute it and/or modify it // under the terms of the MIT License; see LICENSE file for more details. @@ -13,14 +12,6 @@ function addResultMessage(element, color, icon, message) { element.querySelector(".content").textContent = message; } -const gh_translations = window.gh_translations || { - repositories_synced: "Repositories synced successfully. Please reload the page.", - request_failed: "Request failed with status code:", - timeout_message: "This action seems to take some time, refresh the page after several minutes to inspect the synchronization.", - problem_occurred: "There has been a problem:", - repo_sync_success: "Repository synced successfully. Please reload the page." -}; - // function from https://www.w3schools.com/js/js_cookies.asp function getCookie(cname) { let name = cname + "="; @@ -84,7 +75,7 @@ if (sync_button) { resultMessage, "positive", "checkmark", - gh_translations?.repositories_synced + "Repositories synced successfully. Please reload the page." ); sync_button.classList.remove("disabled"); setTimeout(function () { @@ -95,7 +86,7 @@ if (sync_button) { resultMessage, "negative", "cancel", - `${gh_translations?.request_failed} ${response.status}` + `Request failed with status code: ${response.status}` ); setTimeout(function () { resultMessage.classList.add("hidden"); @@ -109,14 +100,15 @@ if (sync_button) { resultMessage, "warning", "hourglass", - gh_translations?.timeout_message + "This action seems to take some time, refresh the page after several minutes to inspect the synchronisation." ); - } else { + } + else { addResultMessage( resultMessage, "negative", "cancel", - `${gh_translations?.problem_occurred} ${error}` + `There has been a problem: ${error}` ); setTimeout(function () { resultMessage.classList.add("hidden"); @@ -166,7 +158,7 @@ function sendEnableDisableRequest(checked, repo) { switchMessage, "positive", "checkmark", - gh_translations?.repo_sync_success + "Repository synced successfully. Please reload the page." ); setTimeout(function () { switchMessage.classList.add("hidden"); @@ -176,7 +168,7 @@ function sendEnableDisableRequest(checked, repo) { switchMessage, "negative", "cancel", - `${gh_translations?.request_failed} ${response.status}` + `Request failed with status code: ${response.status}` ); setTimeout(function () { switchMessage.classList.add("hidden"); @@ -187,7 +179,7 @@ function sendEnableDisableRequest(checked, repo) { switchMessage, "negative", "cancel", - `${gh_translations?.problem_occurred} ${error}` + `There has been a problem: ${error}` ); setTimeout(function () { switchMessage.classList.add("hidden"); diff --git a/invenio_github/templates/semantic-ui/invenio_github/settings/base.html b/invenio_github/templates/semantic-ui/invenio_github/settings/base.html index e87f7ea..bda79db 100644 --- a/invenio_github/templates/semantic-ui/invenio_github/settings/base.html +++ b/invenio_github/templates/semantic-ui/invenio_github/settings/base.html @@ -2,24 +2,12 @@ This file is part of Invenio. Copyright (C) 2023 CERN. - Copyright (C) 2024 KTH Royal Institute of Technology. Invenio is free software; you can redistribute it and/or modify it under the terms of the MIT License; see LICENSE file for more details. #} {%- extends "invenio_github/base.html" %} -{# We place the translations before any content in page_body loads.#} -{% block translations %} - -{% endblock %} + {%- block page_body %} {%- block settings_content %} {%- endblock settings_content %}