Skip to content

Commit

Permalink
Merge branch 'main' into bc-6609-grading-parenttype-migration
Browse files Browse the repository at this point in the history
  • Loading branch information
dyedwiper authored Mar 25, 2024
2 parents eba2fd5 + 2c002d9 commit 2d3c373
Show file tree
Hide file tree
Showing 16 changed files with 158 additions and 97 deletions.
1 change: 1 addition & 0 deletions controllers/administration.js
Original file line number Diff line number Diff line change
Expand Up @@ -2232,6 +2232,7 @@ router.get(
filterSettings: JSON.stringify(classFilterSettings({ years, defaultYear, showTab }, res)),
classesTabs,
showTab,
currentPath: 'administration/classes',
});
});
},
Expand Down
4 changes: 2 additions & 2 deletions controllers/news.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,11 @@ router.get('/:newsId', (req, res, next) => {
api(req, { version: VERSION })
.get(`/news/${req.params.newsId}`)
.then((news) => {
const creatorAndUpdaterPresent = !!(news.updater && news.creator);
const updatedAtNotEqualCreatedAt = !(news.updatedAt === news.createdAt);
res.render('news/article', {
title: news.title,
news,
creatorAndUpdaterPresent,
updatedAtNotEqualCreatedAt,
isRSS: news.source === 'rss',
});
})
Expand Down
52 changes: 2 additions & 50 deletions helpers/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const path = require('path');
const { Configuration } = require('@hpi-schul-cloud/commons');
const logger = require('./logger');
const api = require('../api');
const uk = require('../locales/calendar/uk.json');
const momentHelper = require('./momentHelper');

const i18nDebug = Configuration.get('I18N__DEBUG');
const fallbackLanguage = Configuration.get('I18N__FALLBACK_LANGUAGE');
Expand Down Expand Up @@ -89,57 +89,9 @@ const getInstance = () => (key, options = {}) => i18next.t(key, {
...options,
});

/*
// const CONFIG_ORIG = i18nMoment().locale('en').localeData()._relativeTime;
const relativeTime = {
d: 'a day',
dd: '%d days',
future: 'in %s',
h: 'an hour',
hh: '%d hours',
m: 'a minute',
M: 'a month',
mm: '%d minutes',
MM: '%d months',
past: '%s ago',
s: 'a few seconds',
ss: '%d seconds',
w: 'a week',
ww: '%d weeks',
y: 'a year',
};
*/
const createCustomRelativeTimeConfig = (localFile) => ({
d: `${localFile['moment.relativeTime.aDay']}`,
dd: `%d ${localFile['moment.relativeTime.days']}`,
future: `${localFile['moment.relativeTime.futureIn']} %s`,
h: `${localFile['moment.relativeTime.anHour']}`,
hh: `%d ${localFile['moment.relativeTime.hours']}`,
m: `${localFile['moment.relativeTime.aMinute']}`,
M: `${localFile['moment.relativeTime.aMonths']}`,
mm: `%d ${localFile['moment.relativeTime.minutes']}`,
MM: `%d ${localFile['moment.relativeTime.months']}`,
past: `%s ${localFile['moment.relativeTime.pastAgo']}`,
s: `${localFile['moment.relativeTime.aFewSecondes']}`,
ss: `%d ${localFile['moment.relativeTime.seconds']}`,
w: `${localFile['moment.relativeTime.aWeek']}`,
ww: `%d ${localFile['moment.relativeTime.weeks']}`,
y: `${localFile['moment.relativeTime.aYear']}`,
});

const selectMomentOptions = (langAttribute) => {
const options = {};

if (langAttribute === 'uk') {
options.relativeTime = createCustomRelativeTimeConfig(uk);
}

return options;
};

const changeLanguage = (langAttribute) => {
if (availableLanguages.includes(langAttribute)) {
const momentOptions = selectMomentOptions(langAttribute);
const momentOptions = momentHelper.selectMomentOptions(langAttribute);
i18nMoment.locale(langAttribute, momentOptions);
return i18next.changeLanguage(langAttribute);
}
Expand Down
63 changes: 63 additions & 0 deletions helpers/momentHelper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
const uk = require('../locales/calendar/uk.json');
const es = require('../locales/calendar/es.json');
const de = require('../locales/calendar/de.json');

/*
// const CONFIG_ORIG = i18nMoment().locale('en').localeData()._relativeTime;
const relativeTime = {
d: 'a day',
dd: '%d days',
future: 'in %s',
h: 'an hour',
hh: '%d hours',
m: 'a minute',
M: 'a month',
mm: '%d minutes',
MM: '%d months',
past: '%s ago',
s: 'a few seconds',
ss: '%d seconds',
w: 'a week',
ww: '%d weeks',
y: 'a year',
};
*/

const createCustomRelativeTimeConfig = (localFile) => ({
d: `${localFile['moment.relativeTime.aDay']}`,
dd: `%d ${localFile['moment.relativeTime.days']}`,
future: `${localFile['moment.relativeTime.futureIn']} %s`,
h: `${localFile['moment.relativeTime.anHour']}`,
hh: `%d ${localFile['moment.relativeTime.hours']}`,
m: `${localFile['moment.relativeTime.aMinute']}`,
M: `${localFile['moment.relativeTime.aMonths']}`,
mm: `%d ${localFile['moment.relativeTime.minutes']}`,
MM: `%d ${localFile['moment.relativeTime.months']}`,
past: `%s ${localFile['moment.relativeTime.pastAgo']}`,
s: `${localFile['moment.relativeTime.aFewSecondes']}`,
ss: `%d ${localFile['moment.relativeTime.seconds']}`,
w: `${localFile['moment.relativeTime.aWeek']}`,
ww: `%d ${localFile['moment.relativeTime.weeks']}`,
y: `${localFile['moment.relativeTime.aYear']}`,
yy: `%d ${localFile['moment.relativeTime.years']}`,
});

const selectMomentOptions = (langAttribute) => {
const options = {};

if (langAttribute === 'uk') {
options.relativeTime = createCustomRelativeTimeConfig(uk);
}
if (langAttribute === 'es') {
options.relativeTime = createCustomRelativeTimeConfig(es);
}
if (langAttribute === 'de') {
options.relativeTime = createCustomRelativeTimeConfig(de);
}

return options;
};

module.exports = {
selectMomentOptions,
};
2 changes: 1 addition & 1 deletion helpers/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const instanceInstitute = () => {
case 'thr':
return 'Thüringer Institut für Lehrerfortbildung, Lehrplanentwicklung und Medien';
case 'brb':
return 'Dataport';
return 'Ministerium für Bildung, Jugend und Sport des Landes Brandenburg';
default:
return 'Dataport';
}
Expand Down
18 changes: 18 additions & 0 deletions locales/calendar/de.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"moment.relativeTime.aDay": "ein Tag",
"moment.relativeTime.days": "Tage",
"moment.relativeTime.futureIn": "auf",
"moment.relativeTime.anHour": "eine Stunde",
"moment.relativeTime.hours": "Stunden",
"moment.relativeTime.aMinute": "eine Minute",
"moment.relativeTime.aMonths": "ein Monat",
"moment.relativeTime.minutes": "Minuten",
"moment.relativeTime.months": "Monate",
"moment.relativeTime.pastAgo": "vor",
"moment.relativeTime.aFewSecondes": "ein paar Sekunden",
"moment.relativeTime.seconds": "Sekunden",
"moment.relativeTime.aWeek": "eine Woche",
"moment.relativeTime.weeks": "Wochen",
"moment.relativeTime.aYear": "ein Jahr",
"moment.relativeTime.years": "Jahren"
}
18 changes: 18 additions & 0 deletions locales/calendar/es.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"moment.relativeTime.aDay": "un día",
"moment.relativeTime.days": "días",
"moment.relativeTime.futureIn": "en",
"moment.relativeTime.anHour": "una hora",
"moment.relativeTime.hours": "horas",
"moment.relativeTime.aMinute": "un minuto",
"moment.relativeTime.aMonths": "un mes",
"moment.relativeTime.minutes": "minutos",
"moment.relativeTime.months": "meses",
"moment.relativeTime.pastAgo": "hace",
"moment.relativeTime.aFewSecondes": "unos segundos",
"moment.relativeTime.seconds": "segundos",
"moment.relativeTime.aWeek": "una semana",
"moment.relativeTime.weeks": "semanas",
"moment.relativeTime.aYear": "un año",
"moment.relativeTime.years": "años"
}
3 changes: 2 additions & 1 deletion locales/calendar/uk.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@
"moment.relativeTime.seconds": "секунд",
"moment.relativeTime.aWeek": "тиждень",
"moment.relativeTime.weeks": "тижнів",
"moment.relativeTime.aYear": "рік"
"moment.relativeTime.aYear": "рік",
"moment.relativeTime.years": "років"
}
4 changes: 2 additions & 2 deletions locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@
"theSynchronizationOfLDAPMasterData": "Die Synchronisierung von LDAP-Stammdaten wird während der Transferphase unterbrochen. Somit werden Nutzerdaten und Klassen (sofern verwendet) nicht mehr über LDAP aktualisiert. Der Login mit bereits synchronisierten Login-Daten ist weiterhin möglich. Passwortänderungen im LDAP während des Logins werden ebenfalls berücksichtigt.",
"useTheTransferPhaseAroundTheSchool": "Nutze die Transferphase rund um den Schuljahreswechsel, um in Ruhe im LDAP Klassenzugehörigkeit und Personendaten anzupassen. Übernimm abschließend alle Änderungen mit einem Mal in die {{title}}.",
"withAllChangesAndSettings": "Mit allen Änderungen und Einstellungen im Verwaltungsbereich wird bestätigt, dass diese durch einen weisungsberechtigten Schul-Admin mit Befugnis zu Anpassungen der Schule in der Cloud durchgeführt werden. Anpassungen durch den Schul-Admin gelten insofern als Weisung der Schule gegenüber dem Cloudbetreiber {{institute_title}}.",
"withAllChangesForTSC": "Einige oder alle Nutzer:innendaten deiner Schule werden aus einer externen Quelle (LDAP, IDM, Schulportal o. ä.) synchronisiert. Die Bearbeitung dieser Nutzer:innen-Stammdaten ist deshalb nur im Quellsystem möglich, nicht in der Schul-Cloud. Das Anlegen neuer Schüler:innen oder Lehrkräfte ist ebenfalls nur im Quellsystem möglich.",
"wouldYouLikeReportABug": "Du möchtest einen Fehler melden oder hast eine Idee zur Verbesserung der {{title}}? Sende Wünsche oder Probleme direkt an den {{shortTitle}}-Nutzer-Support."
}
},
Expand Down Expand Up @@ -1248,8 +1249,7 @@
"toTask": "Zur Aufgabe"
},
"text": {
"announcement": "<b>Wichtige Ankündigung:</b> Das Tool neXboard wird durch <b>tldraw</b> ersetzt. Sichern Sie Ihre Inhalte aus den neXboards, die Sie weiter verwenden wollen, bitte bis zum <b>15.03.2024</b>. Bis dahin können angelegte neXboards weiterhin verwendet werden. Hier finden Sie <a target=\"_blank\" class=\"alert-link\" rel=\"noopener noreferrer\" href=\"https://blog.dbildungscloud.de/von-nexboard-zu-tldraw/\">Möglichkeiten der Sicherung und weitere Informationen</a>.",
"alternativeAnnouncement": "Ab sofort steht Ihnen <b>tldraw</b> als kollaboratives Whiteboard im Spalten-Board zur Verfügung. Neue neXboards können nun nicht mehr angelegt werden. Bereits erstellte neXboards sind noch bis <b>24.03.2024</b> zur Sicherung der Inhalte verfügbar. Hinweise zum Übertragen der Inhalte von neXboard zu tldraw finden Sie <a target=\"_blank\" class=\"alert-link\" rel=\"noopener noreferrer\" href=\"https://blog.dbildungscloud.de/von-nexboard-zu-tldraw/\">hier</a>.",
"announcement": "Ab sofort steht Ihnen <b>tldraw</b> als kollaboratives Whiteboard im Spalten-Board zur Verfügung. Neue neXboards können nun nicht mehr angelegt werden. Bereits erstellte neXboards sind noch bis <b>23.04.2024</b> zur Sicherung der Inhalte verfügbar. Hinweise zum Übertragen der Inhalte von neXboard zu tldraw finden Sie <a target=\"_blank\" class=\"alert-link\" rel=\"noopener noreferrer\" href=\"https://blog.dbildungscloud.de/von-nexboard-zu-tldraw/\">hier</a>.",
"emptyHomeworksInfo": "Keine gestellten Aufgaben. Du findest alle Aufgaben im Aufgaben-Bereich.",
"emptyNewsInfo": "Bisher gibt es keine News.",
"graded": "Bewertet",
Expand Down
4 changes: 2 additions & 2 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@
"theSynchronizationOfLDAPMasterData": "The synchronization of LDAP master data is interrupted during the transfer phase. This means that user data and classes (if used) are no longer updated via LDAP. It is still possible to log in with login data that has already been synchronized. Password changes in the LDAP during login are also taken into account.",
"useTheTransferPhaseAroundTheSchool": "Use the transfer phase around the change of school year to adjust class affiliation and personal data in the LDAP. Finally, transfer all changes to the {{title}} at once.",
"withAllChangesAndSettings": "With all changes and settings in the administration area, it is confirmed that these are carried out by a school admin with authority to make adjustments to the school in the cloud. Adjustments made by the school admin are deemed to be instructions from the school to the cloud operator {{institute_title}}.",
"withAllChangesForTSC": "Some or all of your school's user data is synchronised from an external source (LDAP, IDM, school portal, etc.). Editing this user master data is therefore only possible in the source system, not in the school cloud. Creating new students or teachers is also only possible in the source system.",
"wouldYouLikeReportABug": "Would you like to report an error or do you have an idea to improve the {{title}}? Send requests or problems directly to the {{shortTitle}} user support."
}
},
Expand Down Expand Up @@ -1248,8 +1249,7 @@
"toTask": "To the task"
},
"text": {
"announcement": "<b>Important announcement:</b> The neXboard tool will be replaced by <b>tldraw</b>. Please back up your content from the neXboards that you wish to continue using by <b>15.03.2024</b>. Until then, neXboards you have created can still be used. Here you can find <a target=\"_blank\" class=\"alert-link\" rel=\"noopener noreferrer\" href=\"https://blog.dbildungscloud.de/von-nexboard-zu-tldraw/\">backup options and further information</a>.",
"alternativeAnnouncement": "From now on, <b>tldraw</b> is available as a collaborative whiteboard in the column board. New neXboards can no longer be created. Already created neXboards are still available until <b>24.03.2024</b> to save the content. Instructions for transferring content from neXboard to tldraw can be found <a target=\"_blank\" class=\"alert-link\" rel=\"noopener noreferrer\" href=\"https://blog.dbildungscloud.de/von-nexboard-zu-tldraw/\">here</a>.",
"announcement": "From now on, <b>tldraw</b> is available as a collaborative whiteboard in the column board. New neXboards can no longer be created. Already created neXboards are still available until <b>23.04.2024</b> to save the content. Instructions for transferring content from neXboard to tldraw can be found <a target=\"_blank\" class=\"alert-link\" rel=\"noopener noreferrer\" href=\"https://blog.dbildungscloud.de/von-nexboard-zu-tldraw/\">here</a>.",
"emptyHomeworksInfo": "No assigned tasks. You can find all tasks in the tasks area.",
"emptyNewsInfo": "So far there is no news.",
"graded": "Graded",
Expand Down
4 changes: 2 additions & 2 deletions locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@
"theSynchronizationOfLDAPMasterData": "La sincronización de los datos maestros LDAP se interrumpe durante la fase de transferencia. Esto significa que los datos de usuario y las clases (si se utilizan) ya no se actualizan a través de LDAP. Todavía es posible iniciar sesión con datos de inicio de sesión que ya se hayan sincronizado. Durante el inicio de sesión también se tienen en cuenta los cambios de contraseña en LDAP.",
"useTheTransferPhaseAroundTheSchool": "Utiliza la fase de transferencia en torno al cambio de año escolar para ajustar la afiliación a la clase y los datos personales en el LDAP. Finalmente, transfiere todos los cambios a la {{title}} a la vez.",
"withAllChangesAndSettings": "Con todos los cambios y ajustes en el área de administración, se confirma que estos son llevados a cabo por un administrador de la escuela autorizado para hacer ajustes en la escuela en la nube. Los ajustes realizados por el administrador de la escuela se consideran instrucciones de la escuela al operador de la nube {{institute_title}}.",
"withAllChangesForTSC": "Algunos o todos los datos de los usuarios de su centro educativo se sincronizan desde una fuente externa (LDAP, IDM, portal del centro educativo, etc.). Por lo tanto, la edición de estos datos maestros de usuario sólo es posible en el sistema de origen, no en la nube de la escuela. La creación de nuevos alumnos o profesores sólo es posible en el sistema de origen.",
"wouldYouLikeReportABug": "¿Te gustaría informar de un error o tienes alguna idea para mejorar {{title}}? Envía solicitudes o problemas directamente al servicio de atención al usuario de {{shortTitle}}."
}
},
Expand Down Expand Up @@ -1248,8 +1249,7 @@
"toTask": "A la tarea"
},
"text": {
"announcement": "<b>Anuncio importante:</b> La herramienta neXboard será sustituida por <b>tldraw</b>. Por favor, haga una copia de seguridad del contenido de los neXboards que desee seguir utilizando antes del <b>15 de marzo de 2024</b>. Los neXboards que haya creado podrán seguir utilizándose hasta entonces. Aquí encontrará <a target=\"_blank\" class=\"alert-link\" rel=\"noopener noreferrer\" href=\"https://blog.dbildungscloud.de/von-nexboard-zu-tldraw/\">opciones de copia de seguridad y más informaciones</a>.",
"alternativeAnnouncement": "A partir de ahora, <b>tldraw</b> está disponible como pizarra colaborativa en el tablero de columnas. Ya no se pueden crear nuevas neXboards. Los neXboards ya creados siguen estando disponibles hasta el <b>24 de marzo de 2024</b> para guardar el contenido. Las instrucciones para transferir contenido de neXboard a tldraw se encuentran <a target=\"_blank\" class=\"alert-link\" rel=\"noopener noreferrer\" href=\"https://blog.dbildungscloud.de/von-nexboard-zu-tldraw/\">aqui</a>.",
"announcement": "A partir de ahora, <b>tldraw</b> está disponible como pizarra colaborativa en el tablero de columnas. Ya no se pueden crear nuevas neXboards. Los neXboards ya creados siguen estando disponibles hasta el <b>24 de abril de 2024</b> para guardar el contenido. Las instrucciones para transferir contenido de neXboard a tldraw se encuentran <a target=\"_blank\" class=\"alert-link\" rel=\"noopener noreferrer\" href=\"https://blog.dbildungscloud.de/von-nexboard-zu-tldraw/\">aqui</a>.",
"emptyHomeworksInfo": "No hay tareas asignadas. Puedes encontrarar todas las tareas en el área de tareas.",
"emptyNewsInfo": "Hasta el momento no hay noticias.",
"graded": "Calificado",
Expand Down
Loading

0 comments on commit 2d3c373

Please sign in to comment.