Skip to content

Commit

Permalink
Merge branch 'main' into BC-7995-node-22
Browse files Browse the repository at this point in the history
  • Loading branch information
SevenWaysDP authored Nov 12, 2024
2 parents ae8c68b + e85ec46 commit 0f9cf99
Show file tree
Hide file tree
Showing 29 changed files with 550 additions and 136 deletions.
2 changes: 2 additions & 0 deletions src/components/icons/material/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ import {
mdiTune,
mdiUndo,
mdiUndoVariant,
mdiViewAgendaOutline,
mdiViewDashboard,
mdiViewDashboardOutline,
mdiViewGridOutline,
Expand Down Expand Up @@ -280,6 +281,7 @@ export {
mdiTune,
mdiUndo,
mdiUndoVariant,
mdiViewAgendaOutline,
mdiViewDashboard,
mdiViewDashboardOutline,
mdiViewGridOutline,
Expand Down
4 changes: 2 additions & 2 deletions src/components/molecules/TaskItemMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@
>
<v-list-item-title>
<v-icon :icon="mdiTrashCanOutline" class="task-action-icon" />
{{ $t("common.actions.remove") }}
{{ $t("common.actions.delete") }}
</v-list-item-title>
</v-list-item>
</KebabMenu>
<v-custom-dialog
v-model:isOpen="confirmDeleteDialogIsOpen"
:size="375"
has-buttons
confirm-btn-title-key="common.actions.remove"
confirm-btn-title-key="common.actions.delete"
@dialog-confirmed="handleDelete"
>
<template #title>
Expand Down
23 changes: 8 additions & 15 deletions src/components/organisms/vCustomDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
<v-card-text class="text--primary">
<slot name="content" />
</v-card-text>
<v-card-actions v-if="hasButtons" class="pe-6">
<v-spacer />
<v-card-actions v-if="hasButtons" class="action-buttons px-6">
<div class="button-section button-left">
<v-btn
v-if="checkButtons('back')"
Expand All @@ -33,6 +32,7 @@
{{ $t("common.actions.edit") }}
</v-btn>
</div>
<v-spacer />
<div class="button-section button-right">
<v-btn
v-if="checkButtons('cancel')"
Expand Down Expand Up @@ -151,22 +151,15 @@ const checkButtons = (buttonName: string) => {
</script>

<style lang="scss" scoped>
.button-left {
width: 25%;
text-align: left;
}
.button-right {
display: inline-block;
width: 75%;
text-align: right;
}
.button-section {
.action-buttons {
display: flex;
flex-direction: row;
margin-bottom: calc(var(--space-base-vuetify) * 2);
}
.button-section > button {
margin-left: calc(var(--space-base-vuetify) * 2);
.button-section {
display: flex;
gap: calc(var(--space-base-vuetify) * 2);
}
.dialog-title {
Expand Down
5 changes: 3 additions & 2 deletions src/locales/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default {
"common.actions.logout": "Abmelden",
"common.actions.ok": "OK",
"common.actions.pickColor": "Hintergrundfarbe auswählen",
"common.actions.remove": "Löschen",
"common.actions.remove": "Entfernen",
"common.actions.rename": "Umbenennen",
"common.actions.save": "Speichern",
"common.actions.scrollToTop": "Nach oben scrollen",
Expand Down Expand Up @@ -1670,6 +1670,7 @@ export default {
"pages.roomDetails.ariaLabels.menu": "Raum-Menü",
"pages.roomDetails.ariaLabels.menu.action.edit": "Raum bearbeiten",
"pages.roomDetails.ariaLabels.menu.action.delete": "Raum löschen",
"pages.roomDetails.board.defaultName": "Raum-Bereich",
"pages.rooms.emptyState": "Aktuell gibt es hier noch keine Räume.",
"pages.rooms.fab.title": "Raum erstellen",
"pages.rooms.participant.error.load":
Expand All @@ -1681,7 +1682,7 @@ export default {
"pages.rooms.participant.delete.confirmation":
"{memberName} wirklich aus dem Raum entfernen?",
"pages.rooms.participant.infoText":
'Füge Teilnehmende zum Raum hinzu. Lehrkräfte anderer Schulen können hinzugefügt werden, wenn sie die Sichtbarkeit im zentralen Verzeichnis im eigenen Profil aktiviert haben <a href="https://docs.dbildungscloud.de/display/SCDOK/Teameinladung+freigeben">(weitere Informationen)</a>.',
'Füge Teilnehmende zum Raum hinzu. Lehrkräfte anderer Schulen können hinzugefügt werden, wenn sie in ihrem Profil die Sichtbarkeit im zentralen Verzeichnis aktiviert haben (<a href="https://docs.dbildungscloud.de/display/SCDOK/Teameinladung+freigeben">weitere Informationen</a>).',
"pages.rooms.participant.label": "Teilnehmer:in",
"pages.rooms.participants.label": "Teilnehmende",
"pages.rooms.participants.addParticipants": "Teilnehmende hinzufügen",
Expand Down
5 changes: 3 additions & 2 deletions src/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1642,16 +1642,17 @@ export default {
"pages.roomDetails.ariaLabels.menu": "Room menu",
"pages.roomDetails.ariaLabels.menu.action.edit": "Edit room",
"pages.roomDetails.ariaLabels.menu.action.delete": "Delete room",
"pages.roomDetails.board.defaultName": "Room Board",
"pages.rooms.emptyState": "Currently there are no rooms here.",
"pages.rooms.fab.title": "Create room",
"pages.rooms.participant.error.load":
"The participant list could not be loaded.",
"pages.rooms.participant.error.add": "Adding participants failed.",
"pages.rooms.participant.error.delete": "Deleting participants failed.",
"pages.rooms.participant.delete.confirmation":
"Really remove {memberName} from the room?",
"Remove {memberName} from the room?",
"pages.rooms.participant.infoText":
'Add participants to the room. Teachers from other schools can be added if they have activated visibility in the central directory in their own profile <a href="https://docs.dbildungscloud.de/display/SCDOK/Teameinladung+freigeben">(more information)</a>.',
'Add participants to the room. Teachers from other schools can be added if they have activated visibility in the central directory in their profile (<a href="https://docs.dbildungscloud.de/display/SCDOK/Teameinladung+freigeben">more information</a>).',
"pages.rooms.participant.label": "Participant",
"pages.rooms.participants.label": "Participants",
"pages.rooms.participants.addParticipants": "Add participants",
Expand Down
23 changes: 12 additions & 11 deletions src/locales/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1680,22 +1680,23 @@ export default {
"Common Cartridge versión 1.1 (p. ej. compatible con Moodle)",
"pages.room.modal.course.export.version1.3": "Common Cartridge versión 1.3",
// new rooms
"pages.roomCreate.title": "Crear habitación",
"pages.roomEdit.title": "Editar habitación",
"pages.roomDetails.title": "Habitación",
"pages.roomDetails.ariaLabels.menu": "Menú de la habitación",
"pages.roomDetails.ariaLabels.menu.action.edit": "Editar habitación",
"pages.roomDetails.ariaLabels.menu.action.delete": "Borrar habitación",
"pages.rooms.emptyState": "Actualmente no hay habitaciones aquí.",
"pages.rooms.fab.title": "Crear habitación",
"pages.roomCreate.title": "Crear sala",
"pages.roomEdit.title": "Editar sala",
"pages.roomDetails.title": "Sala",
"pages.roomDetails.ariaLabels.menu": "Menú de la sala",
"pages.roomDetails.ariaLabels.menu.action.edit": "Editar sala",
"pages.roomDetails.ariaLabels.menu.action.delete": "Borrar sala",
"pages.roomDetails.board.defaultName": "Tablero de la sala",
"pages.rooms.emptyState": "Actualmente no hay salas aquí.",
"pages.rooms.fab.title": "Crear sala",
"pages.rooms.participant.error.load":
"No se pudo cargar la lista de participantes.",
"pages.rooms.participant.error.add": "Error al agregar participantes.",
"pages.rooms.participant.error.delete": "Error al eliminar participantes.",
"pages.rooms.participant.delete.confirmation":
"¿De verdad quieres borrar a {memberName} de la sala?",
"¿Eliminar {memberName} de la sala?",
"pages.rooms.participant.infoText":
'Añade participantes a la sala. Se pueden añadir profesores de otros centros educativos si tienen activada la visibilidad en el directorio central en su propio perfil <a href="https://docs.dbildungscloud.de/display/SCDOK/Teameinladung+freigeben">(más información)</a>.',
'Añadir participantes a la sala. Se pueden añadir profesores de otros centros si tienen activada la visibilidad en el directorio central en su perfil (<a href="https://docs.dbildungscloud.de/display/SCDOK/Teameinladung+freigeben">más información</a>).',
"pages.rooms.participant.label": "Partícipe",
"pages.rooms.participants.label": "Participantes",
"pages.rooms.participants.addParticipants": "Añadir participantes",
Expand All @@ -1705,7 +1706,7 @@ export default {
"Entradas por página",
"pages.rooms.participants.roles.editor": "Editor de salas",
"pages.rooms.participants.roles.viewer": "Visor de salas",
"pages.rooms.title": "Habitaciones",
"pages.rooms.title": "Salas",
"pages.taskCard.addElement": "Añadir artículo",
"pages.taskCard.deleteElement.text":
"¿Estás seguro de que deseas eliminar este elemento?",
Expand Down
5 changes: 3 additions & 2 deletions src/locales/uk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1664,16 +1664,17 @@ export default {
"pages.roomDetails.ariaLabels.menu": "Меню кімнати",
"pages.roomDetails.ariaLabels.menu.action.edit": "Кімната редагування",
"pages.roomDetails.ariaLabels.menu.action.delete": "Видалити кімнату",
"pages.roomDetails.board.defaultName": "Космічна дошка",
"pages.rooms.emptyState": "Зараз тут немає кімнат",
"pages.rooms.fab.title": "Створити кімнату",
"pages.rooms.participant.error.load":
"Не вдалося завантажити список учасників.",
"pages.rooms.participant.error.add": "Не вдалося додати учасників.",
"pages.rooms.participant.error.delete": "Не вдалося видалити учасників.",
"pages.rooms.participant.delete.confirmation":
"Справді видалити {memberName} з кімнати?",
"{memberName} буде видалено з цієї кімнати. Ви впевнені, що хочете видалити?",
"pages.rooms.participant.infoText":
'Додайте учасників до кімнати. Вчителів з інших шкіл можна додавати, якщо вони активували видимість у центральному каталозі у власному профілі <a href="https://docs.dbildungscloud.de/display/SCDOK/Teameinladung+freigeben">(більше інформації)</a>.',
'Додайте учасників до кімнати. Вчителі з інших шкіл можуть бути додані, якщо вони активували видимість у центральному каталозі у своєму профілі (<a href="https://docs.dbildungscloud.de/display/SCDOK/Teameinladung+freigeben">більше інформації</a>).',
"pages.rooms.participant.label": "Учасник",
"pages.rooms.participants.label": "Учасники",
"pages.rooms.participants.addParticipants": "Додайте учасників",
Expand Down
29 changes: 22 additions & 7 deletions src/modules/data/board/BoardApi.composable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
FileElementContentBody,
LinkElementContentBody,
RichTextElementContentBody,
RoomApiFactory,
SubmissionContainerElementContentBody,
} from "@/serverApi/v3";
import { BoardContextType } from "@/types/board/BoardContext";
Expand All @@ -29,7 +30,8 @@ export const useBoardApi = () => {
const cardsApi = BoardCardApiFactory(undefined, "/v3", $axios);
const elementApi = BoardElementApiFactory(undefined, "/v3", $axios);

const roomApi = CourseRoomsApiFactory(undefined, "/v3", $axios);
const roomApi = RoomApiFactory(undefined, "/v3", $axios);
const courseRoomApi = CourseRoomsApiFactory(undefined, "/v3", $axios);

const fetchBoardCall = async (id: string): Promise<BoardResponse> => {
try {
Expand Down Expand Up @@ -186,6 +188,19 @@ export const useBoardApi = () => {
});
};

const fetchRoomName = async (
type: BoardContextType,
id: string
): Promise<string | undefined> => {
const name =
type === BoardContextType.Room
? (await roomApi.roomControllerGetRoomDetails(id)).data.name
: (await courseRoomApi.courseRoomsControllerGetRoomBoard(id)).data
.title;

return name;
};

type ContextInfo = { id: string; type: BoardContextType; name: string };

const getContextInfo = async (
Expand All @@ -197,17 +212,17 @@ export const useBoardApi = () => {
return undefined;
}
const context = contextResponse.data;
const roomResponse = await roomApi.courseRoomsControllerGetRoomBoard(
context.id
);

if (roomResponse.status !== 200) {
const roomName = await fetchRoomName(context.type, context.id);

if (roomName === undefined) {
return undefined;
}

return {
id: roomResponse.data.roomId,
id: context.id,
type: context.type,
name: roomResponse.data.title,
name: roomName,
};
};

Expand Down
10 changes: 6 additions & 4 deletions src/modules/data/board/BoardApi.composable.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -480,10 +480,11 @@ describe("BoardApi.composable", () => {
const { getContextInfo } = useBoardApi();

const FAKE_BOARD_ID = "MY_BOARD_ID123";
const FAKE_RESPONSE = {
const FAKE_CONTEXT_RESPONSE = {
status: 200,
data: {
id: "someid",
type: "course",
},
};

Expand All @@ -497,7 +498,7 @@ describe("BoardApi.composable", () => {

boardApi.boardControllerGetBoardContext = jest
.fn()
.mockResolvedValueOnce(FAKE_RESPONSE);
.mockResolvedValueOnce(FAKE_CONTEXT_RESPONSE);
roomsApi.courseRoomsControllerGetRoomBoard = jest
.fn()
.mockResolvedValueOnce(FAKE_ROOM_RESPONSE);
Expand All @@ -509,12 +510,13 @@ describe("BoardApi.composable", () => {
);

expect(roomsApi.courseRoomsControllerGetRoomBoard).toHaveBeenCalledWith(
FAKE_RESPONSE.data.id
FAKE_CONTEXT_RESPONSE.data.id
);

expect(result).toEqual(
expect.objectContaining({
id: FAKE_ROOM_RESPONSE.data.roomId,
id: FAKE_CONTEXT_RESPONSE.data.id,
type: FAKE_CONTEXT_RESPONSE.data.type,
name: FAKE_ROOM_RESPONSE.data.title,
})
);
Expand Down
81 changes: 50 additions & 31 deletions src/modules/data/board/BoardPageInformation.composable.ts
Original file line number Diff line number Diff line change
@@ -1,53 +1,72 @@
import { Breadcrumb } from "@/components/templates/default-wireframe.types";
import { BoardContextType } from "@/types/board/BoardContext";
import { buildPageTitle } from "@/utils/pageTitle";
import { createSharedComposable } from "@vueuse/core";
import { ref, Ref } from "vue";
import { computed, ref, unref } from "vue";
import { useI18n } from "vue-i18n";
import { useBoardApi } from "./BoardApi.composable";
import { BoardContextType } from "@/types/board/BoardContext";

const useBoardPageInformation = () => {
const { t } = useI18n();

const { getContextInfo } = useBoardApi();

const getPageTitle = (courseName?: string): string => {
const boardContext = ref<Awaited<ReturnType<typeof getContextInfo>>>();

const pageTitle = computed(() => {
const courseName = boardContext.value?.name;
const courseNameForPageTitle = courseName ? ", " + courseName : "";

return buildPageTitle(
`${t("pages.room.boardCard.label.courseBoard")}${courseNameForPageTitle}`
);
};
});

const roomId = computed(() => boardContext.value?.id);
const contextType = computed(() => boardContext.value?.type);

const breadcrumbs = computed((): Breadcrumb[] => {
const id = unref(boardContext)?.id;
const type = unref(boardContext)?.type;
const name = unref(boardContext)?.name;

const pageTitle: Ref<string> = ref(getPageTitle());
const roomId: Ref<string | undefined> = ref(undefined);
const breadcrumbs: Ref<Breadcrumb[]> = ref([]);
const contextType: Ref<BoardContextType | undefined> = ref();
if (!id || !type) {
return [];
}

function getBreadcrumbs(
contextInfo: { id: string; name: string } | undefined
): Breadcrumb[] {
return contextInfo
? [
{
title: t("common.words.courses"),
to: "/rooms/courses-overview",
disabled: false,
},
{
title: contextInfo.name ?? t("common.labels.course"),
to: `/rooms/${contextInfo.id}`,
disabled: false,
},
]
: [];
}
if (type === BoardContextType.Course) {
return [
{
title: t("common.words.courses"),
to: "/rooms/courses-overview",
disabled: false,
},
{
title: name ?? t("common.labels.course"),
to: `/rooms/${id}`,
disabled: false,
},
];
}
if (type === BoardContextType.Room) {
return [
{
title: t("pages.rooms.title"),
to: "/rooms",
disabled: false,
},
{
title: name ?? t("common.labels.room"),
to: `/rooms/${id}`,
disabled: false,
},
];
}
return [];
});

const createPageInformation = async (id: string): Promise<void> => {
const contextInfo = await getContextInfo(id);
pageTitle.value = getPageTitle(contextInfo?.name);
breadcrumbs.value = getBreadcrumbs(contextInfo);
contextType.value = contextInfo?.type;
roomId.value = contextInfo?.id;
boardContext.value = await getContextInfo(id);
};

return {
Expand Down
Loading

0 comments on commit 0f9cf99

Please sign in to comment.