diff --git a/contentcuration/contentcuration/frontend/channelEdit/components/edit/EditModal.vue b/contentcuration/contentcuration/frontend/channelEdit/components/edit/EditModal.vue index fca0812d32..24e0c234e9 100644 --- a/contentcuration/contentcuration/frontend/channelEdit/components/edit/EditModal.vue +++ b/contentcuration/contentcuration/frontend/channelEdit/components/edit/EditModal.vue @@ -675,4 +675,8 @@ margin-top: -4px !important; } + ::v-deep .v-dialog__content { + z-index: 5 !important; + } + diff --git a/contentcuration/contentcuration/frontend/channelEdit/views/files/FileUpload.vue b/contentcuration/contentcuration/frontend/channelEdit/views/files/FileUpload.vue index b624eca24a..5631b97077 100644 --- a/contentcuration/contentcuration/frontend/channelEdit/views/files/FileUpload.vue +++ b/contentcuration/contentcuration/frontend/channelEdit/views/files/FileUpload.vue @@ -2,7 +2,7 @@
@@ -14,10 +14,32 @@ - +

+
+ +

+ {{ $tr('filesHeader') }} +

+ + + +
+ +

+ {{ selectedFilename }} +

@@ -39,32 +61,19 @@ />
- - - - - - - - - - -
+ + +

{{ $tr("removeFileDescription", { fileTypes: allowedFileTypes }) }}

+
@@ -94,6 +103,7 @@ data() { return { selected: null, + showRemoveFileWarning: false, }; }, computed: { @@ -118,22 +128,32 @@ return this.fileCount > 1; }, primaryFileCount() { - return this.files.filter(file => !file.preset.supplementary).length; + return this.primaryFileMapping.length; }, primaryFileMapping() { return sortBy( this.presets - .filter(p => !p.supplementary) .map(preset => { - return { - preset, - order: preset.order, - file: this.files.find(file => file.preset.id === preset.id), - }; - }), + const file = this.files.find(file => file.preset.id === preset.id); + if (!preset.supplementary && file) { + return { preset, order: preset.order, file }; + } + return null; + }) + .filter(item => item !== null), 'order' ); }, + selectedFilename() { + const file = this.files.find(f => f.id === this.selected); + return file ? file.original_filename : ''; + }, + allowedFileTypes() { + return this.presets + .filter(p => !p.supplementary && Array.isArray(p.allowed_formats)) + .map(p => p.allowed_formats.join(', ')) + .join(', '); + }, }, watch: { 'files.length'(newCount, oldCount) { @@ -163,17 +183,25 @@ eventLabel: 'Related file', }); }, - handleRemoveFile(file) { - this.deleteFile(file); - if (file.id === this.selected) { - this.selectFirstFile(); + handleRemoveFile() { + const selectedFile = this.files.find(f => f.id === this.selected); + if (selectedFile) { + this.deleteFile(selectedFile).then(() => { + this.selectFirstFile(); + }); } + this.showRemoveFileWarning = false; }, }, $trs: { - filesHeader: 'Preview files', + filesHeader: 'Files', fileError: 'Unsupported file type', noFileText: 'Missing files', + removeFile: 'Remove file', + removeFileDescription: + 'Once this file is removed, this resource will only be able to include a single file from the formats: { fileTypes }. Are you sure you want to continue?', + yesButton: 'Yes', + cancelButton: 'Cancel', }, }; diff --git a/contentcuration/contentcuration/frontend/channelEdit/views/files/FileUploadItem.vue b/contentcuration/contentcuration/frontend/channelEdit/views/files/FileUploadItem.vue index 7a77710e54..917e70fc0e 100644 --- a/contentcuration/contentcuration/frontend/channelEdit/views/files/FileUploadItem.vue +++ b/contentcuration/contentcuration/frontend/channelEdit/views/files/FileUploadItem.vue @@ -11,27 +11,19 @@ - - - {{ translateConstant(preset.id) }} - - + + data-test="file-name" + > + {{ formattedFileDisplay }} + -
- -
+ + +
@@ -72,10 +69,9 @@