From 3d88fdaaddca15b98efa938f0b2813420d56ad84 Mon Sep 17 00:00:00 2001 From: kolaente Date: Sun, 2 Oct 2022 13:01:29 +0200 Subject: [PATCH 01/10] feat: add display of kanban card attachment image --- src/components/tasks/partials/attachments.vue | 5 +- src/components/tasks/partials/kanban-card.vue | 134 +++++++++++------- src/modelTypes/ITask.ts | 6 +- src/models/attachment.ts | 2 + 4 files changed, 91 insertions(+), 56 deletions(-) diff --git a/src/components/tasks/partials/attachments.vue b/src/components/tasks/partials/attachments.vue index 5b70d84b..70d6b049 100644 --- a/src/components/tasks/partials/attachments.vue +++ b/src/components/tasks/partials/attachments.vue @@ -145,6 +145,7 @@ import User from '@/components/misc/user.vue' import BaseButton from '@/components/base/BaseButton.vue' import AttachmentService from '@/services/attachment' +import {SUPPORTED_IMAGE_SUFFIX} from '@/models/attachment' import type AttachmentModel from '@/models/attachment' import type {IAttachment} from '@/modelTypes/IAttachment' import type {ITask} from '@/modelTypes/ITask' @@ -223,10 +224,8 @@ async function deleteAttachment() { } const attachmentImageBlobUrl = ref(null) -const SUPPORTED_SUFFIX = ['.jpg', '.png', '.bmp', '.gif'] - async function viewOrDownload(attachment: AttachmentModel) { - if (SUPPORTED_SUFFIX.some((suffix) => attachment.file.name.endsWith(suffix)) ) { + if (SUPPORTED_IMAGE_SUFFIX.some((suffix) => attachment.file.name.endsWith(suffix)) ) { attachmentImageBlobUrl.value = await attachmentService.getBlobUrl(attachment) } else { downloadAttachment(attachment) diff --git a/src/components/tasks/partials/kanban-card.vue b/src/components/tasks/partials/kanban-card.vue index 1ee64f36..af16719e 100644 --- a/src/components/tasks/partials/kanban-card.vue +++ b/src/components/tasks/partials/kanban-card.vue @@ -11,62 +11,70 @@ @click.ctrl="() => toggleTaskDone(task)" @click.meta="() => toggleTaskDone(task)" > - - - - - - - - + +
+ + + + - - -

{{ task.title }}

- - {{ task.percentDone * 100 }}% - - \ No newline at end of file diff --git a/src/i18n/lang/en.json b/src/i18n/lang/en.json index 2a8615b8..780ce3b7 100644 --- a/src/i18n/lang/en.json +++ b/src/i18n/lang/en.json @@ -696,7 +696,8 @@ "copyUrlTooltip": "Copy the url of this attachment for usage in text", "setAsCover": "Make cover", "unsetAsCover": "Remove cover", - "successfullyChangedCoverImage": "The cover image was successfully changed." + "successfullyChangedCoverImage": "The cover image was successfully changed.", + "usedAsCover": "Cover image" }, "comment": { "title": "Comments",