From fa11301968a8e328477edba9256da0d23a08cc83 Mon Sep 17 00:00:00 2001 From: binon Date: Thu, 18 Apr 2024 20:18:06 +0100 Subject: [PATCH 1/2] TD3828 - Configured Case and assessment to use AMS flag --- .../contribute-resource/ContributeBlock.vue | 15 ++- .../ContributeCaseOrAssessmentContent.vue | 91 ++++++++++++++++--- .../content-tab/ChooseContentBlockOption.vue | 26 +++++- .../content-tab/ContributeMediaBlock.vue | 27 +++++- .../Scripts/vuesrc/contribute/Content.vue | 12 ++- .../Scripts/vuesrc/helpers/fileUpload.ts | 12 ++- .../blocks/mediaTypeEnum.ts | 1 + 7 files changed, 156 insertions(+), 28 deletions(-) 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..524798b82 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,32 @@ ref="addMediaInput" multiple @change="uploadNewMediaFiles" - class="visually-hidden"/> + class="visually-hidden" /> + +
+ + + +
+
@@ -114,4 +171,8 @@ .placeholder-text { color: $nhsuk-grey; } + .modal-content--scroll { + max-height: 90vh; + overflow-y: auto; + } \ No newline at end of file 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, } From 9123b772cc80ee870fbdf8dffd25062d2959c6ff Mon Sep 17 00:00:00 2001 From: binon Date: Fri, 19 Apr 2024 11:38:57 +0100 Subject: [PATCH 2/2] TD-3828, updated the way the popup works in caseassesment vue page --- .../ContributeCaseOrAssessmentContent.vue | 29 +++++-------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/LearningHub.Nhs.WebUI/Scripts/vuesrc/contribute-resource/ContributeCaseOrAssessmentContent.vue b/LearningHub.Nhs.WebUI/Scripts/vuesrc/contribute-resource/ContributeCaseOrAssessmentContent.vue index 524798b82..ed08da72b 100644 --- a/LearningHub.Nhs.WebUI/Scripts/vuesrc/contribute-resource/ContributeCaseOrAssessmentContent.vue +++ b/LearningHub.Nhs.WebUI/Scripts/vuesrc/contribute-resource/ContributeCaseOrAssessmentContent.vue @@ -27,23 +27,10 @@ @change="uploadNewMediaFiles" class="visually-hidden" /> -
- - - -
- + +
+ +
@@ -60,12 +47,13 @@ FileUploadType, getAllowedFileExtensionsInAcceptFormat, startUploadsFromFileElement, - getMediaTypeFromFileExtensionContributeCaseOrAssessment + getMediaTypeFromFileExtensionContributeCaseOrAssessment } from '../helpers/fileUpload'; import FilteredBlockCollectionView from './components/questions/FilteredBlockCollectionView.vue'; import { WholeSlideImageModel } from "../models/contribute-resource/blocks/wholeSlideImageModel"; import { ResourceType } from "../constants"; import { MediaTypeEnum } from '../models/contribute-resource/blocks/mediaTypeEnum'; + import Modal from '../globalcomponents/Modal.vue'; export default Vue.extend({ props: { @@ -80,6 +68,7 @@ ContributeAddContentBlock, ContributeChooseContentBlockType, FilteredBlockCollectionView, + Modal, }, data() { return { @@ -171,8 +160,4 @@ .placeholder-text { color: $nhsuk-grey; } - .modal-content--scroll { - max-height: 90vh; - overflow-y: auto; - } \ No newline at end of file