aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Eibrink-Lunzenauer <lunzenauer@elan-ev.de>2024-12-19 12:58:10 +0000
committerJan-Hendrik Willms <tleilax+studip@gmail.com>2024-12-19 12:58:10 +0000
commit9c9efe1fdd63c6ee6cb94fc5297cc0b50676658f (patch)
tree11ec72a7987a244b20939ce1401c45a7a87122f9
parent659202bf6f2a521631ead344da042b5d76765ecb (diff)
Use `modelValue` in StudipFileChooser when using vue3.
Closes #5053 Merge request studip/studip!3781
-rw-r--r--resources/vue/components/StudipFileChooser.vue26
1 files changed, 11 insertions, 15 deletions
diff --git a/resources/vue/components/StudipFileChooser.vue b/resources/vue/components/StudipFileChooser.vue
index d7ba0a0..37dc208 100644
--- a/resources/vue/components/StudipFileChooser.vue
+++ b/resources/vue/components/StudipFileChooser.vue
@@ -14,7 +14,7 @@ export default {
components: {
FileChooserDialog,
},
- emits: ['select'],
+ emits: ['update:modelValue'],
props: {
selectable: {
type: String,
@@ -23,7 +23,7 @@ export default {
return ['file', 'folder'].includes(value);
},
},
- selectedId: {
+ modelValue: {
type: String,
required: false,
},
@@ -48,10 +48,6 @@ export default {
excludedCourseFolderTypes: { type: Array, default: () => [] },
excludedUserFolderTypes: { type: Array, default: () => [] },
},
- model: {
- prop: 'selectedId',
- event: 'select',
- },
data() {
return {
showDialog: false,
@@ -73,22 +69,22 @@ export default {
},
selectedName() {
if (this.selectable === 'folder') {
- if (this.selectedId === '') {
+ if (this.modelValue === '') {
return this.$gettext('Kein Ordner ausgewählt');
}
return this.$gettext(
'Ordner "%{folderName}" ausgewählt'
,
- { folderName: this.folderById({ id: this.selectedId })?.attributes?.name ?? '-' }
+ { folderName: this.folderById({ id: this.modelValue })?.attributes?.name ?? '-' }
);
}
- if (this.selectedId === '') {
+ if (this.modelValue === '') {
return this.$gettext('Keine Datei ausgewählt');
}
return this.$gettext(
'Datei "%{fileName}" ausgewählt',
- { fileName: this.fileById({ id: this.selectedId })?.attributes?.name ?? '-' }
+ { fileName: this.fileById({ id: this.modelValue })?.attributes?.name ?? '-' }
);
},
},
@@ -105,16 +101,16 @@ export default {
},
select(id) {
this.closeDialog();
- this.$emit('select', id);
+ this.$emit('update:modelValue', id);
},
loadSelection() {
if (this.selectable === 'folder') {
- if (this.selectedId !== '') {
- this.loadFolder({ id: this.selectedId });
+ if (this.modelValue !== '') {
+ this.loadFolder({ id: this.modelValue });
}
} else {
- if (this.selectedId !== '') {
- this.loadFile({ id: this.selectedId });
+ if (this.modelValue !== '') {
+ this.loadFile({ id: this.modelValue });
}
}
}