From 2077a63970caff0339aa02739b9dc90ea562e0f2 Mon Sep 17 00:00:00 2001 From: Ben Pennell Date: Wed, 4 Dec 2024 09:08:59 -0500 Subject: [PATCH] Re-delete deleted files. Fix click event bubble issue with download button now that it contains spans. Fix file list cutting off download dropdown for the last entry, and horizontal scroll --- static/css/sass/cdr_ui_styles.scss | 1 + .../full_record/downloadOptions.vue | 4 + .../full_record/restrictedContent.vue | 69 --------- .../src/mixins/fileDownloadUtils.js | 140 ------------------ 4 files changed, 5 insertions(+), 209 deletions(-) delete mode 100644 static/js/vue-cdr-access/src/components/full_record/restrictedContent.vue delete mode 100644 static/js/vue-cdr-access/src/mixins/fileDownloadUtils.js diff --git a/static/css/sass/cdr_ui_styles.scss b/static/css/sass/cdr_ui_styles.scss index d01201f94f..61039ad690 100644 --- a/static/css/sass/cdr_ui_styles.scss +++ b/static/css/sass/cdr_ui_styles.scss @@ -440,6 +440,7 @@ img.data-thumb { .child-records { font-size: 16px; + overflow: visible; .fa.default-img-icon { font-size: 32px; diff --git a/static/js/vue-cdr-access/src/components/full_record/downloadOptions.vue b/static/js/vue-cdr-access/src/components/full_record/downloadOptions.vue index 31641cf22c..1357db91e1 100644 --- a/static/js/vue-cdr-access/src/components/full_record/downloadOptions.vue +++ b/static/js/vue-cdr-access/src/components/full_record/downloadOptions.vue @@ -218,6 +218,10 @@ export default { text-align: center; } + .dropdown-trigger span, .dropdown-trigger i { + pointer-events: none; + } + @media screen and (min-width: 769px) { .modal-card { width: 680px; diff --git a/static/js/vue-cdr-access/src/components/full_record/restrictedContent.vue b/static/js/vue-cdr-access/src/components/full_record/restrictedContent.vue deleted file mode 100644 index a00d87cd7a..0000000000 --- a/static/js/vue-cdr-access/src/components/full_record/restrictedContent.vue +++ /dev/null @@ -1,69 +0,0 @@ - - - - - \ No newline at end of file diff --git a/static/js/vue-cdr-access/src/mixins/fileDownloadUtils.js b/static/js/vue-cdr-access/src/mixins/fileDownloadUtils.js deleted file mode 100644 index 12dbeb89f3..0000000000 --- a/static/js/vue-cdr-access/src/mixins/fileDownloadUtils.js +++ /dev/null @@ -1,140 +0,0 @@ -import permissionUtils from "./permissionUtils"; - -export default { - mixins: [permissionUtils], - - methods: { - showNonImageDownload(brief_object) { - return this.hasPermission(brief_object, 'viewOriginal') && - !brief_object.format.includes('Image') && this.getOriginalFile(brief_object) !== undefined; - }, - - getOriginalFile(brief_object) { - const original_file = brief_object.datastream.find(file => file.startsWith('original_file')); - if (original_file === undefined) { - return undefined; - } - - return original_file; - }, - - getJp2FileDimensions(brief_object) { - const jp2_file = brief_object.datastream.find(file => file.startsWith('jp2')); - if (jp2_file === undefined) { - return undefined; - } - - // Check for jp2 dimensions - const jp2_dimensions = this.getImageDimensions(jp2_file); - if (jp2_dimensions === '') { - return undefined; - } - - return jp2_dimensions; - }, - - getImageDimensions(image_metadata) { - const image_dimensions = image_metadata.split('|'); - return image_dimensions[image_dimensions.length - 1]; - }, - - largestImageEdge(brief_object) { - let dimensions_info = this.getJp2FileDimensions(brief_object); - if (dimensions_info === undefined) { - dimensions_info = this.getImageDimensions(this.getOriginalFile(brief_object)); - } - const edge_sizes = dimensions_info.split('x').map(x => parseInt(x)); - - return edge_sizes[0] > edge_sizes[1] ? edge_sizes[0] : edge_sizes[1]; - }, - - showImageDownload(brief_object) { - return this.hasPermission(brief_object, 'viewReducedResImages') && - brief_object.format.includes('Image') && this.getOriginalFile(brief_object) !== undefined - }, - - imgDownloadLink(file_id, size) { - return `/services/api/downloadImage/${file_id}/${size}` - }, - - validSizeOption(brief_object, size) { - return size <= this.largestImageEdge(brief_object); - }, - - downloadButtonHtml(brief_object) { - if (this.showNonImageDownload(brief_object)) { - return `
- ${this.$t('full_record.download')} -
`; - } else if (this.showImageDownload(brief_object)) { - let html = `'; - - return html; - } else { - return ''; - } - }, - - showDropdownList(e) { - // Close any currently open dropdowns - this.closeDropdownLists(e); - - if (e.target.id.startsWith('dcr-download')) { - let drop_down = e.target.parentElement.parentElement.querySelector('.dropdown-menu'); - if (drop_down !== null) { - drop_down.setAttribute('aria-hidden', 'false'); - drop_down.classList.add('show-list'); - } - } - }, - - closeDropdownLists() { - document.querySelectorAll('.show-list').forEach(element => { - element.setAttribute('aria-hidden', 'true'); - element.classList.remove('show-list'); - }); - } - }, - - mounted() { - document.addEventListener('click', this.showDropdownList); - document.addEventListener('keyup', this.closeDropdownLists); - }, - - unmounted() { - document.removeEventListener('click', this.showDropdownList); - document.removeEventListener('keyup', this.closeDropdownLists); - } -} \ No newline at end of file