Skip to content

Commit

Permalink
requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorCapCoder committed Dec 2, 2024
1 parent c8feea0 commit 65947e0
Show file tree
Hide file tree
Showing 9 changed files with 182 additions and 101 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
}
},
"engines": {
"node": "22",
"node": "20",
"npm": ">=9"
}
}
19 changes: 12 additions & 7 deletions src/components/share/ImportModal.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,11 @@ describe("@components/share/ImportModal", () => {
`[data-testid="import-modal-external-tools-info"]`
);

expect(infoText.attributes("html")).toEqual(
"components.molecules.import.options.ctlTools.infoText"
expect(infoText.text()).toEqual(
"components.molecules.shareImport.options.ctlTools.infoText.line1"
);
});
it("should not show course file info", () => {
it("should also show course file info", () => {
const { wrapper } = setup({ getCtlToolsTabEnabled: true });

const dialog = wrapper.findComponent({ name: "v-custom-dialog" });
Expand All @@ -136,7 +136,7 @@ describe("@components/share/ImportModal", () => {
`[data-testid="import-modal-coursefiles-info"]`
);

expect(infoText.exists()).toBe(false);
expect(infoText.exists()).toBe(true);
});
});
describe("show ctl tool info is disabled", () => {
Expand Down Expand Up @@ -168,10 +168,15 @@ describe("@components/share/ImportModal", () => {
it("should set the right key for course files", () => {
const { wrapper } = setup({ getCtlToolsTabEnabled: false });

const renderHtml = wrapper.findComponent({ name: "RenderHTML" });
const dialog = wrapper.findComponent({ name: "v-custom-dialog" });
const cardText = dialog.findComponent({ name: "v-card-text" });

const infoText = cardText.find(
`[data-testid="import-modal-coursefiles-info"]`
);

expect(renderHtml.props("html")).toEqual(
"components.molecules.import.courses.options.infoText"
expect(infoText.element.innerHTML).toEqual(
"components.molecules.shareImport.options.restrictions.infoText.line1"
);
});
});
Expand Down
86 changes: 68 additions & 18 deletions src/components/share/ImportModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,69 @@
<div class="mx-2">
<v-icon color="info" :icon="mdiInformation" />
</div>
<RenderHTML
data-testid="import-modal-external-tools-info"
v-if="
ctlToolsEnabled &&
(parentType === 'courses' || parentType === 'columnBoard')
"
:html="t(`components.molecules.import.options.ctlTools.infoText`)"
/>
<RenderHTML
v-else
data-testid="import-modal-coursefiles-info"
:html="
t(`components.molecules.import.${parentType}.options.infoText`)
"
/>
<div>
<div data-testid="import-options-table-header">
{{
t(
"components.molecules.shareImport.options.tableHeader.InfoText"
)
}}
<ul class="ml-6">
<li data-testid="import-options-personal-data-text">
{{
t(
"components.molecules.shareImport.options.personalData.infoText"
)
}}
</li>
<li
v-if="showCtlToolsInfo"
data-testid="import-modal-external-tools-info"
>
{{
t(
"components.molecules.shareImport.options.ctlTools.infoText.line1"
)
}}
</li>
<li v-if="showCtlToolsInfo">
{{
t(
"components.molecules.shareImport.options.ctlTools.infoText.line2"
)
}}
</li>
<li data-testid="import-modal-coursefiles-info">
{{
t(
"components.molecules.shareImport.options.restrictions.infoText.line1"
)
}}
</li>
<li>
{{
t(
"components.molecules.shareImport.options.restrictions.infoText.line2"
)
}}
</li>
<li>
{{
t(
"components.molecules.shareImport.options.restrictions.infoText.line3"
)
}}
</li>
<li>
{{
t(
"components.molecules.shareImport.options.restrictions.infoText.line4"
)
}}
</li>
</ul>
</div>
</div>
</div>
<div class="mb-4">
{{ t(`components.molecules.import.${parentType}.rename`) }}
Expand All @@ -59,7 +107,6 @@ import { ENV_CONFIG_MODULE_KEY, injectStrict } from "@/utils/inject";
import { mdiInformation } from "@icons/material";
import { computed, reactive, ref } from "vue";
import { useI18n } from "vue-i18n";
import { RenderHTML } from "@feature-render-html";
const emit = defineEmits(["import", "cancel"]);
const props = defineProps({
Expand Down Expand Up @@ -88,7 +135,10 @@ const onConfirm = () => {
};
const onCancel = () => emit("cancel");
const ctlToolsEnabled = computed(() => {
return envConfigModule.getCtlToolsTabEnabled;
const showCtlToolsInfo = computed(() => {
return (
envConfigModule.getCtlToolsTabEnabled &&
(props.parentType === "courses" || props.parentType === "columnBoard")
);
});
</script>
6 changes: 2 additions & 4 deletions src/components/share/ShareModal.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,9 @@ describe("@/components/share/ShareModal", () => {
`[data-testid="share-modal-external-tools-info"]`
);

const renderHtmls = wrapper.findAllComponents({ name: "RenderHTML" });

expect(infotext.isVisible()).toBe(true);
expect(renderHtmls[0].props("html")).toEqual(
"components.molecules.share.courses.options.ctlTools.infoText"
expect(infotext.text()).toEqual(
"components.molecules.shareImport.options.ctlTools.infoText.line1"
);
});
});
Expand Down
65 changes: 42 additions & 23 deletions src/components/share/ShareModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
<div v-if="step === 'firstStep' && isOpen">
<div data-testid="share-options-info-text">
{{ t(`components.molecules.share.${type}.options.infoText`) }}
<p />
</div>
<div class="d-flex flex-row pa-2 mb-4 rounded bg-blue-lighten-5">
<div class="mx-2">
Expand All @@ -30,41 +29,62 @@
<div data-testid="share-options-table-header">
{{
t(
"components.molecules.share.courses.options.tableHeader.InfoText"
"components.molecules.shareImport.options.tableHeader.InfoText"
)
}}
<ul class="ml-6">
<li data-testid="share-options-personal-data-text">
{{
t(
"components.molecules.shareImport.options.personalData.infoText"
)
}}
</li>
<li
style="margin: 1px"
data-testid="share-options-personal-data-text"
v-if="showCtlToolsInfo"
data-testid="share-modal-external-tools-info"
>
{{
t(
"components.molecules.share.options.personalData.infoText"
"components.molecules.shareImport.options.ctlTools.infoText.line1"
)
}}
</li>
<RenderHTML
v-if="showCtlToolsInfo"
:html="
<li v-if="showCtlToolsInfo">
{{
t(
'components.molecules.share.courses.options.ctlTools.infoText',
{}
"components.molecules.shareImport.options.ctlTools.infoText.line2"
)
"
component="p"
style="margin-bottom: 0px"
data-testid="share-modal-external-tools-info"
/>
<RenderHTML
:html="
}}
</li>
<li>
{{
t(
"components.molecules.shareImport.options.restrictions.infoText.line1"
)
}}
</li>
<li>
{{
t(
"components.molecules.shareImport.options.restrictions.infoText.line2"
)
}}
</li>
<li>
{{
t(
'components.molecules.share.courses.options.restrictions.infoText',
{}
"components.molecules.shareImport.options.restrictions.infoText.line3"
)
"
component="p"
/>
}}
</li>
<li>
{{
t(
"components.molecules.shareImport.options.restrictions.infoText.line4"
)
}}
</li>
</ul>
</div>
</div>
Expand Down Expand Up @@ -92,7 +112,6 @@
import VCustomDialog from "@/components/organisms/vCustomDialog.vue";
import ShareModalOptionsForm from "@/components/share/ShareModalOptionsForm.vue";
import ShareModalResult from "@/components/share/ShareModalResult.vue";
import RenderHTML from "@/modules/feature/render-html/RenderHTML.vue";
import { ShareTokenBodyParamsParentTypeEnum } from "@/serverApi/v3/api";
import {
ENV_CONFIG_MODULE_KEY,
Expand Down
28 changes: 14 additions & 14 deletions src/locales/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -593,16 +593,10 @@ export default {
"components.molecules.import.courses.label": "Kurs",
"components.molecules.import.courses.rename":
"Bei Bedarf kann der Name des Kurses umbenannt werden: ",
"components.molecules.import.options.ctlTools.infoText":
"Folgende Inhalte werden nicht kopiert:<br><ul class='ml-6'><li>Personenbezogene Daten</li><li>In Zielschule nicht verfügbare, externe Tools</li><li>Geschützte Einstellungen externer Tools</li><li>Dateien unter Kurs-Dateien</li><li>Inhalte aus Etherpads</li><li>Geogebra IDs und</li><li>Kursgruppen</li></ul>",
"components.molecules.import.courses.options.infoText":
"Folgende Inhalte werden nicht kopiert:<br><ul class='ml-6'><li>Personenbezogene Daten</li><li>Dateien unter Kurs-Dateien</li><li>Inhalte aus Etherpads</li><li>Geogebra IDs und</li><li>Kursgruppen</li></ul>",
"components.molecules.import.courses.options.title": "Kurs importieren",
"components.molecules.import.lessons.label": "Thema",
"components.molecules.import.lessons.rename":
"Bei Bedarf kann der Name des Themas umbenannt werden: ",
"components.molecules.import.lessons.options.infoText":
"Folgende Inhalte werden nicht kopiert:<br><ul class='ml-6'><li>Personenbezogene Daten</li><li>Dateien unter Kurs-Dateien</li><li>Inhalte aus Etherpads</li><li>Geogebra IDs und</li><li>Kursgruppen</li></ul>",
"components.molecules.import.lessons.options.selectCourse.infoText":
"Der Kurs, in den das Thema importiert werden soll, muss im Folgenden ausgewählt werden.",
"components.molecules.import.lessons.options.selectCourse": "Kurs wählen",
Expand All @@ -619,8 +613,6 @@ export default {
"components.molecules.import.tasks.label": "Aufgabe",
"components.molecules.import.tasks.rename":
"Bei Bedarf kann der Name der Aufgabe umbenannt werden: ",
"components.molecules.import.tasks.options.infoText":
"Folgende Inhalte werden nicht kopiert:<br><ul class='ml-6'><li>Personenbezogene Daten</li><li>Dateien unter Kurs-Dateien</li><li>Inhalte aus Etherpads</li><li>Geogebra IDs und</li><li>Kursgruppen</li></ul>",
"components.molecules.import.tasks.options.selectCourse.infoText":
"Der Kurs, in den die Aufgabe importiert werden soll, muss im Folgenden ausgewählt werden.",
"components.molecules.export.options.info":
Expand Down Expand Up @@ -664,15 +656,23 @@ export default {
"Link Bereich-Kopie",
"components.molecules.share.courses.mail.body": "Link zum Kurs:",
"components.molecules.share.courses.mail.subject": "Kurs zum Importieren",
"components.molecules.share.courses.options.ctlTools.infoText":
"<li>In Zielschule nicht verfügbare, externe Tools</li><li>Geschützte Einstellungen externer Tools</li>",
"components.molecules.shareImport.options.ctlTools.infoText.line1":
"In Zielschule nicht verfügbare, externe Tools",
"components.molecules.shareImport.options.ctlTools.infoText.line2":
"Geschützte Einstellungen externer Tools",
"components.molecules.share.courses.options.infoText":
"Mit dem folgenden Link kann der Kurs als Kopie von anderen Lehrkräften importiert werden.",
"components.molecules.share.options.personalData.infoText":
"components.molecules.shareImport.options.personalData.infoText":
"Personenbezogene Daten",
"components.molecules.share.courses.options.restrictions.infoText":
"<li>Dateien unter Kurs-Dateien</li><li>Inhalte aus Etherpads</li><li>Geogebra IDs und</li><li>Kursgruppen</li>",
"components.molecules.share.courses.options.tableHeader.InfoText":
"components.molecules.shareImport.options.restrictions.infoText.line1":
"Dateien unter Kurs-Dateien",
"components.molecules.shareImport.options.restrictions.infoText.line2":
"Inhalte aus Etherpads",
"components.molecules.shareImport.options.restrictions.infoText.line3":
"Geogebra IDs und",
"components.molecules.shareImport.options.restrictions.infoText.line4":
"Kursgruppen",
"components.molecules.shareImport.options.tableHeader.InfoText":
"Folgende Inhalte werden nicht kopiert:",
"components.molecules.share.courses.result.linkLabel": "Link Kurskopie",
"components.molecules.share.lessons.mail.body": "Link zum Thema:",
Expand Down
21 changes: 15 additions & 6 deletions src/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -647,14 +647,23 @@ export default {
"components.molecules.MintEcFooter.chapters": "Chapter overview",
"components.molecules.share.courses.mail.body": "Link to the course:",
"components.molecules.share.courses.mail.subject": "Course you can import",
"components.molecules.share.courses.options.ctlTools.infoText":
"<li>External tools not available in the target school </li><li>Protected settings of external tools</li>",
"components.molecules.shareImport.options.ctlTools.infoText.line1":
"External tools not available in the target school",
"components.molecules.shareImport.options.ctlTools.infoText.line2":
"Protected settings of external tools",
"components.molecules.share.courses.options.infoText":
"With the following link, the course can be imported as a copy by other teachers.",
"components.molecules.share.options.personalData.infoText": "Personal data",
"components.molecules.share.courses.options.restrictions.infoText":
"<li>Files under Course Files </li><li>Content from Etherpads </li><li>Geogebra IDs and </li><li>Course groups </li>",
"components.molecules.share.courses.options.tableHeader.InfoText":
"components.molecules.shareImport.options.personalData.infoText":
"Personal data",
"components.molecules.shareImport.options.restrictions.infoText.line1":
"Files under Course Files",
"components.molecules.shareImport.options.restrictions.infoText.line2":
"Content from Etherpads",
"components.molecules.shareImport.options.restrictions.infoText.line3":
"Geogebra IDs and",
"components.molecules.shareImport.options.restrictions.infoText.line4":
"Course groups",
"components.molecules.shareImport.options.tableHeader.InfoText":
"The following content will not be copied:",
"components.molecules.share.courses.result.linkLabel": "Link course copy",
"components.molecules.share.lessons.mail.body": "Link to the topic:",
Expand Down
Loading

0 comments on commit 65947e0

Please sign in to comment.