diff --git a/LearningHub.Nhs.WebUI/Scripts/vuesrc/contribute-resource/ContributeBlock.vue b/LearningHub.Nhs.WebUI/Scripts/vuesrc/contribute-resource/ContributeBlock.vue index 8ca009633..4c6aa1ec4 100644 --- a/LearningHub.Nhs.WebUI/Scripts/vuesrc/contribute-resource/ContributeBlock.vue +++ b/LearningHub.Nhs.WebUI/Scripts/vuesrc/contribute-resource/ContributeBlock.vue @@ -30,7 +30,9 @@ :characterLimit="60" :isH3="true">

{{ block.title }}

+ v-else> + {{ block.title }} + @@ -50,7 +52,8 @@ ariaLabel="Move section down" class="contribute-block-component-button"> - + { + this.contributeResourceAVFlag = response; + }); } } }); diff --git a/LearningHub.Nhs.WebUI/Scripts/vuesrc/contribute-resource/ContributeCaseOrAssessmentContent.vue b/LearningHub.Nhs.WebUI/Scripts/vuesrc/contribute-resource/ContributeCaseOrAssessmentContent.vue index 4cf178069..ed08da72b 100644 --- a/LearningHub.Nhs.WebUI/Scripts/vuesrc/contribute-resource/ContributeCaseOrAssessmentContent.vue +++ b/LearningHub.Nhs.WebUI/Scripts/vuesrc/contribute-resource/ContributeCaseOrAssessmentContent.vue @@ -2,17 +2,17 @@
You have not added any content to this page yet + v-if="!hasContentOnPage"> + You have not added any content to this page yet
@@ -25,13 +25,19 @@ ref="addMediaInput" multiple @change="uploadNewMediaFiles" - class="visually-hidden"/> + class="visually-hidden" /> + + +
+ +
diff --git a/LearningHub.Nhs.WebUI/Scripts/vuesrc/contribute-resource/components/content-tab/ChooseContentBlockOption.vue b/LearningHub.Nhs.WebUI/Scripts/vuesrc/contribute-resource/components/content-tab/ChooseContentBlockOption.vue index 2e12425a7..8ac6f1b21 100644 --- a/LearningHub.Nhs.WebUI/Scripts/vuesrc/contribute-resource/components/content-tab/ChooseContentBlockOption.vue +++ b/LearningHub.Nhs.WebUI/Scripts/vuesrc/contribute-resource/components/content-tab/ChooseContentBlockOption.vue @@ -1,11 +1,14 @@ @@ -23,6 +27,7 @@ import MediaBlockImage from "./MediaBlockImage.vue"; import MediaBlockVideo from "./MediaBlockVideo.vue"; import Tick from "../../../globalcomponents/Tick.vue"; + import { resourceData } from '../../../data/resource'; import { AttachmentModel } from "../../../models/contribute-resource/blocks/attachmentModel"; import { FileUploadType } from '../../../helpers/fileUpload'; @@ -43,13 +48,17 @@ props: { mediaBlock: { type: Object } as PropOptions, }, - data(){ + data() { return { FileUploadType: FileUploadType, FileStore: FileStore /* It looks like FileStore isn't used, but we need it to be exposed here to allow Vue to make the files list reactive */, MediaTypeEnum: MediaTypeEnum, + contributeResourceAVFlag: true } }, + created() { + this.getContributeResAVResourceFlag(); + }, computed: { attachment(): AttachmentModel { return this.mediaBlock.attachment; @@ -59,11 +68,19 @@ }, video(): VideoMediaModel { return this.mediaBlock.video; + }, + audioVideoUnavailableView(): string { + return this.$store.state.getAVUnavailableView; } }, methods: { updatePublishingStatus() { this.mediaBlock.updatePublishingStatus(); + }, + getContributeResAVResourceFlag() { + resourceData.getContributeAVResourceFlag().then(response => { + this.contributeResourceAVFlag = response; + }); } } }) diff --git a/LearningHub.Nhs.WebUI/Scripts/vuesrc/contribute/Content.vue b/LearningHub.Nhs.WebUI/Scripts/vuesrc/contribute/Content.vue index 9bd2339d9..a74f8443a 100644 --- a/LearningHub.Nhs.WebUI/Scripts/vuesrc/contribute/Content.vue +++ b/LearningHub.Nhs.WebUI/Scripts/vuesrc/contribute/Content.vue @@ -501,6 +501,7 @@ localScormDetail: null as ScormResourceModel, showError: false, errorMessage: '', + contributeResourceAVFlag: true, } }, computed: { @@ -608,9 +609,6 @@ hierarchyEditLoaded(): boolean { return this.$store.state.hierarchyEditLoaded; }, - contributeResourceAVFlag(): boolean { - return this.$store.state.contributeAVResourceFlag; - }, audioVideoUnavailableView(): string { return this.$store.state.getAVUnavailableView; }, @@ -631,6 +629,7 @@ if (!this.$store.state.fileTypes) { this.$store.commit('populateFileTypes'); } + this.getContributeResAVResourceFlag(); this.uploadResourceTypes = await resourceData.getUploadResourceTypes(); const allResourceTypes = this.uploadResourceTypes.slice(); const allowedTypes = this.resourceTypesSupported.split(','); @@ -647,6 +646,11 @@ this.localScormDetail = _.cloneDeep(this.scormDetail); }, methods: { + getContributeResAVResourceFlag() { + resourceData.getContributeAVResourceFlag().then(response => { + this.contributeResourceAVFlag = response; + }); + }, setSpecificContentLocalValid(val: boolean) { this.specificContentLocalValid = val; }, @@ -906,7 +910,7 @@ if (this.selectedResourceType != ResourceType.UNDEFINED) { let fileExtension = this.uploadingFile.name.split(".").pop(); let resourceType: ResourceType = ResourceType.GENERICFILE; - if (fileExtension.toLowerCase() == 'zip' && this.selectedResourceType == ResourceType.SCORM) { + if (fileExtension.toLowerCase() == 'zip' && this.selectedResourceType == ResourceType.SCORM) { resourceType = ResourceType.SCORM; } else if (fileExtension.toLowerCase() == 'zip' && this.selectedResourceType == ResourceType.HTML) { resourceType = ResourceType.HTML; diff --git a/LearningHub.Nhs.WebUI/Scripts/vuesrc/helpers/fileUpload.ts b/LearningHub.Nhs.WebUI/Scripts/vuesrc/helpers/fileUpload.ts index 6973552c5..a2b10ebe9 100644 --- a/LearningHub.Nhs.WebUI/Scripts/vuesrc/helpers/fileUpload.ts +++ b/LearningHub.Nhs.WebUI/Scripts/vuesrc/helpers/fileUpload.ts @@ -324,7 +324,17 @@ export const getMediaTypeFromFileExtension = function (fileExtension: string): M return MediaTypeEnum.Attachment; } }; - +export const getMediaTypeFromFileExtensionContributeCaseOrAssessment = function (fileExtension: string): MediaTypeEnum { + if (isIncludedInListIgnoringCase(IMAGE_FILE_EXTENSIONS, fileExtension)) { + return MediaTypeEnum.Image; + } else if (isIncludedInListIgnoringCase(VIDEO_FILE_EXTENSIONS, fileExtension)) { + return MediaTypeEnum.Video; + } else if (isIncludedInListIgnoringCase(AUDIO_FILE_EXTENSIONS, fileExtension)) { + return MediaTypeEnum.Audio; + } else { + return MediaTypeEnum.Attachment; + } +}; export const getUploadTypeFromMediaType = function (mediaType: MediaTypeEnum): FileUploadType { switch (mediaType) { case MediaTypeEnum.Attachment: diff --git a/LearningHub.Nhs.WebUI/Scripts/vuesrc/models/contribute-resource/blocks/mediaTypeEnum.ts b/LearningHub.Nhs.WebUI/Scripts/vuesrc/models/contribute-resource/blocks/mediaTypeEnum.ts index 663bd6e7e..c567d05b4 100644 --- a/LearningHub.Nhs.WebUI/Scripts/vuesrc/models/contribute-resource/blocks/mediaTypeEnum.ts +++ b/LearningHub.Nhs.WebUI/Scripts/vuesrc/models/contribute-resource/blocks/mediaTypeEnum.ts @@ -3,4 +3,5 @@ export enum MediaTypeEnum { Attachment = 0, Image = 1, Video = 2, + Audio = 3, }