Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,10 @@
<!-- Subtitles -->
<VLayout v-if="videoSelected" row wrap class="section">
<VFlex xs12>
<SubtitlesList :nodeId="firstNode.id" />
<SubtitlesList
:nodeId="firstNode.id"
@addFile="subtitleFileLanguageComparison"
/>
</VFlex>
</VLayout>

Expand Down Expand Up @@ -384,7 +387,7 @@
import VisibilityDropdown from 'shared/views/VisibilityDropdown';
import Checkbox from 'shared/views/form/Checkbox';
import { ContentKindsNames } from 'shared/leUtils/ContentKinds';
import { NEW_OBJECT, FeatureFlagKeys } from 'shared/constants';
import { NEW_OBJECT, FeatureFlagKeys, AccessibilityCategories } from 'shared/constants';
import { constantsTranslationMixin, metadataTranslationMixin } from 'shared/mixins';

// Define an object to act as the place holder for non unique values.
Expand Down Expand Up @@ -809,6 +812,11 @@
eventLabel: 'File',
});
},
subtitleFileLanguageComparison(file) {
if (this.oneSelected && this.language === file.language) {
this.accessibility = [...this.accessibility, AccessibilityCategories.CAPTIONS_SUBTITLES];
}
},
},
$trs: {
basicInfoHeader: 'Basic information',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
:readonly="readonly"
:nodeId="nodeId"
@upload="trackUpload"
@addFile="addFileHandler"
/>
</div>

Expand Down Expand Up @@ -53,6 +54,9 @@
eventLabel: 'Related file',
});
},
addFileHandler(f) {
this.$emit('addFile', f);
},
},
$trs: {
subtitlesHeader: 'Captions and subtitles',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>

<VList two-line>
<VList>
<SupplementaryItem
v-for="file in files"
:key="file.id"
Expand All @@ -18,18 +18,20 @@
@upload="$emit('upload')"
>
<template #default="{ openFileDialog }">
<VListTile @click.stop>
<VListTile inactive class="languageTile py-2">
<VListTileContent v-if="!addingFile">
<ActionLink
data-test="add-file"
:text="addText"
@click="addingFile = true"
/>
</VListTileContent>
<VListTileContent v-else style="max-width: 250px; height: auto;">
<VListTileContent v-else class="captionLanguageDropdown">
<LanguageDropdown
id="captionLanguage"
v-model="selectedLanguage"
data-test="select-language"
dropAbove
:excludeLanguages="currentLanguages"
hide-details
/>
Expand Down Expand Up @@ -117,7 +119,10 @@
methods: {
...mapActions('file', ['updateFile', 'deleteFile']),
add(file) {
this.makeFile(file).then(this.reset);
this.makeFile(file).then(f => {
this.$emit('addFile', f);
this.reset();
});
},
makeFile(file) {
return this.updateFile({
Expand All @@ -142,3 +147,20 @@
};

</script>
<style lang="less" scoped>

.languageTile:hover {
background-color: var(--v-greyBackground-base);
}

/deep/ .languageTile > .v-list__tile {
height: 56px;
}

.captionLanguageDropdown {
max-width: 250px;
height: auto;
overflow: visible;
}

</style>
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export const ContentModalities = {
export const AccessibilityCategoriesMap = {
// Note: audio is not included, as it is rendered in the UI differently.
document: ['ALT_TEXT', 'HIGH_CONTRAST', 'TAGGED_PDF'],
video: ['SIGN_LANGUAGE', 'AUDIO_DESCRIPTION'],
video: ['SIGN_LANGUAGE', 'AUDIO_DESCRIPTION', 'CAPTIONS_SUBTITLES'],
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like an important bug fix in its own right!

exercise: ['ALT_TEXT'],
html5: ['ALT_TEXT', 'HIGH_CONTRAST'],
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
:menu-props="menuProps"
:multiple="multiple"
:chips="multiple"
attach="#language"
:attach="$attrs.id ? `#${$attrs.id}` : '.language-dropdown'"
@change="input = ''"
@focus="$emit('focus')"
>
Expand Down Expand Up @@ -73,6 +73,10 @@
type: Boolean,
default: false,
},
dropAbove: {
type: Boolean,
default: false,
},
},
data() {
return {
Expand All @@ -92,6 +96,7 @@
return {
minWidth: 300,
maxWidth: 300,
top: this.dropAbove,
};
},
languages() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export function updateFile(context, { id, ...payload }) {
}
}
}
return { id, ...fileData };
});
}

Expand Down